diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 19:41:19 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 19:41:19 +0000 |
commit | 3c6de13983e12c3506fd53502fc92075b2595136 (patch) | |
tree | aa9581d47a7f6b52a0a0a385244fac55c52207b2 | |
parent | fb5d19ca93b1008e93f5b875cfd7fd96971a290c (diff) | |
download | chromium_src-3c6de13983e12c3506fd53502fc92075b2595136.zip chromium_src-3c6de13983e12c3506fd53502fc92075b2595136.tar.gz chromium_src-3c6de13983e12c3506fd53502fc92075b2595136.tar.bz2 |
Revert "move webkit/glue/webthread_impl* to webkit/child/"
Crashes in webkit_unit_tests, SameOriginRestriction on Linux:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004dcc5f in (anonymous namespace)::AssociatedURLLoaderTest::CheckFails (this=0x30c5b691b520, request=..., options=...)
at ../../third_party/WebKit/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp:223
223 Platform::current()->currentThread()->enterRunLoop();
(gdb) p Platform::current()
$1 = (WebKit::Platform *) 0x30c5b6023028
(gdb) p Platform::current()->currentThread()
$2 = (WebKit::WebThread *) 0x0
BUG=237249
TBR=scottmg
Review URL: https://codereview.chromium.org/17092006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206474 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/DEPS | 1 | ||||
-rw-r--r-- | content/browser/renderer_host/compositor_impl_android.cc | 7 | ||||
-rw-r--r-- | webkit/child/webkitplatformsupport_child_impl.cc | 32 | ||||
-rw-r--r-- | webkit/child/webkitplatformsupport_child_impl.h | 8 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 4 | ||||
-rw-r--r-- | webkit/glue/webkitplatformsupport_impl.cc | 31 | ||||
-rw-r--r-- | webkit/glue/webkitplatformsupport_impl.h | 5 | ||||
-rw-r--r-- | webkit/glue/webthread_impl.cc (renamed from webkit/child/webthread_impl.cc) | 2 | ||||
-rw-r--r-- | webkit/glue/webthread_impl.h (renamed from webkit/child/webthread_impl.h) | 18 | ||||
-rw-r--r-- | webkit/renderer/compositor_bindings/web_compositor_support_impl.cc | 2 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 2 |
11 files changed, 53 insertions, 59 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS index 87d470c..4bc3f3c 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -25,7 +25,6 @@ include_rules = [ "+chromeos", "+third_party/cros_system_api", - "-webkit/child", "-webkit/renderer", # DO NOT ADD ANY CHROME OR COMPONENTS INCLUDES HERE!!! diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index c5560e6..b475308 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -15,7 +15,6 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/synchronization/lock.h" -#include "base/threading/thread.h" #include "cc/base/thread_impl.h" #include "cc/input/input_handler.h" #include "cc/layers/layer.h" @@ -35,6 +34,7 @@ #include "third_party/khronos/GLES2/gl2ext.h" #include "ui/gfx/android/java_bitmap.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" +#include "webkit/glue/webthread_impl.h" namespace gfx { class JavaBitmap; @@ -57,7 +57,7 @@ class DirectOutputSurface : public cc::OutputSurface { }; static bool g_initialized = false; -static base::Thread* g_impl_thread = NULL; +static webkit_glue::WebThreadImpl* g_impl_thread = NULL; static bool g_use_direct_gl = false; } // anonymous namespace @@ -87,8 +87,7 @@ void Compositor::InitializeWithFlags(uint32 flags) { if (flags & ENABLE_COMPOSITOR_THREAD) { TRACE_EVENT_INSTANT0("test_gpu", "ThreadedCompositingInitialization", TRACE_EVENT_SCOPE_THREAD); - g_impl_thread = new base::Thread("Browser Compositor"); - g_impl_thread->Start(); + g_impl_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); } Compositor::Initialize(); } diff --git a/webkit/child/webkitplatformsupport_child_impl.cc b/webkit/child/webkitplatformsupport_child_impl.cc index 0e8d818..4e77cce 100644 --- a/webkit/child/webkitplatformsupport_child_impl.cc +++ b/webkit/child/webkitplatformsupport_child_impl.cc @@ -6,7 +6,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/child/fling_curve_configuration.h" -#include "webkit/child/webthread_impl.h" #include "webkit/child/worker_task_runner.h" #if defined(OS_ANDROID) @@ -16,8 +15,7 @@ namespace webkit_glue { WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() - : current_thread_slot_(&DestroyCurrentThread), - fling_curve_configuration_(new FlingCurveConfiguration) {} + : fling_curve_configuration_(new FlingCurveConfiguration) {} WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {} @@ -45,27 +43,6 @@ WebKitPlatformSupportChildImpl::createFlingAnimationCurve( cumulative_scroll); } -WebKit::WebThread* WebKitPlatformSupportChildImpl::createThread( - const char* name) { - return new WebThreadImpl(name); -} - -WebKit::WebThread* WebKitPlatformSupportChildImpl::currentThread() { - WebThreadImplForMessageLoop* thread = - static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); - if (thread) - return (thread); - - scoped_refptr<base::MessageLoopProxy> message_loop = - base::MessageLoopProxy::current(); - if (!message_loop.get()) - return NULL; - - thread = new WebThreadImplForMessageLoop(message_loop.get()); - current_thread_slot_.Set(thread); - return thread; -} - void WebKitPlatformSupportChildImpl::didStartWorkerRunLoop( const WebKit::WebWorkerRunLoop& runLoop) { WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); @@ -78,11 +55,4 @@ void WebKitPlatformSupportChildImpl::didStopWorkerRunLoop( worker_task_runner->OnWorkerRunLoopStopped(runLoop); } -// static -void WebKitPlatformSupportChildImpl::DestroyCurrentThread(void* thread) { - WebThreadImplForMessageLoop* impl = - static_cast<WebThreadImplForMessageLoop*>(thread); - delete impl; -} - } // namespace webkit_glue diff --git a/webkit/child/webkitplatformsupport_child_impl.h b/webkit/child/webkitplatformsupport_child_impl.h index 1b18ebd..3e6026d 100644 --- a/webkit/child/webkitplatformsupport_child_impl.h +++ b/webkit/child/webkitplatformsupport_child_impl.h @@ -5,7 +5,6 @@ #ifndef WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_ #define WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_ -#include "base/threading/thread_local_storage.h" #include "webkit/child/webkit_child_export.h" #include "webkit/glue/webkitplatformsupport_impl.h" @@ -28,18 +27,11 @@ class WEBKIT_CHILD_EXPORT WebKitPlatformSupportChildImpl : const WebKit::WebFloatPoint& velocity, const WebKit::WebSize& cumulative_scroll) OVERRIDE; - virtual WebKit::WebThread* createThread(const char* name); - virtual WebKit::WebThread* currentThread(); - virtual void didStartWorkerRunLoop( const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE; virtual void didStopWorkerRunLoop( const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE; - private: - static void DestroyCurrentThread(void*); - - base::ThreadLocalStorage::Slot current_thread_slot_; scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_; }; diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 1044d08..562beb1 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -87,8 +87,6 @@ '../child/webkit_child_export.h', '../child/webkitplatformsupport_child_impl.cc', '../child/webkitplatformsupport_child_impl.h', - '../child/webthread_impl.cc', - '../child/webthread_impl.h', '../child/worker_task_runner.cc', '../child/worker_task_runner.h', ], @@ -289,6 +287,8 @@ 'webthemeengine_impl_mac.h', 'webthemeengine_impl_win.cc', 'webthemeengine_impl_win.h', + 'webthread_impl.h', + 'webthread_impl.cc', 'weburlloader_impl.cc', 'weburlloader_impl.h', 'web_io_operators.cc', diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index e93b61e..91109de 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -48,6 +48,7 @@ #include "webkit/glue/web_discardable_memory_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/websocketstreamhandle_impl.h" +#include "webkit/glue/webthread_impl.h" #include "webkit/glue/weburlloader_impl.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/webplugininfo.h" @@ -364,7 +365,8 @@ WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() shared_timer_func_(NULL), shared_timer_fire_time_(0.0), shared_timer_fire_time_was_set_while_suspended_(false), - shared_timer_suspended_(0) {} + shared_timer_suspended_(0), + current_thread_slot_(&DestroyCurrentThread) {} WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { } @@ -817,6 +819,26 @@ void WebKitPlatformSupportImpl::callOnMainThread( main_loop_->PostTask(FROM_HERE, base::Bind(func, context)); } +WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) { + return new WebThreadImpl(name); +} + +WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() { + WebThreadImplForMessageLoop* thread = + static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); + if (thread) + return (thread); + + scoped_refptr<base::MessageLoopProxy> message_loop = + base::MessageLoopProxy::current(); + if (!message_loop.get()) + return NULL; + + thread = new WebThreadImplForMessageLoop(message_loop.get()); + current_thread_slot_.Set(thread); + return thread; +} + base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile( const WebKit::WebString& vfs_file_name, int desired_flags) { return base::kInvalidPlatformFileValue; @@ -931,6 +953,13 @@ void WebKitPlatformSupportImpl::ResumeSharedTimer() { } } +// static +void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) { + WebThreadImplForMessageLoop* impl = + static_cast<WebThreadImplForMessageLoop*>(thread); + delete impl; +} + WebKit::WebDiscardableMemory* WebKitPlatformSupportImpl::allocateAndLockDiscardableMemory(size_t bytes) { if (!base::DiscardableMemory::Supported()) diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h index a56c2b1..d7a64bc 100644 --- a/webkit/glue/webkitplatformsupport_impl.h +++ b/webkit/glue/webkitplatformsupport_impl.h @@ -8,6 +8,7 @@ #include "base/compiler_specific.h" #include "base/debug/trace_event.h" #include "base/platform_file.h" +#include "base/threading/thread_local_storage.h" #include "base/timer.h" #include "third_party/WebKit/public/platform/Platform.h" #include "third_party/WebKit/public/platform/WebURLError.h" @@ -125,6 +126,8 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : virtual void setSharedTimerFireInterval(double interval_seconds); virtual void stopSharedTimer(); virtual void callOnMainThread(void (*func)(void*), void* context); + virtual WebKit::WebThread* createThread(const char* name); + virtual WebKit::WebThread* currentThread(); virtual WebKit::WebDiscardableMemory* allocateAndLockDiscardableMemory( size_t bytes); @@ -165,6 +168,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : if (shared_timer_func_ && !shared_timer_suspended_) shared_timer_func_(); } + static void DestroyCurrentThread(void*); base::MessageLoop* main_loop_; base::OneShotTimer<WebKitPlatformSupportImpl> shared_timer_; @@ -174,6 +178,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : int shared_timer_suspended_; // counter WebThemeEngineImpl native_theme_engine_; WebFallbackThemeEngineImpl fallback_theme_engine_; + base::ThreadLocalStorage::Slot current_thread_slot_; }; } // namespace webkit_glue diff --git a/webkit/child/webthread_impl.cc b/webkit/glue/webthread_impl.cc index 52c2307..d008fa1 100644 --- a/webkit/child/webthread_impl.cc +++ b/webkit/glue/webthread_impl.cc @@ -5,7 +5,7 @@ // An implementation of WebThread in terms of base::MessageLoop and // base::Thread -#include "webkit/child/webthread_impl.h" +#include "webkit/glue/webthread_impl.h" #include "base/bind.h" #include "base/bind_helpers.h" diff --git a/webkit/child/webthread_impl.h b/webkit/glue/webthread_impl.h index 86c94a8..f71a582 100644 --- a/webkit/child/webthread_impl.h +++ b/webkit/glue/webthread_impl.h @@ -1,15 +1,15 @@ // Copyright (c) 2012 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. -#ifndef WEBKIT_CHILD_WEBTHREAD_IMPL_H_ -#define WEBKIT_CHILD_WEBTHREAD_IMPL_H_ +#ifndef WEBKIT_GLUE_WEBTHREAD_IMPL_H_ +#define WEBKIT_GLUE_WEBTHREAD_IMPL_H_ #include <map> -#include "base/memory/scoped_ptr.h" #include "base/threading/thread.h" +#include "base/memory/scoped_ptr.h" #include "third_party/WebKit/public/platform/WebThread.h" -#include "webkit/child/webkit_child_export.h" +#include "webkit/glue/webkit_glue_export.h" namespace webkit_glue { @@ -34,8 +34,8 @@ class WebThreadBase : public WebKit::WebThread { class WebThreadImpl : public WebThreadBase { public: - WEBKIT_CHILD_EXPORT explicit WebThreadImpl(const char* name); - WEBKIT_CHILD_EXPORT virtual ~WebThreadImpl(); + WEBKIT_GLUE_EXPORT explicit WebThreadImpl(const char* name); + WEBKIT_GLUE_EXPORT virtual ~WebThreadImpl(); virtual void postTask(Task* task); virtual void postDelayedTask(Task* task, long long delay_ms); @@ -52,9 +52,9 @@ class WebThreadImpl : public WebThreadBase { class WebThreadImplForMessageLoop : public WebThreadBase { public: - WEBKIT_CHILD_EXPORT explicit WebThreadImplForMessageLoop( + WEBKIT_GLUE_EXPORT explicit WebThreadImplForMessageLoop( base::MessageLoopProxy* message_loop); - WEBKIT_CHILD_EXPORT virtual ~WebThreadImplForMessageLoop(); + WEBKIT_GLUE_EXPORT virtual ~WebThreadImplForMessageLoop(); virtual void postTask(Task* task); virtual void postDelayedTask(Task* task, long long delay_ms); @@ -69,4 +69,4 @@ class WebThreadImplForMessageLoop : public WebThreadBase { } // namespace webkit_glue -#endif // WEBKIT_CHILD_WEBTHREAD_IMPL_H_ +#endif diff --git a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc index f27d86a..d8a4fb6 100644 --- a/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc +++ b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc @@ -10,7 +10,7 @@ #include "cc/base/thread_impl.h" #include "cc/output/output_surface.h" #include "cc/output/software_output_device.h" -#include "webkit/child/webthread_impl.h" +#include "webkit/glue/webthread_impl.h" #include "webkit/renderer/compositor_bindings/web_animation_impl.h" #include "webkit/renderer/compositor_bindings/web_content_layer_impl.h" #include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 4fc73c1..3f16aed 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -52,13 +52,13 @@ #include "ui/gl/gl_surface.h" #include "webkit/base/file_path_string_conversions.h" #include "webkit/browser/fileapi/isolated_context.h" -#include "webkit/child/webthread_impl.h" #include "webkit/common/gpu/test_context_provider_factory.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" #include "webkit/common/user_agent/user_agent.h" #include "webkit/common/user_agent/user_agent_util.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitplatformsupport_impl.h" +#include "webkit/glue/webthread_impl.h" #include "webkit/glue/weburlrequest_extradata_impl.h" #include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/webplugin_impl.h" |