Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1759)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 9270025: Remove renderer dependencies from the GPU client classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add overrides Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 578d6aaf7d3354f4ac07b05b883f44ebb215c61c..064f0802d8e619ee6275b4789b84036853ed643f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -180,6 +180,8 @@ void RenderThreadImpl::Init() {
#endif
lazy_tls.Pointer()->Set(this);
+ GpuChannelHostFactory::set_instance(this);
+
#if defined(OS_WIN)
// If you are running plugins in this thread you need COM active but in
// the normal case you don't.
@@ -267,6 +269,7 @@ RenderThreadImpl::~RenderThreadImpl() {
if (webkit_platform_support_.get())
WebKit::shutdown();
+ GpuChannelHostFactory::set_instance(NULL);
lazy_tls.Pointer()->Set(NULL);
// TODO(port)
@@ -677,6 +680,50 @@ void RenderThreadImpl::ReleaseCachedFonts() {
#endif // OS_WIN
+bool RenderThreadImpl::IsMainThread() {
+ return !!current();
+}
+
+bool RenderThreadImpl::IsIOThread() {
+ return MessageLoop::current() == ChildProcess::current()->io_message_loop();
+}
+
+MessageLoop* RenderThreadImpl::GetMainLoop() {
+ return message_loop();
+}
+base::MessageLoopProxy* RenderThreadImpl::GetIOLoopProxy() {
+ return ChildProcess::current()->io_message_loop_proxy();
+}
+
+base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() {
+ return ChildProcess::current()->GetShutDownEvent();
+}
+
+scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory(
+ uint32 size) {
+ if (!IsMainThread())
+ return scoped_ptr<base::SharedMemory>();
+ base::SharedMemoryHandle handle;
+ if (!ChildThread::Send(new ChildProcessHostMsg_SyncAllocateSharedMemory(
+ size,
+ &handle))) {
+ return scoped_ptr<base::SharedMemory>();
+ }
+ if (!base::SharedMemory::IsHandleValid(handle))
+ return scoped_ptr<base::SharedMemory>();
+ return scoped_ptr<base::SharedMemory>(new base::SharedMemory(handle, false));
+}
+
+int32 RenderThreadImpl::CreateViewCommandBuffer(
+ int32 surface_id, const GPUCreateCommandBufferConfig& init_params) {
+ int32 route_id = MSG_ROUTING_NONE;
+ ChildThread::Send(new GpuHostMsg_CreateViewCommandBuffer(
+ surface_id,
+ init_params,
+ &route_id));
+ return route_id;
+}
+
int32 RenderThreadImpl::RoutingIDForCurrentContext() {
int32 routing_id = MSG_ROUTING_CONTROL;
if (v8::Context::InContext()) {
@@ -798,7 +845,7 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
}
if (!gpu_channel_.get())
- gpu_channel_ = new GpuChannelHost;
+ gpu_channel_ = new GpuChannelHost(this);
// Ask the browser for the channel name.
IPC::ChannelHandle channel_handle;
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698