Title: [103996] trunk/Source/WebKit/chromium
Revision
103996
Author
le...@chromium.org
Date
2012-01-03 18:25:56 -0800 (Tue, 03 Jan 2012)

Log Message

[chromium] LocalFileSystemChromium needs some thread safety fixes.
https://bugs.webkit.org/show_bug.cgi?id=75494

Reviewed by Dmitry Titov.

This is essentially the same fix as r102894 except in slightly different code.

The important part of this fix is the removal of AllowCrossThreadAccess so
that ref counting happens appropriately.

Minor clean up throughout: Removed unnecessary WTF prefix in many
of these places and unnecessary String().

* src/LocalFileSystemChromium.cpp: See r102894 since this
is basically the same thing.

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (103995 => 103996)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-01-04 01:45:00 UTC (rev 103995)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-01-04 02:25:56 UTC (rev 103996)
@@ -1,3 +1,21 @@
+2012-01-03  David Levin  <le...@chromium.org>
+
+        [chromium] LocalFileSystemChromium needs some thread safety fixes.
+        https://bugs.webkit.org/show_bug.cgi?id=75494
+
+        Reviewed by Dmitry Titov.
+
+        This is essentially the same fix as r102894 except in slightly different code.
+
+        The important part of this fix is the removal of AllowCrossThreadAccess so
+        that ref counting happens appropriately.
+
+        Minor clean up throughout: Removed unnecessary WTF prefix in many
+        of these places and unnecessary String().
+
+        * src/LocalFileSystemChromium.cpp: See r102894 since this
+        is basically the same thing.
+
 2012-01-03  Shawn Singh  <shawnsi...@chromium.org>
 
         [chromium] Push drawsContent and contentsVisible into accelerated compositor

Modified: trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp (103995 => 103996)


--- trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp	2012-01-04 01:45:00 UTC (rev 103995)
+++ trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp	2012-01-04 02:25:56 UTC (rev 103996)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2010, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -79,7 +79,7 @@
 // call back to the worker context.
 class AllowFileSystemMainThreadBridge : public ThreadSafeRefCounted<AllowFileSystemMainThreadBridge> {
 public:
-    static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient)
+    static PassRefPtr<AllowFileSystemMainThreadBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient)
     {
         return adoptRef(new AllowFileSystemMainThreadBridge(workerLoaderProxy, mode, commonClient));
     }
@@ -97,30 +97,26 @@
     }
 
     // This method is invoked on the main thread.
-    void signalCompleted(bool result)
+    void signalCompleted(const String& mode, bool result)
     {
         MutexLocker locker(m_mutex);
-        if (m_workerLoaderProxy)
-            m_workerLoaderProxy->postTaskForModeToWorkerContext(
-                createCallbackTask(&didComplete, AllowCrossThreadAccess(this), result), m_mode);
+        if (!m_workerLoaderProxy)
+            return;
+        m_workerLoaderProxy->postTaskForModeToWorkerContext(
+            createCallbackTask(&didComplete, AllowCrossThreadAccess(this), result), mode);
     }
 
 private:
-    AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const WTF::String& mode, WebCommonWorkerClient* commonClient)
+    AllowFileSystemMainThreadBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, const String& mode, WebCommonWorkerClient* commonClient)
         : m_workerLoaderProxy(workerLoaderProxy)
-        , m_mode(mode)
     {
-        WebWorkerBase::dispatchTaskToMainThread(
-            createCallbackTask(&allowFileSystemTask, AllowCrossThreadAccess(commonClient),
-                               AllowCrossThreadAccess(this)));
+        WebWorkerBase::dispatchTaskToMainThread(createCallbackTask(&allowFileSystemTask, mode, AllowCrossThreadAccess(commonClient), this));
     }
 
-    static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, WebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge)
+    static void allowFileSystemTask(WebCore::ScriptExecutionContext* context, const String& mode, WebCommonWorkerClient* commonClient, PassRefPtr<AllowFileSystemMainThreadBridge> bridge)
     {
-        if (commonClient)
-            bridge->signalCompleted(commonClient->allowFileSystem());
-        else
-            bridge->signalCompleted(false);
+        bool allowFileSystem = commonClient ? commonClient->allowFileSystem() : false;
+        bridge->signalCompleted(mode, allowFileSystem);
     }
 
     static void didComplete(WebCore::ScriptExecutionContext* context, PassRefPtr<AllowFileSystemMainThreadBridge> bridge, bool result)
@@ -131,7 +127,6 @@
     bool m_result;
     Mutex m_mutex;
     WebCore::WorkerLoaderProxy* m_workerLoaderProxy;
-    WTF::String m_mode;
 };
 
 bool allowFileSystemForWorker(WebCommonWorkerClient* commonClient)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to