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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 6793054: Moved code that runs in both the browser and GPU process from content/gpu to content/common/gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/win/scoped_com_initializer.h" 10 #include "app/win/scoped_com_initializer.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/threading/worker_pool.h" 12 #include "base/threading/worker_pool.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "content/common/child_process.h" 15 #include "content/common/child_process.h"
16 #include "content/common/gpu/content_gpu_client.h"
16 #include "content/common/gpu_messages.h" 17 #include "content/common/gpu_messages.h"
17 #include "content/gpu/content_gpu_client.h"
18 #include "content/gpu/gpu_info_collector.h" 18 #include "content/gpu/gpu_info_collector.h"
19 #include "content/gpu/gpu_watchdog_thread.h" 19 #include "content/gpu/gpu_watchdog_thread.h"
20 #include "ipc/ipc_channel_handle.h" 20 #include "ipc/ipc_channel_handle.h"
21 #include "ui/gfx/gl/gl_context.h" 21 #include "ui/gfx/gl/gl_context.h"
22 #include "ui/gfx/gl/gl_implementation.h" 22 #include "ui/gfx/gl/gl_implementation.h"
23 23
24 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
25 #include "content/common/sandbox_init_wrapper.h" 25 #include "content/common/sandbox_init_wrapper.h"
26 #include "content/common/sandbox_mac.h" 26 #include "content/common/sandbox_mac.h"
27 #elif defined(OS_WIN) 27 #elif defined(OS_WIN)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) 103 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize)
104 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) 104 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo)
105 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) 105 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash)
106 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) 106 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang)
107 IPC_MESSAGE_UNHANDLED(handled = false) 107 IPC_MESSAGE_UNHANDLED(handled = false)
108 IPC_END_MESSAGE_MAP_EX() 108 IPC_END_MESSAGE_MAP_EX()
109 109
110 if (handled) 110 if (handled)
111 return true; 111 return true;
112 112
113 return render_thread_.get() && render_thread_->OnMessageReceived(msg); 113 return gpu_channel_manager_.get() &&
114 gpu_channel_manager_->OnMessageReceived(msg);
114 } 115 }
115 116
116 void GpuChildThread::OnInitialize() { 117 void GpuChildThread::OnInitialize() {
117 // Load the GL implementation and locate the bindings before starting the GPU 118 // Load the GL implementation and locate the bindings before starting the GPU
118 // watchdog because this can take a lot of time and the GPU watchdog might 119 // watchdog because this can take a lot of time and the GPU watchdog might
119 // terminate the GPU process. 120 // terminate the GPU process.
120 if (!gfx::GLContext::InitializeOneOff()) { 121 if (!gfx::GLContext::InitializeOneOff()) {
121 LOG(INFO) << "GLContext::InitializeOneOff failed"; 122 LOG(INFO) << "GLContext::InitializeOneOff failed";
122 MessageLoop::current()->Quit(); 123 MessageLoop::current()->Quit();
123 return; 124 return;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Start the GPU watchdog only after anything that is expected to be time 181 // Start the GPU watchdog only after anything that is expected to be time
181 // consuming has completed, otherwise the process is liable to be aborted. 182 // consuming has completed, otherwise the process is liable to be aborted.
182 if (enable_watchdog) { 183 if (enable_watchdog) {
183 watchdog_thread_ = new GpuWatchdogThread(kGpuTimeout); 184 watchdog_thread_ = new GpuWatchdogThread(kGpuTimeout);
184 watchdog_thread_->Start(); 185 watchdog_thread_->Start();
185 } 186 }
186 187
187 // Defer creation of the render thread. This is to prevent it from handling 188 // Defer creation of the render thread. This is to prevent it from handling
188 // IPC messages before the sandbox has been enabled and all other necessary 189 // IPC messages before the sandbox has been enabled and all other necessary
189 // initialization has succeeded. 190 // initialization has succeeded.
190 render_thread_.reset(new GpuRenderThread( 191 gpu_channel_manager_.reset(new GpuChannelManager(
191 this, 192 this,
192 watchdog_thread_, 193 watchdog_thread_,
193 ChildProcess::current()->io_message_loop(), 194 ChildProcess::current()->io_message_loop(),
194 ChildProcess::current()->GetShutDownEvent())); 195 ChildProcess::current()->GetShutDownEvent()));
195 196
196 // Ensure the browser process receives the GPU info before a reply to any 197 // Ensure the browser process receives the GPU info before a reply to any
197 // subsequent IPC it might send. 198 // subsequent IPC it might send.
198 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); 199 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
199 } 200 }
200 201
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Runs on the main thread. 263 // Runs on the main thread.
263 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, 264 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread,
264 const DxDiagNode& node) { 265 const DxDiagNode& node) {
265 thread->gpu_info_.dx_diagnostics = node; 266 thread->gpu_info_.dx_diagnostics = node;
266 thread->gpu_info_.finalized = true; 267 thread->gpu_info_.finalized = true;
267 thread->collecting_dx_diagnostics_ = false; 268 thread->collecting_dx_diagnostics_ = false;
268 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); 269 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_));
269 } 270 }
270 271
271 #endif 272 #endif
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698