| Differences between
and this patch
- Source/JavaScriptCore/ChangeLog +15 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2011-01-03  Steve Block  <steveblock@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        GeolocationPositionCache should not use ScriptExecutionContext::Task
6
        https://bugs.webkit.org/show_bug.cgi?id=51818
7
8
        Adds a new Task interface.
9
10
        * GNUmakefile.am:
11
        * JavaScriptCore.gypi:
12
        * JavaScriptCore.xcodeproj/project.pbxproj:
13
        * wtf/Task.h: Added.
14
        (WTF::Task::~Task):
15
1
2011-01-02  Dan Bernstein  <mitz@apple.com>
16
2011-01-02  Dan Bernstein  <mitz@apple.com>
2
17
3
        Rubber-stamped by Simon Fraser.
18
        Rubber-stamped by Simon Fraser.
- Source/JavaScriptCore/GNUmakefile.am +1 lines
Lines 504-509 javascriptcore_sources += \ Source/JavaScriptCore/GNUmakefile.am_sec1
504
	Source/JavaScriptCore/wtf/StdLibExtras.h \
504
	Source/JavaScriptCore/wtf/StdLibExtras.h \
505
	Source/JavaScriptCore/wtf/StringExtras.h \
505
	Source/JavaScriptCore/wtf/StringExtras.h \
506
	Source/JavaScriptCore/wtf/StringHasher.h \
506
	Source/JavaScriptCore/wtf/StringHasher.h \
507
	Source/JavaScriptCore/wtf/Task.h \
507
	Source/JavaScriptCore/wtf/TCPackedCache.h \
508
	Source/JavaScriptCore/wtf/TCPackedCache.h \
508
	Source/JavaScriptCore/wtf/TCPageMap.h \
509
	Source/JavaScriptCore/wtf/TCPageMap.h \
509
	Source/JavaScriptCore/wtf/TCSpinLock.h \
510
	Source/JavaScriptCore/wtf/TCSpinLock.h \
- Source/JavaScriptCore/JavaScriptCore.gypi -3 / +4 lines
Lines 415-420 Source/JavaScriptCore/JavaScriptCore.gypi_sec1
415
            'wtf/PassRefPtr.h',
415
            'wtf/PassRefPtr.h',
416
            'wtf/Platform.h',
416
            'wtf/Platform.h',
417
            'wtf/PtrAndFlags.h',
417
            'wtf/PtrAndFlags.h',
418
            'wtf/qt/MainThreadQt.cpp',
419
            'wtf/qt/StringQt.cpp',
420
            'wtf/qt/ThreadingQt.cpp',
418
            'wtf/RandomNumber.cpp',
421
            'wtf/RandomNumber.cpp',
419
            'wtf/RandomNumber.h',
422
            'wtf/RandomNumber.h',
420
            'wtf/RandomNumberSeed.h',
423
            'wtf/RandomNumberSeed.h',
Lines 432-441 Source/JavaScriptCore/JavaScriptCore.gypi_sec2
432
            'wtf/StdLibExtras.h',
435
            'wtf/StdLibExtras.h',
433
            'wtf/StringExtras.h',
436
            'wtf/StringExtras.h',
434
            'wtf/StringHasher.h',
437
            'wtf/StringHasher.h',
438
            'wtf/Task.h',
435
            'wtf/TCPackedCache.h',
439
            'wtf/TCPackedCache.h',
436
            'wtf/qt/MainThreadQt.cpp',
437
            'wtf/qt/StringQt.cpp',
438
            'wtf/qt/ThreadingQt.cpp',
439
            'wtf/TCPageMap.h',
440
            'wtf/TCPageMap.h',
440
            'wtf/TCSpinLock.h',
441
            'wtf/TCSpinLock.h',
441
            'wtf/TCSystemAlloc.cpp',
442
            'wtf/TCSystemAlloc.cpp',
- Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +4 lines
Lines 189-194 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec1
189
		44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
189
		44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
190
		511FC4C9117EE28700425272 /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511FC4C7117EE23D00425272 /* MD5.cpp */; };
190
		511FC4C9117EE28700425272 /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511FC4C7117EE23D00425272 /* MD5.cpp */; };
191
		511FC4CB117EE2A800425272 /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 511FC4CA117EE2A800425272 /* MD5.h */; settings = {ATTRIBUTES = (Private, ); }; };
