Changeset 102894 in webkit
- Timestamp:
- Dec 14, 2011 10:51:20 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102886 r102894 1 2011-12-14 David Levin <levin@chromium.org> 2 3 [chromium] DatabaseObserver needs threadsafe fixes and other clean-up. 4 https://bugs.webkit.org/show_bug.cgi?id=74558 5 6 Reviewed by Dmitry Titov. 7 8 Added a test which would fail without some of these fixes. 9 10 * http/tests/workers/interrupt-database-sync-open-crash.html: Added. 11 * http/tests/workers/resources/open-database-sync.js: Added. 12 (onmessage): 13 1 14 2011-12-14 Kent Tamura <tkent@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/ChangeLog
r102891 r102894 1 2011-12-14 David Levin <levin@chromium.org> 2 3 [chromium] DatabaseObserver needs threadsafe fixes and other clean-up. 4 https://bugs.webkit.org/show_bug.cgi?id=74558 5 6 Reviewed by Dmitry Titov. 7 8 The important part of this fix is the removal of AllowCrossThreadAccess so 9 that ref counting happens appropriately. 10 11 Minor clean up throughout: Removed unnecessary WTF prefix in many 12 of these places and unnecessary String(). 13 14 * src/DatabaseObserver.cpp: 15 (WebKit::AllowDatabaseMainThreadBridge::create): 16 (WebKit::AllowDatabaseMainThreadBridge::signalCompleted): Get rid of 17 AllowCrossThreadAccess so that "this" get ref counted and remove mode from being 18 a member variable since a String in a ThreadSafeRefCounted class is bad. 19 (WebKit::AllowDatabaseMainThreadBridge::AllowDatabaseMainThreadBridge): Ditto. 20 (WebKit::AllowDatabaseMainThreadBridge::allowDatabaseTask): Pass through mode 21 and minor code cleaning to do only one call to signalCompleted. 22 (WebKit::allowDatabaseForWorker): Just removed unnecessary String()'s. 23 1 24 2011-12-14 Tony Chang <tony@chromium.org> 2 25 -
trunk/Source/WebKit/chromium/src/DatabaseObserver.cpp
r101492 r102894 65 65 class AllowDatabaseMainThreadBridge : public ThreadSafeRefCounted<AllowDatabaseMainThreadBridge> { 66 66 public: 67 static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)67 static PassRefPtr<AllowDatabaseMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) 68 68 { 69 69 return adoptRef(new AllowDatabaseMainThreadBridge(workerLoaderProxy, mode, commonClient, frame, name, displayName, estimatedSize)); … … 83 83 84 84 // This method is invoked on the main thread. 85 void signalCompleted( bool result)85 void signalCompleted(const String& mode, bool result) 86 86 { 87 87 MutexLocker locker(m_mutex); 88 if (m_workerLoaderProxy) 89 m_workerLoaderProxy->postTaskForModeToWorkerContext( 90 createCallbackTask(&didComplete, WebCore::AllowCrossThreadAccess(this), result), 91 m_mode); 88 if (!m_workerLoaderProxy) 89 return; 90 m_workerLoaderProxy->postTaskForModeToWorkerContext(createCallbackTask(&didComplete, this, result), mode); 92 91 } 93 92 94 93 private: 95 AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String& name, const WTF::String& displayName, unsigned long estimatedSize)94 AllowDatabaseMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String& name, const String& displayName, unsigned long estimatedSize) 96 95 : m_workerLoaderProxy(workerLoaderProxy) 97 , m_mode(mode)98 96 { 99 97 WebWorkerBase::dispatchTaskToMainThread( 100 createCallbackTask(&allowDatabaseTask, WebCore::AllowCrossThreadAccess(commonClient),98 createCallbackTask(&allowDatabaseTask, mode, WebCore::AllowCrossThreadAccess(commonClient), 101 99 WebCore::AllowCrossThreadAccess(frame), 102 String(name), String(displayName), estimatedSize, 103 WebCore::AllowCrossThreadAccess(this))); 104 } 105 106 static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const WTF::String name, const WTF::String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) 107 { 108 if (commonClient) 109 bridge->signalCompleted(commonClient->allowDatabase(frame, name, displayName, estimatedSize)); 110 else 111 bridge->signalCompleted(false); 100 name, displayName, estimatedSize, 101 this)); 102 } 103 104 static void allowDatabaseTask(WebCore::ScriptExecutionContext* context, const String mode, NewWebCommonWorkerClient* commonClient, WebFrame* frame, const String name, const String displayName, unsigned long estimatedSize, PassRefPtr<AllowDatabaseMainThreadBridge> bridge) 105 { 106 bool allowDatabase = commonClient ? commonClient->allowDatabase(frame, name, displayName, estimatedSize) : false; 107 bridge->signalCompleted(mode, allowDatabase); 112 108 } 113 109 … … 120 116 Mutex m_mutex; 121 117 WebCore::WorkerLoaderProxy* m_workerLoaderProxy; 122 WTF::String m_mode;123 118 }; 124 119 … … 135 130 mode.append(String::number(runLoop.createUniqueId())); 136 131 137 RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(workerLoaderProxy, mode, commonClient, frame, String(name), String(displayName), estimatedSize);132 RefPtr<AllowDatabaseMainThreadBridge> bridge = AllowDatabaseMainThreadBridge::create(workerLoaderProxy, mode, commonClient, frame, name, displayName, estimatedSize); 138 133 139 134 // Either the bridge returns, or the queue gets terminated.
Note: See TracChangeset
for help on using the changeset viewer.