summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-15 15:25:14 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-15 15:25:14 +0000
commit14b2f170f2fc92c201c93f2e497adce4552fb2cf (patch)
tree9aa1440ee41ffa80fc3e958977510130473618fd
parentbe170f2f3eeb020184c06256bab60eb8f1f39f71 (diff)
downloadchromium_src-14b2f170f2fc92c201c93f2e497adce4552fb2cf.zip
chromium_src-14b2f170f2fc92c201c93f2e497adce4552fb2cf.tar.gz
chromium_src-14b2f170f2fc92c201c93f2e497adce4552fb2cf.tar.bz2
reland of https://codereview.chromium.org/16864002
move webkit/glue/webthread_impl* to webkit/child/ Diff from previously landed: diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h index 5059031..a822a3d 100644 --- a/webkit/support/test_webkit_platform_support.h +++ b/webkit/support/test_webkit_platform_support.h @@ -9,8 +9,8 @@ #include "third_party/WebKit/public/platform/WebGamepads.h" #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" +#include "webkit/child/webkitplatformsupport_child_impl.h" #include "webkit/glue/webfileutilities_impl.h" -#include "webkit/glue/webkitplatformsupport_impl.h" #include "webkit/mocks/mock_webhyphenator.h" #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" #include "webkit/support/mock_webclipboard_impl.h" @@ -37,7 +37,7 @@ class WebLayerTreeView; // An implementation of WebKitPlatformSupport for tests. class TestWebKitPlatformSupport : public WebKit::WebUnitTestSupport, - public webkit_glue::WebKitPlatformSupportImpl { + public webkit_glue::WebKitPlatformSupportChildImpl { public: TestWebKitPlatformSupport(bool unit_test_mode, WebKit::Platform* shadow_platform_delegate); diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index 2634962..026e6d8 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -33,6 +33,7 @@ '<(DEPTH)/webkit/storage_common.gyp:webkit_storage_common', '<(DEPTH)/webkit/storage_renderer.gyp:webkit_storage_renderer', 'glue', + 'glue_child', 'glue_common', 'plugins', 'webkit_common', TBR=jamesr@chromium.org BUG=237249,239107 Review URL: https://chromiumcodereview.appspot.com/17072006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206591 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/DEPS1
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc7
-rw-r--r--webkit/child/webkitplatformsupport_child_impl.cc32
-rw-r--r--webkit/child/webkitplatformsupport_child_impl.h8
-rw-r--r--webkit/child/webthread_impl.cc (renamed from webkit/glue/webthread_impl.cc)4
-rw-r--r--webkit/child/webthread_impl.h (renamed from webkit/glue/webthread_impl.h)20
-rw-r--r--webkit/glue/webkit_glue.gypi4
-rw-r--r--webkit/glue/webkitplatformsupport_impl.cc31
-rw-r--r--webkit/glue/webkitplatformsupport_impl.h5
-rw-r--r--webkit/renderer/compositor_bindings/web_compositor_support_impl.cc2
-rw-r--r--webkit/support/test_webkit_platform_support.h4
-rw-r--r--webkit/support/webkit_support.cc2
-rw-r--r--webkit/support/webkit_support.gypi1
13 files changed, 64 insertions, 57 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 4bc3f3c..87d470c 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -25,6 +25,7 @@ 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 b475308..c5560e6 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -15,6 +15,7 @@
#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"
@@ -34,7 +35,6 @@
#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 webkit_glue::WebThreadImpl* g_impl_thread = NULL;
+static base::Thread* g_impl_thread = NULL;
static bool g_use_direct_gl = false;
} // anonymous namespace
@@ -87,7 +87,8 @@ void Compositor::InitializeWithFlags(uint32 flags) {
if (flags & ENABLE_COMPOSITOR_THREAD) {
TRACE_EVENT_INSTANT0("test_gpu", "ThreadedCompositingInitialization",
TRACE_EVENT_SCOPE_THREAD);
- g_impl_thread = new webkit_glue::WebThreadImpl("Browser Compositor");
+ g_impl_thread = new base::Thread("Browser Compositor");
+ g_impl_thread->Start();
}
Compositor::Initialize();
}
diff --git a/webkit/child/webkitplatformsupport_child_impl.cc b/webkit/child/webkitplatformsupport_child_impl.cc
index 4e77cce..0e8d818 100644
--- a/webkit/child/webkitplatformsupport_child_impl.cc
+++ b/webkit/child/webkitplatformsupport_child_impl.cc
@@ -6,6 +6,7 @@
#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)
@@ -15,7 +16,8 @@
namespace webkit_glue {
WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl()
- : fling_curve_configuration_(new FlingCurveConfiguration) {}
+ : current_thread_slot_(&DestroyCurrentThread),
+ fling_curve_configuration_(new FlingCurveConfiguration) {}
WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {}
@@ -43,6 +45,27 @@ 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();
@@ -55,4 +78,11 @@ 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 3e6026d..1b18ebd 100644
--- a/webkit/child/webkitplatformsupport_child_impl.h
+++ b/webkit/child/webkitplatformsupport_child_impl.h
@@ -5,6 +5,7 @@
#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"
@@ -27,11 +28,18 @@ 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/webthread_impl.cc b/webkit/child/webthread_impl.cc
index d008fa1..fc26284 100644
--- a/webkit/glue/webthread_impl.cc
+++ b/webkit/child/webthread_impl.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
// An implementation of WebThread in terms of base::MessageLoop and
// base::Thread
-#include "webkit/glue/webthread_impl.h"
+#include "webkit/child/webthread_impl.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
diff --git a/webkit/glue/webthread_impl.h b/webkit/child/webthread_impl.h
index f71a582..88181c5 100644
--- a/webkit/glue/webthread_impl.h
+++ b/webkit/child/webthread_impl.h
@@ -1,15 +1,15 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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_GLUE_WEBTHREAD_IMPL_H_
-#define WEBKIT_GLUE_WEBTHREAD_IMPL_H_
+#ifndef WEBKIT_CHILD_WEBTHREAD_IMPL_H_
+#define WEBKIT_CHILD_WEBTHREAD_IMPL_H_
#include <map>
-#include "base/threading/thread.h"
#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread.h"
#include "third_party/WebKit/public/platform/WebThread.h"
-#include "webkit/glue/webkit_glue_export.h"
+#include "webkit/child/webkit_child_export.h"
namespace webkit_glue {
@@ -34,8 +34,8 @@ class WebThreadBase : public WebKit::WebThread {
class WebThreadImpl : public WebThreadBase {
public:
- WEBKIT_GLUE_EXPORT explicit WebThreadImpl(const char* name);
- WEBKIT_GLUE_EXPORT virtual ~WebThreadImpl();
+ WEBKIT_CHILD_EXPORT explicit WebThreadImpl(const char* name);
+ WEBKIT_CHILD_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_GLUE_EXPORT explicit WebThreadImplForMessageLoop(
+ WEBKIT_CHILD_EXPORT explicit WebThreadImplForMessageLoop(
base::MessageLoopProxy* message_loop);
- WEBKIT_GLUE_EXPORT virtual ~WebThreadImplForMessageLoop();
+ WEBKIT_CHILD_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
+#endif // WEBKIT_CHILD_WEBTHREAD_IMPL_H_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 47ed5a1..f551885 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -87,6 +87,8 @@
'../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',
],
@@ -287,8 +289,6 @@
'webthemeengine_impl_mac.h',
'webthemeengine_impl_win.cc',
'webthemeengine_impl_win.h',
- 'webthread_impl.h',
- 'webthread_impl.cc',
'weburlloader_impl.cc',
'weburlloader_impl.h',
],
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 91109de..e93b61e 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -48,7 +48,6 @@
#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"
@@ -365,8 +364,7 @@ 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),
- current_thread_slot_(&DestroyCurrentThread) {}
+ shared_timer_suspended_(0) {}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
}
@@ -819,26 +817,6 @@ 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;
@@ -953,13 +931,6 @@ 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 d7a64bc..a56c2b1 100644
--- a/webkit/glue/webkitplatformsupport_impl.h
+++ b/webkit/glue/webkitplatformsupport_impl.h
@@ -8,7 +8,6 @@
#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"
@@ -126,8 +125,6 @@ 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);
@@ -168,7 +165,6 @@ 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_;
@@ -178,7 +174,6 @@ 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/renderer/compositor_bindings/web_compositor_support_impl.cc b/webkit/renderer/compositor_bindings/web_compositor_support_impl.cc
index d8a4fb6..f27d86a 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/glue/webthread_impl.h"
+#include "webkit/child/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/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index 5059031..a822a3d 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -9,8 +9,8 @@
#include "third_party/WebKit/public/platform/WebGamepads.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebUnitTestSupport.h"
+#include "webkit/child/webkitplatformsupport_child_impl.h"
#include "webkit/glue/webfileutilities_impl.h"
-#include "webkit/glue/webkitplatformsupport_impl.h"
#include "webkit/mocks/mock_webhyphenator.h"
#include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
#include "webkit/support/mock_webclipboard_impl.h"
@@ -37,7 +37,7 @@ class WebLayerTreeView;
// An implementation of WebKitPlatformSupport for tests.
class TestWebKitPlatformSupport :
public WebKit::WebUnitTestSupport,
- public webkit_glue::WebKitPlatformSupportImpl {
+ public webkit_glue::WebKitPlatformSupportChildImpl {
public:
TestWebKitPlatformSupport(bool unit_test_mode,
WebKit::Platform* shadow_platform_delegate);
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 3f16aed..4fc73c1 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"
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index 2634962..026e6d8 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -33,6 +33,7 @@
'<(DEPTH)/webkit/storage_common.gyp:webkit_storage_common',
'<(DEPTH)/webkit/storage_renderer.gyp:webkit_storage_renderer',
'glue',
+ 'glue_child',
'glue_common',
'plugins',
'webkit_common',