191
		511FC4CB117EE2A800425272 /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 511FC4CA117EE2A800425272 /* MD5.h */; settings = {ATTRIBUTES = (Private, ); }; };
192
		5983BCE512D21D7F009662D5 /* Task.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C3D7A412D21B1C00BE4166 /* Task.h */; settings = {ATTRIBUTES = (Private, ); }; };
192
		5D53726F0E1C54880021E549 /* Tracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D53726E0E1C54880021E549 /* Tracing.h */; };
193
		5D53726F0E1C54880021E549 /* Tracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D53726E0E1C54880021E549 /* Tracing.h */; };
193
		5D5D8AB60E0D0A7200F9C692 /* jsc in Copy Into Framework */ = {isa = PBXBuildFile; fileRef = 932F5BE10822A1C700736975 /* jsc */; };
194
		5D5D8AB60E0D0A7200F9C692 /* jsc in Copy Into Framework */ = {isa = PBXBuildFile; fileRef = 932F5BE10822A1C700736975 /* jsc */; };
194
		5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
195
		5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
Lines 763-768 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec2
763
		51F0EB6105C86C6B00E6DF1B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
764
		51F0EB6105C86C6B00E6DF1B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
764
		51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
765
		51F0EC0705C86C9A00E6DF1B /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
765
		51F648D60BB4E2CA0033D760 /* RetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RetainPtr.h; sourceTree = "<group>"; };
766
		51F648D60BB4E2CA0033D760 /* RetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RetainPtr.h; sourceTree = "<group>"; };
767
		59C3D7A412D21B1C00BE4166 /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Task.h; sourceTree = "<group>"; };
766
		5D53726D0E1C546B0021E549 /* Tracing.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Tracing.d; sourceTree = "<group>"; };
768
		5D53726D0E1C546B0021E549 /* Tracing.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Tracing.d; sourceTree = "<group>"; };
767
		5D53726E0E1C54880021E549 /* Tracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tracing.h; sourceTree = "<group>"; };
769
		5D53726E0E1C54880021E549 /* Tracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tracing.h; sourceTree = "<group>"; };
768
		5D53727D0E1C55EC0021E549 /* TracingDtrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TracingDtrace.h; sourceTree = "<group>"; };
770
		5D53727D0E1C55EC0021E549 /* TracingDtrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TracingDtrace.h; sourceTree = "<group>"; };
Lines 1485-1490 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec3
1485
		65162EF108E6A21C007556CD /* wtf */ = {
1487
		65162EF108E6A21C007556CD /* wtf */ = {
1486
			isa = PBXGroup;
1488
			isa = PBXGroup;
1487
			children = (
1489
			children = (
1490
				59C3D7A412D21B1C00BE4166 /* Task.h */,
1488
				93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
1491
				93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
1489
				938C4F690CA06BC700D9310A /* ASCIICType.h */,
1492
				938C4F690CA06BC700D9310A /* ASCIICType.h */,
1490
				65E217B808E7EECC0023E5F6 /* Assertions.cpp */,
1493
				65E217B808E7EECC0023E5F6 /* Assertions.cpp */,
Lines 2375-2380 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj_sec4
2375
				1400067712A6F7830064D123 /* OSAllocator.h in Headers */,
2378
				1400067712A6F7830064D123 /* OSAllocator.h in Headers */,
2376
				14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */,
2379
				14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */,
2377
				14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */,
2380
				14FFF98D12BFFF7500795BB8 /* PageAllocationAligned.h in Headers */,
2381
				5983BCE512D21D7F009662D5 /* Task.h in Headers */,
2378
			);
2382
			);
2379
			runOnlyForDeploymentPostprocessing = 0;
2383
			runOnlyForDeploymentPostprocessing = 0;
2380
		};
2384
		};
