summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-09 22:16:22 +0000
committerdglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-09 22:16:22 +0000
commit6aaed0ca1a04edac5bedb7bbd0cf620ae9acb037 (patch)
tree8c81b7b6a86f01413518192d325246f6ee3ed37b
parent91ecf06406432962102086445cdf9fe30d5acacb (diff)
downloadchromium_src-6aaed0ca1a04edac5bedb7bbd0cf620ae9acb037.zip
chromium_src-6aaed0ca1a04edac5bedb7bbd0cf620ae9acb037.tar.gz
chromium_src-6aaed0ca1a04edac5bedb7bbd0cf620ae9acb037.tar.bz2
Add Threading Support based on Chromium's MessageLoop, Chromium side.R=darin,brettw
Review URL: http://codereview.chromium.org/19725 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9426 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--webkit/build/JavaScriptCore/SConscript8
-rw-r--r--webkit/build/JavaScriptCore/WTF.vcproj16
-rw-r--r--webkit/build/V8Bindings/V8Bindings.vcproj4
-rw-r--r--webkit/glue/SConscript1
-rw-r--r--webkit/glue/chromium_threading.cc27
-rw-r--r--webkit/glue/glue.vcproj4
-rw-r--r--webkit/port/bindings/v8/Threading.cpp96
-rw-r--r--webkit/webkit.xcodeproj/project.pbxproj31
9 files changed, 70 insertions, 119 deletions
diff --git a/DEPS b/DEPS
index 837156f..f64c050 100644
--- a/DEPS
+++ b/DEPS
@@ -19,7 +19,7 @@ deps = {
"http://googletest.googlecode.com/svn/trunk@167",
"src/third_party/WebKit":
- "/trunk/deps/third_party/WebKit@9391",
+ "/trunk/deps/third_party/WebKit@9423",
"src/third_party/icu38":
"/trunk/deps/third_party/icu38@9252",
diff --git a/webkit/build/JavaScriptCore/SConscript b/webkit/build/JavaScriptCore/SConscript
index d0d0540..8d810f8 100644
--- a/webkit/build/JavaScriptCore/SConscript
+++ b/webkit/build/JavaScriptCore/SConscript
@@ -148,6 +148,7 @@ if env.Bit('windows'):
wtf_inputs = [
'$WTF_DIR/ByteArray.cpp',
'$WTF_DIR/Assertions.cpp',
+ '$WTF_DIR/chromium/MainThreadChromium.cpp',
'$WTF_DIR/CurrentTime.cpp',
'$WTF_DIR/dtoa.cpp',
'$WTF_DIR/FastMalloc.cpp',
@@ -155,6 +156,8 @@ wtf_inputs = [
'$WTF_DIR/MainThread.cpp',
'$WTF_DIR/RandomNumber.cpp',
'$WTF_DIR/RefCountedLeakCounter.cpp',
+ '$WTF_DIR/Threading.cpp',
+ '$WTF_DIR/ThreadingPthreads.cpp',
'$WTF_DIR/TCSystemAlloc.cpp',
'$WTF_DIR/chromium/MainThreadChromium.cpp',
'$WTF_DIR/unicode/UTF8.cpp',
@@ -167,11 +170,6 @@ if env.Bit('windows'):
'$WTF_DIR/ThreadSpecificWin.cpp',
])
elif env.Bit('linux'):
- wtf_inputs.extend([
- '$WTF_DIR/gtk/MainThreadGtk.cpp',
- '$WTF_DIR/ThreadingPthreads.cpp',
- ])
-
# Re-add the include path for glib.h because it got lost when cloning the
# environment.
env.ParseConfig('pkg-config --cflags --libs glib-2.0')
diff --git a/webkit/build/JavaScriptCore/WTF.vcproj b/webkit/build/JavaScriptCore/WTF.vcproj
index 9bed692..be75e21 100644
--- a/webkit/build/JavaScriptCore/WTF.vcproj
+++ b/webkit/build/JavaScriptCore/WTF.vcproj
@@ -121,6 +121,18 @@
<References>
</References>
<Files>
+ <Filter
+ Name="chromium"
+ >
+ <File
+ RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\chromium\ChromiumThreading.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\chromium\MainThreadChromium.cpp"
+ >
+ </File>
+ </Filter>
<File
RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\AlwaysInline.h"
>
@@ -334,6 +346,10 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\Threading.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\JavaScriptCore\wtf\Threading.h"
>
</File>
diff --git a/webkit/build/V8Bindings/V8Bindings.vcproj b/webkit/build/V8Bindings/V8Bindings.vcproj
index 6a72200..c361d64 100644
--- a/webkit/build/V8Bindings/V8Bindings.vcproj
+++ b/webkit/build/V8Bindings/V8Bindings.vcproj
@@ -2629,10 +2629,6 @@
>
</File>
<File
- RelativePath="..\..\port\bindings\v8\Threading.cpp"
- >
- </File>
- <File
RelativePath="..\..\port\bindings\v8\v8_binding.h"
>
</File>
diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript
index e9e818a..50f1c6f 100644
--- a/webkit/glue/SConscript
+++ b/webkit/glue/SConscript
@@ -31,6 +31,7 @@ input_files = [
'cache_manager.cc',
'chrome_client_impl.cc',
'chromium_bridge_impl.cc',
+ 'chromium_threading.cc',
'clipboard_conversion.cc',
'context_menu_client_impl.cc',
'cpp_binding_example.cc',
diff --git a/webkit/glue/chromium_threading.cc b/webkit/glue/chromium_threading.cc
new file mode 100644
index 0000000..7484e5e9
--- /dev/null
+++ b/webkit/glue/chromium_threading.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+#include "config.h"
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+#include <wtf/chromium/ChromiumThreading.h>
+
+#undef LOG
+#include "base/message_loop.h"
+
+namespace WTF {
+
+static MessageLoop* main_thread = NULL;
+
+void ChromiumThreading::initializeMainThread() {
+ main_thread = MessageLoop::current();
+}
+
+void ChromiumThreading::scheduleDispatchFunctionsOnMainThread() {
+ ASSERT(main_thread);
+ main_thread->PostTask(FROM_HERE,
+ NewRunnableFunction(&WTF::dispatchFunctionsFromMainThread));
+}
+
+} // namespace WTF
diff --git a/webkit/glue/glue.vcproj b/webkit/glue/glue.vcproj
index 8baa129..acaad6f 100644
--- a/webkit/glue/glue.vcproj
+++ b/webkit/glue/glue.vcproj
@@ -305,6 +305,10 @@
>
</File>
<File
+ RelativePath=".\chromium_threading.cc"
+ >
+ </File>
+ <File
RelativePath=".\clipboard_conversion.cc"
>
</File>
diff --git a/webkit/port/bindings/v8/Threading.cpp b/webkit/port/bindings/v8/Threading.cpp
deleted file mode 100644
index f005c76..0000000
--- a/webkit/port/bindings/v8/Threading.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2009, 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
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "config.h"
-
-#include "Threading.h"
-#undef LOG
-
-#include "base/message_loop.h"
-#include "base/task.h"
-
-namespace WTF {
-
-struct NewThreadContext {
- NewThreadContext(ThreadFunction entryPoint, void* data, const char* name)
- : entryPoint(entryPoint)
- , data(data)
- , name(name)
- { }
-
- ThreadFunction entryPoint;
- void* data;
- std::string name;
-
- Mutex creationMutex;
-};
-
-static void* threadEntryPoint(void* contextData)
-{
- NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData);
-
- // Block until our creating thread has completed any extra setup work
- {
- MutexLocker locker(context->creationMutex);
- }
-
- // Run via Chrome's message loop
- MessageLoop message_loop;
- message_loop.set_thread_name(context->name);
- message_loop.PostTask(FROM_HERE,
- NewRunnableFunction(context->entryPoint, context->data));
- message_loop.Run();
-
- delete context;
-
- return NULL;
-}
-
-ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* name)
-{
- NewThreadContext* context = new NewThreadContext(entryPoint, data, name);
-
- // Prevent the thread body from executing until we've established the thread identifier
- MutexLocker locker(context->creationMutex);
-
- return createThreadInternal(threadEntryPoint, context, name);
-}
-
-#if PLATFORM(MAC) || PLATFORM(WIN)
-
-// This function is deprecated but needs to be kept around for backward
-// compatibility. Use the 3-argument version of createThread above.
-
-ThreadIdentifier createThread(ThreadFunction entryPoint, void* data)
-{
- return createThread(entryPoint, data, 0);
-}
-#endif
-
-} // namespace WTF
diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj
index 4588d62..e011588 100644
--- a/webkit/webkit.xcodeproj/project.pbxproj
+++ b/webkit/webkit.xcodeproj/project.pbxproj
@@ -46,6 +46,8 @@
4112E7060EFB0A26001E0E7A /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4112E7050EFB0A26001E0E7A /* RandomNumber.cpp */; };
41807C570F268375007BB4CC /* ByteArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41807C550F268375007BB4CC /* ByteArray.cpp */; };
419E80750F264BBC006564E0 /* CSSPropertyLonghand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419E80730F264BBC006564E0 /* CSSPropertyLonghand.cpp */; };
+ 41DE6EBC0F3A328C0049BC24 /* MainThreadChromium.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DE6EBB0F3A328C0049BC24 /* MainThreadChromium.cpp */; };
+ 41DE6EBF0F3A32EE0049BC24 /* chromium_threading.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41DE6EBE0F3A32EE0049BC24 /* chromium_threading.cc */; };
41DE748C0F3CDBCB0049BC24 /* V8SVGElementInstanceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DE74890F3CDBCB0049BC24 /* V8SVGElementInstanceCustom.cpp */; };
41DE748D0F3CDBCB0049BC24 /* V8SVGLengthCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DE748A0F3CDBCB0049BC24 /* V8SVGLengthCustom.cpp */; };
41DE748E0F3CDBCB0049BC24 /* V8SVGMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DE748B0F3CDBCB0049BC24 /* V8SVGMatrixCustom.cpp */; };
@@ -57,7 +59,6 @@
4DB043A40EB1577900A5633C /* webcursor.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825405300D92E3DA0006B936 /* webcursor.cc */; };
4DB7F5290E9BD3FB00C66CE0 /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DB7F5210E9BD3FB00C66CE0 /* MainThread.cpp */; };
4DB7F52A0E9BD3FB00C66CE0 /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DB7F5270E9BD3FB00C66CE0 /* ThreadingPthreads.cpp */; };
- 4DB7F5420E9BD50600C66CE0 /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4DB7F5410E9BD50600C66CE0 /* MainThreadMac.mm */; };
4DB7F55D0E9BD66300C66CE0 /* V8XMLHttpRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DB7F55B0E9BD66300C66CE0 /* V8XMLHttpRequestCustom.cpp */; };
4DB7FE770E9BF6D800C66CE0 /* WebSystemInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DB7FE6A0E9BF69A00C66CE0 /* WebSystemInterface.m */; };
4DFEF7850F3B818C00F73D51 /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D1640E20EC29BB4008F024E /* PrintContext.cpp */; };
@@ -1558,6 +1559,9 @@
41A365600F01AB3800778012 /* InspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorController.h; sourceTree = "<group>"; };
41AF32C40EE5E6ED00BF6361 /* ScriptInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptInstance.cpp; sourceTree = "<group>"; };
41AF32C50EE5E6ED00BF6361 /* ScriptInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptInstance.h; sourceTree = "<group>"; };
+ 41DE6EBB0F3A328C0049BC24 /* MainThreadChromium.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThreadChromium.cpp; sourceTree = "<group>"; };
+ 41DE6EBD0F3A329F0049BC24 /* ChromiumThreading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChromiumThreading.h; sourceTree = "<group>"; };
+ 41DE6EBE0F3A32EE0049BC24 /* chromium_threading.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chromium_threading.cc; sourceTree = "<group>"; };
41DE74870F3CDBCB0049BC24 /* V8CustomBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V8CustomBinding.h; sourceTree = "<group>"; };
41DE74880F3CDBCB0049BC24 /* V8CustomEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V8CustomEventListener.h; sourceTree = "<group>"; };
41DE74890F3CDBCB0049BC24 /* V8SVGElementInstanceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8SVGElementInstanceCustom.cpp; sourceTree = "<group>"; };
@@ -1820,7 +1824,6 @@
4DB7F5260E9BD3FB00C66CE0 /* Threading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Threading.h; sourceTree = "<group>"; };
4DB7F5270E9BD3FB00C66CE0 /* ThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadingPthreads.cpp; sourceTree = "<group>"; };
4DB7F5280E9BD3FB00C66CE0 /* ThreadSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSpecific.h; sourceTree = "<group>"; };
- 4DB7F5410E9BD50600C66CE0 /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
4DB7F5590E9BD66300C66CE0 /* v8_collection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8_collection.h; sourceTree = "<group>"; };
4DB7F55A0E9BD66300C66CE0 /* V8SVGPODTypeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V8SVGPODTypeWrapper.h; sourceTree = "<group>"; };
4DB7F55B0E9BD66300C66CE0 /* V8XMLHttpRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8XMLHttpRequestCustom.cpp; sourceTree = "<group>"; };
@@ -4497,6 +4500,14 @@
path = inspector;
sourceTree = "<group>";
};
+ 41DE6EBA0F3A32790049BC24 /* chromium */ = {
+ isa = PBXGroup;
+ children = (
+ 41DE6EBB0F3A328C0049BC24 /* MainThreadChromium.cpp */,
+ );
+ path = chromium;
+ sourceTree = "<group>";
+ };
41DE74830F3CDAAE0049BC24 /* custom */ = {
isa = PBXGroup;
children = (
@@ -4605,14 +4616,6 @@
path = animation;
sourceTree = "<group>";
};
- 4DB7F5400E9BD4ED00C66CE0 /* mac */ = {
- isa = PBXGroup;
- children = (
- 4DB7F5410E9BD50600C66CE0 /* MainThreadMac.mm */,
- );
- path = mac;
- sourceTree = "<group>";
- };
4DB7FE680E9BF67000C66CE0 /* webcoresysteminterface */ = {
isa = PBXGroup;
children = (
@@ -4735,7 +4738,7 @@
7B5E85B30D7F28F5001ECF42 /* wtf */ = {
isa = PBXGroup;
children = (
- 4DB7F5400E9BD4ED00C66CE0 /* mac */,
+ 41DE6EBA0F3A32790049BC24 /* chromium */,
7B5E85DA0D7F28F5001ECF42 /* unicode */,
7B5E85B40D7F28F5001ECF42 /* AlwaysInline.h */,
7B5E85B50D7F28F5001ECF42 /* ASCIICType.h */,
@@ -4744,6 +4747,7 @@
4DB7F51F0E9BD3FB00C66CE0 /* AVLTree.h */,
41807C550F268375007BB4CC /* ByteArray.cpp */,
41807C560F268375007BB4CC /* ByteArray.h */,
+ 41DE6EBD0F3A329F0049BC24 /* ChromiumThreading.h */,
CCBDDEF91A55ACE86471036E /* CurrentTime.cpp */,
20EF92D9CD4E55999674A63E /* CurrentTime.h */,
7B5E85B80D7F28F5001ECF42 /* Deque.h */,
@@ -7552,6 +7556,7 @@
825404F10D92E3DA0006B936 /* chrome_client_impl.cc */,
825404F20D92E3DA0006B936 /* chrome_client_impl.h */,
934CC0030EBFE0E000A658F2 /* chromium_bridge_impl.cc */,
+ 41DE6EBE0F3A32EE0049BC24 /* chromium_threading.cc */,
535EE0BE0EC4D10E00939D54 /* clipboard_conversion.cc */,
535EE0BF0EC4D10E00939D54 /* clipboard_conversion.h */,
825404F30D92E3DA0006B936 /* context_menu_client_impl.cc */,
@@ -8241,8 +8246,7 @@
7B5E862C0D7F2B56001ECF42 /* FastMalloc.cpp in Sources */,
7B5E85F40D7F28F5001ECF42 /* HashTable.cpp in Sources */,
4DB7F5290E9BD3FB00C66CE0 /* MainThread.cpp in Sources */,
- 926BA16FA5646FDB1353DBD1 /* MainThreadChromium.cpp in Sources */,
- 4DB7F5420E9BD50600C66CE0 /* MainThreadMac.mm in Sources */,
+ 41DE6EBC0F3A328C0049BC24 /* MainThreadChromium.cpp in Sources */,
4112E7060EFB0A26001E0E7A /* RandomNumber.cpp in Sources */,
E40054A70E9BC4C20055B38E /* RefCountedLeakCounter.cpp in Sources */,
7B5E86090D7F28F5001ECF42 /* TCSystemAlloc.cpp in Sources */,
@@ -9498,6 +9502,7 @@
938180500EF3394A00993F02 /* back_forward_list_client_impl.cc in Sources */,
E456270D0E268F03005E4685 /* chrome_client_impl.cc in Sources */,
934CC0040EBFE0E000A658F2 /* chromium_bridge_impl.cc in Sources */,
+ 41DE6EBF0F3A32EE0049BC24 /* chromium_threading.cc in Sources */,
535EE0C00EC4D10E00939D54 /* clipboard_conversion.cc in Sources */,
E45626FD0E268F03005E4685 /* context_menu_client_impl.cc in Sources */,
E4506C170EF03AB5003BE099 /* cpp_binding_example.cc in Sources */,