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

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: comments addressed 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
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return supported_types[0]; 176 return supported_types[0];
176 } 177 }
177 178
178 void GpuChildThread::Shutdown() { 179 void GpuChildThread::Shutdown() {
179 ChildThreadImpl::Shutdown(); 180 ChildThreadImpl::Shutdown();
180 logging::SetLogMessageHandler(NULL); 181 logging::SetLogMessageHandler(NULL);
181 } 182 }
182 183
183 void GpuChildThread::Init(const base::Time& process_start_time) { 184 void GpuChildThread::Init(const base::Time& process_start_time) {
184 process_start_time_ = process_start_time; 185 process_start_time_ = process_start_time;
186
187 process_control_.reset(new GpuProcessControlImpl());
188 // Use of base::Unretained(this) is safe here because |service_registry()|
189 // and the message loop will be destroyed before GpuChildThread is destructed.
piman 2015/10/08 22:37:02 To be clear, does that mean BindProcessControlRequ
xhwang 2015/10/09 23:36:35 Sorry I didn't make it clear. BindProcessControlRe
190 service_registry()->AddService(base::Bind(
191 &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
185 } 192 }
186 193
187 bool GpuChildThread::Send(IPC::Message* msg) { 194 bool GpuChildThread::Send(IPC::Message* msg) {
188 // The GPU process must never send a synchronous IPC message to the browser 195 // The GPU process must never send a synchronous IPC message to the browser
189 // process. This could result in deadlock. 196 // process. This could result in deadlock.
190 DCHECK(!msg->is_sync()); 197 DCHECK(!msg->is_sync());
191 198
192 return ChildThreadImpl::Send(msg); 199 return ChildThreadImpl::Send(msg);
193 } 200 }
194 201
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 watchdog_thread_->Stop(); 374 watchdog_thread_->Stop();
368 } 375 }
369 } 376 }
370 377
371 void GpuChildThread::OnGpuSwitched() { 378 void GpuChildThread::OnGpuSwitched() {
372 DVLOG(1) << "GPU: GPU has switched"; 379 DVLOG(1) << "GPU: GPU has switched";
373 // Notify observers in the GPU process. 380 // Notify observers in the GPU process.
374 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 381 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
375 } 382 }
376 383
384 void GpuChildThread::BindProcessControlRequest(
385 mojo::InterfaceRequest<ProcessControl> request) {
386 DCHECK(process_control_);
387 process_control_bindings_.AddBinding(process_control_.get(), request.Pass());
388 }
389
377 } // namespace content 390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698