| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 GpuChildThread::~GpuChildThread() { | 211 GpuChildThread::~GpuChildThread() { |
| 212 while (!deferred_messages_.empty()) { | 212 while (!deferred_messages_.empty()) { |
| 213 delete deferred_messages_.front(); | 213 delete deferred_messages_.front(); |
| 214 deferred_messages_.pop(); | 214 deferred_messages_.pop(); |
| 215 } | 215 } |
| 216 g_lazy_tls.Pointer()->Set(nullptr); | 216 g_lazy_tls.Pointer()->Set(nullptr); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void GpuChildThread::Shutdown() { | 219 void GpuChildThread::Shutdown() { |
| 220 ChildThreadImpl::Shutdown(); | 220 ChildThreadImpl::Shutdown(); |
| 221 logging::SetLogMessageHandler(NULL); | 221 if (!in_browser_process_) |
| 222 logging::PopLogMessageHandler(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void GpuChildThread::Init(const base::Time& process_start_time) { | 225 void GpuChildThread::Init(const base::Time& process_start_time) { |
| 225 process_start_time_ = process_start_time; | 226 process_start_time_ = process_start_time; |
| 226 | 227 |
| 227 #if defined(OS_ANDROID) | 228 #if defined(OS_ANDROID) |
| 228 // When running in in-process mode, this has been set in the browser at | 229 // When running in in-process mode, this has been set in the browser at |
| 229 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). | 230 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). |
| 230 if (!in_browser_process_) | 231 if (!in_browser_process_) |
| 231 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); | 232 media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 368 |
| 368 if (dead_on_arrival_) { | 369 if (dead_on_arrival_) { |
| 369 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; | 370 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; |
| 370 base::MessageLoop::current()->QuitWhenIdle(); | 371 base::MessageLoop::current()->QuitWhenIdle(); |
| 371 return; | 372 return; |
| 372 } | 373 } |
| 373 | 374 |
| 374 // We don't need to pipe log messages if we are running the GPU thread in | 375 // We don't need to pipe log messages if we are running the GPU thread in |
| 375 // the browser process. | 376 // the browser process. |
| 376 if (!in_browser_process_) | 377 if (!in_browser_process_) |
| 377 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 378 logging::PushLogMessageHandler(GpuProcessLogMessageHandler); |
| 378 | 379 |
| 379 gpu::SyncPointManager* sync_point_manager = nullptr; | 380 gpu::SyncPointManager* sync_point_manager = nullptr; |
| 380 // Note SyncPointManager from ContentGpuClient cannot be owned by this. | 381 // Note SyncPointManager from ContentGpuClient cannot be owned by this. |
| 381 if (GetContentClient()->gpu()) | 382 if (GetContentClient()->gpu()) |
| 382 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); | 383 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); |
| 383 if (!sync_point_manager) { | 384 if (!sync_point_manager) { |
| 384 if (!owned_sync_point_manager_) { | 385 if (!owned_sync_point_manager_) { |
| 385 owned_sync_point_manager_.reset(new gpu::SyncPointManager(false)); | 386 owned_sync_point_manager_.reset(new gpu::SyncPointManager(false)); |
| 386 } | 387 } |
| 387 sync_point_manager = owned_sync_point_manager_.get(); | 388 sync_point_manager = owned_sync_point_manager_.get(); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 561 |
| 561 void GpuChildThread::BindProcessControlRequest( | 562 void GpuChildThread::BindProcessControlRequest( |
| 562 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 563 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 563 DVLOG(1) << "GPU: Binding ProcessControl request"; | 564 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 564 DCHECK(process_control_); | 565 DCHECK(process_control_); |
| 565 process_control_bindings_.AddBinding(process_control_.get(), | 566 process_control_bindings_.AddBinding(process_control_.get(), |
| 566 std::move(request)); | 567 std::move(request)); |
| 567 } | 568 } |
| 568 | 569 |
| 569 } // namespace content | 570 } // namespace content |
| OLD | NEW |