- Source/JavaScriptCore/wtf/Task.h +48 lines
Line 0 Source/JavaScriptCore/wtf/Task.h_sec1
1
/*
2
 * Copyright (C) 2011 Google Inc.  All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
6
 * met:
7
 *
8
 *     * Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 *     * Redistributions in binary form must reproduce the above
11
 * copyright notice, this list of conditions and the following disclaimer
12
 * in the documentation and/or other materials provided with the
13
 * distribution.
14
 *     * Neither the name of Google Inc. nor the names of its
15
 * contributors may be used to endorse or promote products derived from
16
 * this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#ifndef Task_h
32
#define Task_h
33
34
#include "Noncopyable.h"
35
36
namespace WTF {
37
38
class Task : public Noncopyable {
39
public:
40
    virtual ~Task() {}
41
    virtual void performTask() = 0;
42
};
43
44
} // namespace WTF
45
46
using WTF::Task;
47
48
#endif // Task_h
- WebCore/ChangeLog +42 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2011-01-03  Steve Block  <steveblock@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        GeolocationPositionCache should not use ScriptExecutionContext::Task
6
        https://bugs.webkit.org/show_bug.cgi?id=51818
7
8
        Adds a new Task interface that is used by existing users of tasks
9
        with MessageQueue.
10
11
        No new tests, refactoring only.
12
13
        * ForwardingHeaders/wtf/Task.h: Added.
14
        * fileapi/FileThread.cpp:
15
        (WebCore::FileThread::postTask):
16
        (WebCore::SameInstancePredicate::operator()):
17
        * fileapi/FileThread.h:
18
        (WebCore::FileThread::FileTask::FileTask):
19
        * fileapi/FileThreadTask.h:
20
        (WebCore::FileThreadTask0::FileThreadTask0):
21
        (WebCore::FileThreadTask1::FileThreadTask1):
22
        (WebCore::FileThreadTask2::FileThreadTask2):
23
        (WebCore::FileThreadTask3::FileThreadTask3):
24
        (WebCore::createFileThreadTask):
25
        * page/GeolocationPositionCache.cpp:
26
        (WebCore::CacheTask::CacheTask):
27
        (WebCore::CacheReadTask::create):
28
        (WebCore::CacheReadTask::CacheReadTask):
29
        (WebCore::CacheReadTask::performTask):
30
        (WebCore::CacheWriteTask::create):
31
        (WebCore::CacheWriteTask::CacheWriteTask):
32
        (WebCore::CacheWriteTask::performTask):
33
        (WebCore::GeolocationPositionCache::threadEntryPointImpl):
34
        (WebCore::GeolocationPositionCache::triggerReadFromDatabase):
35
        (WebCore::GeolocationPositionCache::readFromDatabase):
36
        (WebCore::GeolocationPositionCache::triggerWriteToDatabase):
37
        (WebCore::GeolocationPositionCache::writeToDatabase):
38
        * page/GeolocationPositionCache.h:
39
        * storage/DatabaseTask.h:
40
        * storage/LocalStorageTask.cpp:
41
        * storage/LocalStorageTask.h:
42
1
2011-01-03  Csaba Osztrogonác  <ossy@webkit.org>
43
2011-01-03  Csaba Osztrogonác  <ossy@webkit.org>
2
44
3
        [Qt] Unreviewed buildfix for --minimal build after r74895.
45
        [Qt] Unreviewed buildfix for --minimal build after r74895.
- WebCore/ForwardingHeaders/wtf/Task.h +4 lines
Line 0 WebCore/ForwardingHeaders/wtf/Task.h_sec1
1
#ifndef WebCore_FWD_Task_h
2
#define WebCore_FWD_Task_h
3
#include <JavaScriptCore/Task.h>
4
#endif
- WebCore/fileapi/FileThread.cpp -2 / +2 lines
Lines 64-70 void FileThread::stop() WebCore/fileapi/FileThread.cpp_sec1
64
    m_queue.kill();
64
    m_queue.kill();
65
}
65
}
66
66
67
void FileThread::postTask(PassOwnPtr<Task> task)
67
void FileThread::postTask(PassOwnPtr<FileTask> task)
68
{
68
{
69
    m_queue.append(task);
69
    m_queue.append(task);
70
}
70
}
Lines 72-78 void FileThread::postTask(PassOwnPtr<Tas WebCore/fileapi/FileThread.cpp_sec2
72
class SameInstancePredicate {
72
class SameInstancePredicate {
73
public:
73
public:
74
    SameInstancePredicate(const void* instance) : m_instance(instance) { }
74
    SameInstancePredicate(const void* instance) : m_instance(instance) { }
75
    bool operator()(FileThread::Task* task) const { return task->instance() == m_instance; }
75
    bool operator()(FileThread::FileTask* task) const { return task->instance() == m_instance; }
76
private:
76
private:
77
    const void* m_instance;
77
    const void* m_instance;
78
};
78
};
- WebCore/fileapi/FileThread.h -6 / +5 lines
Lines 36-41 WebCore/fileapi/FileThread.h_sec1
36
#include <wtf/MessageQueue.h>
36
#include <wtf/MessageQueue.h>
37
#include <wtf/PassOwnPtr.h>
37
#include <wtf/PassOwnPtr.h>
38
#include <wtf/PassRefPtr.h>
38
#include <wtf/PassRefPtr.h>
39
#include <wtf/Task.h>
39
#include <wtf/Threading.h>
40
#include <wtf/Threading.h>
40
41
41
namespace WebCore {
42
namespace WebCore {
Lines 54-70 public: WebCore/fileapi/FileThread.h_sec2
54
    bool start();
55
    bool start();
55
    void stop();
56
    void stop();
56
57
57
    class Task : public Noncopyable {
58
    class FileTask : public Task {
58
    public:
59
    public:
59
        virtual ~Task() { }
60
        virtual void performTask() = 0;
61
        void* instance() const { return m_instance; }
60
        void* instance() const { return m_instance; }
62
    protected:
61
    protected:
63
        Task(void* instance) : m_instance(instance) { }
62
        FileTask(void* instance) : m_instance(instance) { }
64
        void* m_instance;
63
        void* m_instance;
65
    };
64
    };
66
65
67
    void postTask(PassOwnPtr<Task> task);
66
    void postTask(PassOwnPtr<FileTask>);
68
67
69
    void unscheduleTasks(const void* instance);
68
    void unscheduleTasks(const void* instance);
70
69
Lines 76-82 private: WebCore/fileapi/FileThread.h_sec3
76
75
77
    ThreadIdentifier m_threadID;
76
    ThreadIdentifier m_threadID;
78
    RefPtr<FileThread> m_selfRef;
77
    RefPtr<FileThread> m_selfRef;
79
    MessageQueue<Task> m_queue;
78
    MessageQueue<FileTask> m_queue;
80
79
81
    Mutex m_threadCreationMutex;
80
    Mutex m_threadCreationMutex;
82
};
81
};
- WebCore/fileapi/FileThreadTask.h -13 / +13 lines
Lines 40-46 WebCore/fileapi/FileThreadTask.h_sec1
40
namespace WebCore {
40
namespace WebCore {
41
41
42
template<typename T>
42
template<typename T>
43
class FileThreadTask0 : public FileThread::Task {
43
class FileThreadTask0 : public FileThread::FileTask {
44
public:
44
public:
45
    typedef void (T::*Method)();
45
    typedef void (T::*Method)();
46
    typedef FileThreadTask0<T> FileThreadTaskImpl;
46
    typedef FileThreadTask0<T> FileThreadTaskImpl;
Lines 52-58 public: WebCore/fileapi/FileThreadTask.h_sec2
52
52
53
private:
53
private:
54
    FileThreadTask0(T* instance, Method method)
54
    FileThreadTask0(T* instance, Method method)
55
        : FileThread::Task(instance)
55
        : FileThread::FileTask(instance)
56
        , m_method(method)
56
        , m_method(method)
57
    {
57
    {
58
    }
58
    }
Lines 67-73 private: WebCore/fileapi/FileThreadTask.h_sec3
67
};
67
};
68
68
69
template<typename T, typename P1, typename MP1>
69
template<typename T, typename P1, typename MP1>
70
class FileThreadTask1 : public FileThread::Task {
70
class FileThreadTask1 : public FileThread::FileTask {
71
public:
71
public:
72
    typedef void (T::*Method)(MP1);
72
    typedef void (T::*Method)(MP1);
73
    typedef FileThreadTask1<T, P1, MP1> FileThreadTaskImpl;
73
    typedef FileThreadTask1<T, P1, MP1> FileThreadTaskImpl;
Lines 80-86 public: WebCore/fileapi/FileThreadTask.h_sec4
80
80
81
private:
81
private:
82
    FileThreadTask1(T* instance, Method method, Param1 parameter1)
82
    FileThreadTask1(T* instance, Method method, Param1 parameter1)
83
        : FileThread::Task(instance)
83
        : FileThread::FileTask(instance)
84
        , m_method(method)
84
        , m_method(method)
85
        , m_parameter1(parameter1)
85
        , m_parameter1(parameter1)
86
    {
86
    {
Lines 97-103 private: WebCore/fileapi/FileThreadTask.h_sec5
97
};
97
};
98
98
99
template<typename T, typename P1, typename MP1, typename P2, typename MP2>
99
template<typename T, typename P1, typename MP1, typename P2, typename MP2>
100
class FileThreadTask2 : public FileThread::Task {
100
class FileThreadTask2 : public FileThread::FileTask {
101
public:
101
public:
102
    typedef void (T::*Method)(MP1, MP2);
102
    typedef void (T::*Method)(MP1, MP2);
103
    typedef FileThreadTask2<T, P1, MP1, P2, MP2> FileThreadTaskImpl;
103
    typedef FileThreadTask2<T, P1, MP1, P2, MP2> FileThreadTaskImpl;
Lines 111-117 public: WebCore/fileapi/FileThreadTask.h_sec6
111
111
112
private:
112
private:
113
    FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
113
    FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
114
        : FileThread::Task(instance)
114
        : FileThread::FileTask(instance)
115
        , m_method(method)
115
        , m_method(method)
116
        , m_parameter1(parameter1)
116
        , m_parameter1(parameter1)
117
        , m_parameter2(parameter2)
117
        , m_parameter2(parameter2)
Lines 130-136 private: WebCore/fileapi/FileThreadTask.h_sec7
130
};
130
};
131
131
132
template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
132
template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
133
class FileThreadTask3 : public FileThread::Task {
133
class FileThreadTask3 : public FileThread::FileTask {
134
public:
134
public:
135
    typedef void (T::*Method)(MP1, MP2, MP3);
135
    typedef void (T::*Method)(MP1, MP2, MP3);
136
    typedef FileThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl;
136
    typedef FileThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl;
Lines 145-151 public: WebCore/fileapi/FileThreadTask.h_sec8
145
145
146
private:
146
private:
147
    FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
147
    FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
148
        : FileThread::Task(instance)
148
        : FileThread::FileTask(instance)
149
        , m_method(method)
149
        , m_method(method)
150
        , m_parameter1(parameter1)
150
        , m_parameter1(parameter1)
151
        , m_parameter2(parameter2)
151
        , m_parameter2(parameter2)
Lines 166-177 private: WebCore/fileapi/FileThreadTask.h_sec9
166
};
166
};
167
167
168
template<typename T>
168
template<typename T>
169
PassOwnPtr<FileThread::Task> createFileThreadTask(
169
PassOwnPtr<FileThread::FileTask> createFileThreadTask(
170
    T* const callee,
170
    T* const callee,
171
    void (T::*method)());
171
    void (T::*method)());
172
172
173
template<typename T>
173
template<typename T>
174
PassOwnPtr<FileThread::Task> createFileThreadTask(
174
PassOwnPtr<FileThread::FileTask> createFileThreadTask(
175
    T* const callee,
175
    T* const callee,
176
    void (T::*method)())
176
    void (T::*method)())
177
{
177
{
Lines 181-187 PassOwnPtr<FileThread::Task> createFileT WebCore/fileapi/FileThreadTask.h_sec10
181
}
181
}
182
182
183
template<typename T, typename P1, typename MP1>
183
template<typename T, typename P1, typename MP1>
184
PassOwnPtr<FileThread::Task> createFileThreadTask(
184
PassOwnPtr<FileThread::FileTask> createFileThreadTask(
185
    T* const callee,
185
    T* const callee,
186
    void (T::*method)(MP1),
186
    void (T::*method)(MP1),
187
    const P1& parameter1)
187
    const P1& parameter1)
Lines 193-199 PassOwnPtr<FileThread::Task> createFileT WebCore/fileapi/FileThreadTask.h_sec11
193
}
193
}
194
194
195
template<typename T, typename P1, typename MP1, typename P2, typename MP2>
195
template<typename T, typename P1, typename MP1, typename P2, typename MP2>
196
PassOwnPtr<FileThread::Task> createFileThreadTask(
196
PassOwnPtr<FileThread::FileTask> createFileThreadTask(
197
    T* const callee,
197
    T* const callee,
198
    void (T::*method)(MP1, MP2),
198
    void (T::*method)(MP1, MP2),
199
    const P1& parameter1,
199
    const P1& parameter1,
Lines 207-213 PassOwnPtr<FileThread::Task> createFileT WebCore/fileapi/FileThreadTask.h_sec12
207
}
207
}
208
208
209
template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
209
template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
210
PassOwnPtr<FileThread::Task> createFileThreadTask(
210
PassOwnPtr<FileThread::FileTask> createFileThreadTask(
211
    T* const callee,
211
    T* const callee,
212
    void (T::*method)(MP1, MP2, MP3),
212
    void (T::*method)(MP1, MP2, MP3),
213
    const P1& parameter1,
213
    const P1& parameter1,
- WebCore/page/GeolocationPositionCache.cpp -19 / +28 lines
Lines 28-34 WebCore/page/GeolocationPositionCache.cpp_sec1
28
28
29
#if ENABLE(GEOLOCATION)
29
#if ENABLE(GEOLOCATION)
30
30
31
#include "CrossThreadTask.h"
32
#include "Geoposition.h"
31
#include "Geoposition.h"
33
#include "SQLValue.h"
32
#include "SQLValue.h"
34
#include "SQLiteDatabase.h"
33
#include "SQLiteDatabase.h"
Lines 44-49 namespace WebCore { WebCore/page/GeolocationPositionCache.cpp_sec2
44
43
45
static int numUsers = 0;
44
static int numUsers = 0;
46
45
46
class CacheTask : public Task {
47
protected:
48
    CacheTask(GeolocationPositionCache* cache) : m_cache(cache) {}
49
    GeolocationPositionCache* m_cache;
50
};
51
52
class CacheReadTask : public CacheTask {
53
public:
54
    static PassOwnPtr<CacheReadTask> create(GeolocationPositionCache* cache) { return adoptPtr(new CacheReadTask(cache)); }
55
private:
56
    CacheReadTask(GeolocationPositionCache* cache) : CacheTask(cache) {}
57
    void performTask() { m_cache->readFromDatabase(); }
58
};
59
60
class CacheWriteTask : public CacheTask {
61
public:
62
    static PassOwnPtr<CacheWriteTask> create(GeolocationPositionCache* cache) { return adoptPtr(new CacheWriteTask(cache)); }
63
private:
64
    CacheWriteTask(GeolocationPositionCache* cache) : CacheTask(cache) {}
65
    void performTask() { m_cache->writeToDatabase(); }
66
};
67
47
GeolocationPositionCache* GeolocationPositionCache::instance()
68
GeolocationPositionCache* GeolocationPositionCache::instance()
48
{
69
{
49
    DEFINE_STATIC_LOCAL(GeolocationPositionCache*, instance, (0));
70
    DEFINE_STATIC_LOCAL(GeolocationPositionCache*, instance, (0));
Lines 120-142 void* GeolocationPositionCache::threadEn WebCore/page/GeolocationPositionCache.cpp_sec3
120
141
121
void GeolocationPositionCache::threadEntryPointImpl()
142
void GeolocationPositionCache::threadEntryPointImpl()
122
{
143
{
123
    while (OwnPtr<ScriptExecutionContext::Task> task = m_queue.waitForMessage()) {
144
    while (OwnPtr<Task> task = m_queue.waitForMessage())
124
        // We don't need a ScriptExecutionContext in the callback, so pass 0 here.
145
        task->performTask();
125
        task->performTask(0);
126
    }
127
}
146
}
128
147
129
void GeolocationPositionCache::triggerReadFromDatabase()
148
void GeolocationPositionCache::triggerReadFromDatabase()
130
{
149
{
131
    m_queue.append(createCallbackTask(&GeolocationPositionCache::readFromDatabase, this));
150
    m_queue.append(CacheReadTask::create(this));
132
}
133
134
void GeolocationPositionCache::readFromDatabase(ScriptExecutionContext*, GeolocationPositionCache* cache)
135
{
136
    cache->readFromDatabaseImpl();
137
}
151
}
138
152
139
void GeolocationPositionCache::readFromDatabaseImpl()
153
void GeolocationPositionCache::readFromDatabase()
140
{
154
{
141
    SQLiteDatabase database;
155
    SQLiteDatabase database;
142
    {
156
    {
Lines 187-201 void GeolocationPositionCache::readFromD WebCore/page/GeolocationPositionCache.cpp_sec4
187
201
188
void GeolocationPositionCache::triggerWriteToDatabase()
202
void GeolocationPositionCache::triggerWriteToDatabase()
189
{
203
{
190
    m_queue.append(createCallbackTask(writeToDatabase, this));
204
    m_queue.append(CacheWriteTask::create(this));
191
}
192
193
void GeolocationPositionCache::writeToDatabase(ScriptExecutionContext*, GeolocationPositionCache* cache)
194
{
195
    cache->writeToDatabaseImpl();
196
}
205
}
197
206
198
void GeolocationPositionCache::writeToDatabaseImpl()
207
void GeolocationPositionCache::writeToDatabase()
199
{
208
{
200
    SQLiteDatabase database;
209
    SQLiteDatabase database;
201
    {
210
    {
- WebCore/page/GeolocationPositionCache.h -7 / +8 lines
Lines 27-41 WebCore/page/GeolocationPositionCache.h_sec1
27
#define GeolocationPositionCache_h
27
#define GeolocationPositionCache_h
28
28
29
#include "PlatformString.h"
29
#include "PlatformString.h"
30
#include "ScriptExecutionContext.h"
31
30
32
#include <wtf/Forward.h>
31
#include <wtf/Forward.h>
33
#include <wtf/MessageQueue.h>
32
#include <wtf/MessageQueue.h>
34
#include <wtf/PassRefPtr.h>
35
#include <wtf/RefPtr.h>
33
#include <wtf/RefPtr.h>
34
#include <wtf/Task.h>
36
35
37
namespace WebCore {
36
namespace WebCore {
38
37
38
class CacheReadTask;
39
class CacheWriteTask;
39
class Geoposition;
40
class Geoposition;
40
41
41
// Maintains a cached position for Geolocation. Takes care of writing and
42
// Maintains a cached position for Geolocation. Takes care of writing and
Lines 43-48 class Geoposition; WebCore/page/GeolocationPositionCache.h_sec2
43
// spec does not require a cached position to be maintained, so we take a
44
// spec does not require a cached position to be maintained, so we take a
44
// best-effort approach where we do not wait for database reads or writes.
45
// best-effort approach where we do not wait for database reads or writes.
45
class GeolocationPositionCache {
46
class GeolocationPositionCache {
47
    friend class CacheReadTask;
48
    friend class CacheWriteTask;
46
public:
49
public:
47
    static GeolocationPositionCache* instance();
50
    static GeolocationPositionCache* instance();
48
51
Lines 61-76 private: WebCore/page/GeolocationPositionCache.h_sec3
61
    void threadEntryPointImpl();
64
    void threadEntryPointImpl();
62
65
63
    void triggerReadFromDatabase();
66
    void triggerReadFromDatabase();
64
    static void readFromDatabase(ScriptExecutionContext*, GeolocationPositionCache*);
67
    void readFromDatabase();
65
    void readFromDatabaseImpl();
66
    void triggerWriteToDatabase();
68
    void triggerWriteToDatabase();
67
    static void writeToDatabase(ScriptExecutionContext*, GeolocationPositionCache*);
69
    void writeToDatabase();
68
    void writeToDatabaseImpl();
69
70
70
    RefPtr<Geoposition> m_cachedPosition;
71
    RefPtr<Geoposition> m_cachedPosition;
71
    Mutex m_cachedPositionMutex;
72
    Mutex m_cachedPositionMutex;
72
    ThreadIdentifier m_threadId;
73
    ThreadIdentifier m_threadId;
73
    MessageQueue<ScriptExecutionContext::Task> m_queue;
74
    MessageQueue<Task> m_queue;
74
    String m_databaseFile;
75
    String m_databaseFile;
75
    Mutex m_databaseFileMutex;
76
    Mutex m_databaseFileMutex;
76
};
77
};
- WebCore/storage/DatabaseTask.h -2 / +3 lines
Lines 36-41 WebCore/storage/DatabaseTask.h_sec1
36
#include <wtf/OwnPtr.h>
36
#include <wtf/OwnPtr.h>
37
#include <wtf/PassOwnPtr.h>
37
#include <wtf/PassOwnPtr.h>
38
#include <wtf/PassRefPtr.h>
38
#include <wtf/PassRefPtr.h>
39
#include <wtf/Task.h>
39
#include <wtf/Threading.h>
40
#include <wtf/Threading.h>
40
#include <wtf/Vector.h>
41
#include <wtf/Vector.h>
41
42
Lines 67-77 private: WebCore/storage/DatabaseTask.h_sec2
67
#endif
68
#endif
68
};
69
};
69
70
70
class DatabaseTask : public Noncopyable {
71
class DatabaseTask : public Task {
71
public:
72
public:
72
    virtual ~DatabaseTask();
73
    virtual ~DatabaseTask();
73
74
74
    void performTask();
75
    virtual void performTask();
75
76
76
    Database* database() const { return m_database; }
77
    Database* database() const { return m_database; }
77
#ifndef NDEBUG
78
#ifndef NDEBUG
- WebCore/storage/LocalStorageTask.cpp -4 lines
Lines 51-60 LocalStorageTask::LocalStorageTask(Type WebCore/storage/LocalStorageTask.cpp_sec1
51
    ASSERT(m_type == TerminateThread);
51
    ASSERT(m_type == TerminateThread);
52
}
52
}
53
53
54
LocalStorageTask::~LocalStorageTask()
55
{
56
}
57
58
void LocalStorageTask::performTask()
54
void LocalStorageTask::performTask()
59
{
55
{
60
    switch (m_type) {
56
    switch (m_type) {
- WebCore/storage/LocalStorageTask.h -4 / +3 lines
Lines 29-34 WebCore/storage/LocalStorageTask.h_sec1
29
#if ENABLE(DOM_STORAGE)
29
#if ENABLE(DOM_STORAGE)
30
30
31
#include <wtf/PassOwnPtr.h>
31
#include <wtf/PassOwnPtr.h>
32
#include <wtf/Task.h>
32
#include <wtf/Threading.h>
33
#include <wtf/Threading.h>
33
34
34
namespace WebCore {
35
namespace WebCore {
Lines 37-54 namespace WebCore { WebCore/storage/LocalStorageTask.h_sec2
37
    class LocalStorageThread;
38
    class LocalStorageThread;
38
39
39
    // FIXME: Rename this class to StorageTask
40
    // FIXME: Rename this class to StorageTask
40
    class LocalStorageTask : public Noncopyable {
41
    class LocalStorageTask : public Task {
41
    public:
42
    public:
42
        enum Type { AreaImport, AreaSync, DeleteEmptyDatabase, TerminateThread };
43
        enum Type { AreaImport, AreaSync, DeleteEmptyDatabase, TerminateThread };
43
44
44
        ~LocalStorageTask();
45
46
        static PassOwnPtr<LocalStorageTask> createImport(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(AreaImport, area)); }
45
        static PassOwnPtr<LocalStorageTask> createImport(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(AreaImport, area)); }
47
        static PassOwnPtr<LocalStorageTask> createSync(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(AreaSync, area)); }
46
        static PassOwnPtr<LocalStorageTask> createSync(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(AreaSync, area)); }
48
        static PassOwnPtr<LocalStorageTask> createDeleteEmptyDatabase(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(DeleteEmptyDatabase, area)); }
47
        static PassOwnPtr<LocalStorageTask> createDeleteEmptyDatabase(StorageAreaSync* area) { return adoptPtr(new LocalStorageTask(DeleteEmptyDatabase, area)); }
49
        static PassOwnPtr<LocalStorageTask> createTerminate(LocalStorageThread* thread) { return adoptPtr(new LocalStorageTask(TerminateThread, thread)); }
48
        static PassOwnPtr<LocalStorageTask> createTerminate(LocalStorageThread* thread) { return adoptPtr(new LocalStorageTask(TerminateThread, thread)); }
50
49
51
        void performTask();
50
        virtual void performTask();
52
51
53
    private:
52
    private:
54
        LocalStorageTask(Type, StorageAreaSync*);
53
        LocalStorageTask(Type, StorageAreaSync*);

Return to Bug 51818