OLD | NEW |
---|---|
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 196 |
197 void GpuChildThread::Init(const base::Time& process_start_time) { | 197 void GpuChildThread::Init(const base::Time& process_start_time) { |
198 process_start_time_ = process_start_time; | 198 process_start_time_ = process_start_time; |
199 | 199 |
200 #if defined(OS_ANDROID) | 200 #if defined(OS_ANDROID) |
201 // When running in in-process mode, this has been set in the browser at | 201 // When running in in-process mode, this has been set in the browser at |
202 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). | 202 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). |
203 if (!in_browser_process_) | 203 if (!in_browser_process_) |
204 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); | 204 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); |
205 #endif | 205 #endif |
206 // We don't want to process any incoming interface requests until | |
207 // OnInitialize() is invoked. | |
jbauman
2017/01/11 01:49:22
Just checking, but is the reason we can remove thi
sadrul
2017/01/11 01:55:46
The Pause/Resume was added in https://crrev.com/40
Ken Rockot(use gerrit already)
2017/01/11 18:17:00
This rationale seems kind of circular to me. I don
| |
208 GetInterfaceRegistry()->PauseBinding(); | |
209 | 206 |
210 if (GetContentClient()->gpu()) // NULL in tests. | 207 if (GetContentClient()->gpu()) // NULL in tests. |
211 GetContentClient()->gpu()->Initialize(this); | 208 GetContentClient()->gpu()->Initialize(this); |
209 channel()->AddAssociatedInterface(base::Bind( | |
210 &GpuChildThread::CreateGpuMainService, base::Unretained(this))); | |
212 } | 211 } |
213 | 212 |
214 void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name, | 213 void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name, |
215 const std::string& group_name) { | 214 const std::string& group_name) { |
216 Send(new GpuHostMsg_FieldTrialActivated(trial_name)); | 215 Send(new GpuHostMsg_FieldTrialActivated(trial_name)); |
217 } | 216 } |
218 | 217 |
218 void GpuChildThread::CreateGpuMainService( | |
219 ui::mojom::GpuMainAssociatedRequest request) { | |
220 // TODO(sad): Implement. | |
221 } | |
222 | |
219 bool GpuChildThread::Send(IPC::Message* msg) { | 223 bool GpuChildThread::Send(IPC::Message* msg) { |
220 // The GPU process must never send a synchronous IPC message to the browser | 224 // The GPU process must never send a synchronous IPC message to the browser |
221 // process. This could result in deadlock. | 225 // process. This could result in deadlock. |
222 DCHECK(!msg->is_sync()); | 226 DCHECK(!msg->is_sync()); |
223 | 227 |
224 return ChildThreadImpl::Send(msg); | 228 return ChildThreadImpl::Send(msg); |
225 } | 229 } |
226 | 230 |
227 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 231 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
228 bool handled = true; | 232 bool handled = true; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 | 366 |
363 GetInterfaceRegistry()->AddInterface(base::Bind( | 367 GetInterfaceRegistry()->AddInterface(base::Bind( |
364 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); | 368 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); |
365 | 369 |
366 if (GetContentClient()->gpu()) { // NULL in tests. | 370 if (GetContentClient()->gpu()) { // NULL in tests. |
367 GetContentClient()->gpu()->ExposeInterfacesToBrowser(GetInterfaceRegistry(), | 371 GetContentClient()->gpu()->ExposeInterfacesToBrowser(GetInterfaceRegistry(), |
368 gpu_preferences); | 372 gpu_preferences); |
369 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser( | 373 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser( |
370 GetRemoteInterfaces()); | 374 GetRemoteInterfaces()); |
371 } | 375 } |
372 | |
373 GetInterfaceRegistry()->ResumeBinding(); | |
374 } | 376 } |
375 | 377 |
376 void GpuChildThread::OnFinalize() { | 378 void GpuChildThread::OnFinalize() { |
377 // Quit the GPU process | 379 // Quit the GPU process |
378 base::MessageLoop::current()->QuitWhenIdle(); | 380 base::MessageLoop::current()->QuitWhenIdle(); |
379 } | 381 } |
380 | 382 |
381 void GpuChildThread::OnCollectGraphicsInfo() { | 383 void GpuChildThread::OnCollectGraphicsInfo() { |
382 if (dead_on_arrival_) | 384 if (dead_on_arrival_) |
383 return; | 385 return; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 | 524 |
523 void GpuChildThread::BindServiceFactoryRequest( | 525 void GpuChildThread::BindServiceFactoryRequest( |
524 service_manager::mojom::ServiceFactoryRequest request) { | 526 service_manager::mojom::ServiceFactoryRequest request) { |
525 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 527 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
526 DCHECK(service_factory_); | 528 DCHECK(service_factory_); |
527 service_factory_bindings_.AddBinding(service_factory_.get(), | 529 service_factory_bindings_.AddBinding(service_factory_.get(), |
528 std::move(request)); | 530 std::move(request)); |
529 } | 531 } |
530 | 532 |
531 } // namespace content | 533 } // namespace content |
OLD | NEW |