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

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

Issue 1297953004: Support mojo applications in GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 2 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
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_process_control_impl.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "content/child/child_process.h" 11 #include "content/child/child_process.h"
12 #include "content/child/thread_safe_sender.h" 12 #include "content/child/thread_safe_sender.h"
13 #include "content/common/gpu/gpu_memory_buffer_factory.h" 13 #include "content/common/gpu/gpu_memory_buffer_factory.h"
14 #include "content/common/gpu/gpu_messages.h" 14 #include "content/common/gpu/gpu_messages.h"
15 #include "content/gpu/gpu_process_control_impl.h"
15 #include "content/gpu/gpu_watchdog_thread.h" 16 #include "content/gpu/gpu_watchdog_thread.h"
16 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "gpu/config/gpu_info_collector.h" 19 #include "gpu/config/gpu_info_collector.h"
19 #include "ipc/ipc_channel_handle.h" 20 #include "ipc/ipc_channel_handle.h"
20 #include "ipc/ipc_sync_message_filter.h" 21 #include "ipc/ipc_sync_message_filter.h"
21 #include "ui/gl/gl_implementation.h" 22 #include "ui/gl/gl_implementation.h"
22 #include "ui/gl/gpu_switching_manager.h" 23 #include "ui/gl/gpu_switching_manager.h"
23 24
24 #if defined(USE_OZONE) 25 #if defined(USE_OZONE)
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 183 }
183 } 184 }
184 185
185 void GpuChildThread::Shutdown() { 186 void GpuChildThread::Shutdown() {
186 ChildThreadImpl::Shutdown(); 187 ChildThreadImpl::Shutdown();
187 logging::SetLogMessageHandler(NULL); 188 logging::SetLogMessageHandler(NULL);
188 } 189 }
189 190
190 void GpuChildThread::Init(const base::Time& process_start_time) { 191 void GpuChildThread::Init(const base::Time& process_start_time) {
191 process_start_time_ = process_start_time; 192 process_start_time_ = process_start_time;
193
194 process_control_.reset(new GpuProcessControlImpl());
195 // Use of base::Unretained(this) is safe here because |service_registry()|
196 // will be destroyed before GpuChildThread is destructed.
197 service_registry()->AddService(base::Bind(
198 &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
192 } 199 }
193 200
194 bool GpuChildThread::Send(IPC::Message* msg) { 201 bool GpuChildThread::Send(IPC::Message* msg) {
195 // The GPU process must never send a synchronous IPC message to the browser 202 // The GPU process must never send a synchronous IPC message to the browser
196 // process. This could result in deadlock. 203 // process. This could result in deadlock.
197 DCHECK(!msg->is_sync()); 204 DCHECK(!msg->is_sync());
198 205
199 return ChildThreadImpl::Send(msg); 206 return ChildThreadImpl::Send(msg);
200 } 207 }
201 208
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 watchdog_thread_->Stop(); 381 watchdog_thread_->Stop();
375 } 382 }
376 } 383 }
377 384
378 void GpuChildThread::OnGpuSwitched() { 385 void GpuChildThread::OnGpuSwitched() {
379 DVLOG(1) << "GPU: GPU has switched"; 386 DVLOG(1) << "GPU: GPU has switched";
380 // Notify observers in the GPU process. 387 // Notify observers in the GPU process.
381 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 388 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
382 } 389 }
383 390
391 void GpuChildThread::BindProcessControlRequest(
392 mojo::InterfaceRequest<ProcessControl> request) {
393 DVLOG(1) << "GPU: Binding ProcessControl request";
394 DCHECK(process_control_);
395 process_control_bindings_.AddBinding(process_control_.get(), request.Pass());
396 }
397
384 } // namespace content 398 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_process_control_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698