Chromium Code Reviews| 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/browser/gpu/browser_gpu_channel_host_factory.h" | 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() { | 351 GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() { |
| 352 if (gpu_channel_ && !gpu_channel_->IsLost()) | 352 if (gpu_channel_ && !gpu_channel_->IsLost()) |
| 353 return gpu_channel_; | 353 return gpu_channel_; |
| 354 | 354 |
| 355 return NULL; | 355 return NULL; |
| 356 } | 356 } |
| 357 | 357 |
| 358 void BrowserGpuChannelHostFactory::GpuChannelEstablished() { | 358 void BrowserGpuChannelHostFactory::GpuChannelEstablished() { |
| 359 DCHECK(IsMainThread()); | 359 DCHECK(IsMainThread()); |
| 360 DCHECK(pending_request_); | 360 DCHECK(pending_request_); |
| 361 if (pending_request_->channel_handle().name.empty()) | 361 if (pending_request_->channel_handle().name.empty()) { |
| 362 return; | 362 gpu_channel_ = NULL; |
|
piman
2014/05/14 19:08:17
nit: gpu_channel_ should be NULL here, right? We r
| |
| 363 | 363 } else { |
| 364 GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); | 364 GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); |
| 365 gpu_channel_ = GpuChannelHost::Create(this, | 365 gpu_channel_ = GpuChannelHost::Create(this, |
| 366 pending_request_->gpu_info(), | 366 pending_request_->gpu_info(), |
| 367 pending_request_->channel_handle(), | 367 pending_request_->channel_handle(), |
| 368 shutdown_event_.get()); | 368 shutdown_event_.get()); |
| 369 } | |
| 369 gpu_host_id_ = pending_request_->gpu_host_id(); | 370 gpu_host_id_ = pending_request_->gpu_host_id(); |
| 370 pending_request_ = NULL; | 371 pending_request_ = NULL; |
| 371 | 372 |
| 372 for (size_t n = 0; n < established_callbacks_.size(); n++) | 373 for (size_t n = 0; n < established_callbacks_.size(); n++) |
| 373 established_callbacks_[n].Run(); | 374 established_callbacks_[n].Run(); |
| 374 | 375 |
| 375 established_callbacks_.clear(); | 376 established_callbacks_.clear(); |
| 376 } | 377 } |
| 377 | 378 |
| 378 scoped_ptr<gfx::GpuMemoryBuffer> | 379 scoped_ptr<gfx::GpuMemoryBuffer> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 filter->AddRoute(MSG_ROUTING_CONTROL, handler); | 418 filter->AddRoute(MSG_ROUTING_CONTROL, handler); |
| 418 | 419 |
| 419 GetIOLoopProxy()->PostTask( | 420 GetIOLoopProxy()->PostTask( |
| 420 FROM_HERE, | 421 FROM_HERE, |
| 421 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, | 422 base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO, |
| 422 gpu_host_id_, | 423 gpu_host_id_, |
| 423 filter)); | 424 filter)); |
| 424 } | 425 } |
| 425 | 426 |
| 426 } // namespace content | 427 } // namespace content |
| OLD | NEW |