| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 #endif | 232 #endif |
| 233 | 233 |
| 234 // Only set once per process instance. | 234 // Only set once per process instance. |
| 235 process_control_.reset(new GpuProcessControlImpl()); | 235 process_control_.reset(new GpuProcessControlImpl()); |
| 236 | 236 |
| 237 // Use of base::Unretained(this) is safe here because |service_registry()| | 237 // Use of base::Unretained(this) is safe here because |service_registry()| |
| 238 // will be destroyed before GpuChildThread is destructed. | 238 // will be destroyed before GpuChildThread is destructed. |
| 239 service_registry()->AddService(base::Bind( | 239 service_registry()->AddService(base::Bind( |
| 240 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); | 240 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| 241 | 241 |
| 242 if (GetContentClient()->gpu()) // NULL in tests. | 242 if (GetContentClient()->gpu()) { // NULL in tests. |
| 243 GetContentClient()->gpu()->Initialize(this); |
| 243 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); | 244 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); |
| 245 } |
| 246 } |
| 247 |
| 248 void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name, |
| 249 const std::string& group_name) { |
| 250 Send(new GpuHostMsg_FieldTrialActivated(trial_name)); |
| 244 } | 251 } |
| 245 | 252 |
| 246 bool GpuChildThread::Send(IPC::Message* msg) { | 253 bool GpuChildThread::Send(IPC::Message* msg) { |
| 247 // The GPU process must never send a synchronous IPC message to the browser | 254 // The GPU process must never send a synchronous IPC message to the browser |
| 248 // process. This could result in deadlock. | 255 // process. This could result in deadlock. |
| 249 DCHECK(!msg->is_sync()); | 256 DCHECK(!msg->is_sync()); |
| 250 | 257 |
| 251 return ChildThreadImpl::Send(msg); | 258 return ChildThreadImpl::Send(msg); |
| 252 } | 259 } |
| 253 | 260 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 567 |
| 561 void GpuChildThread::BindProcessControlRequest( | 568 void GpuChildThread::BindProcessControlRequest( |
| 562 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 569 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 563 DVLOG(1) << "GPU: Binding ProcessControl request"; | 570 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 564 DCHECK(process_control_); | 571 DCHECK(process_control_); |
| 565 process_control_bindings_.AddBinding(process_control_.get(), | 572 process_control_bindings_.AddBinding(process_control_.get(), |
| 566 std::move(request)); | 573 std::move(request)); |
| 567 } | 574 } |
| 568 | 575 |
| 569 } // namespace content | 576 } // namespace content |
| OLD | NEW |