Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/renderer_host/context_provider_factory_impl_android.h" | 5 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // static | 59 // static |
| 60 ContextProviderFactoryImpl* ContextProviderFactoryImpl::GetInstance() { | 60 ContextProviderFactoryImpl* ContextProviderFactoryImpl::GetInstance() { |
| 61 return instance; | 61 return instance; |
| 62 } | 62 } |
| 63 | 63 |
| 64 ContextProviderFactoryImpl::ContextProviderFactoryImpl( | 64 ContextProviderFactoryImpl::ContextProviderFactoryImpl( |
| 65 gpu::GpuChannelEstablishFactory* gpu_channel_factory) | 65 gpu::GpuChannelEstablishFactory* gpu_channel_factory) |
| 66 : gpu_channel_factory_(gpu_channel_factory), | 66 : gpu_channel_factory_(gpu_channel_factory), |
| 67 in_handle_pending_requests_(false), | 67 in_handle_pending_requests_(false), |
| 68 in_shutdown_(false), | 68 in_shutdown_(false), |
| 69 next_client_id_(1u), | 69 next_sink_id_(1u), |
| 70 weak_factory_(this) { | 70 weak_factory_(this) { |
| 71 DCHECK(gpu_channel_factory_); | 71 DCHECK(gpu_channel_factory_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 ContextProviderFactoryImpl::~ContextProviderFactoryImpl() { | 74 ContextProviderFactoryImpl::~ContextProviderFactoryImpl() { |
| 75 in_shutdown_ = true; | 75 in_shutdown_ = true; |
| 76 if (!gpu_channel_requests_.empty()) | 76 if (!gpu_channel_requests_.empty()) |
| 77 HandlePendingRequests(nullptr, | 77 HandlePendingRequests(nullptr, |
| 78 GpuChannelHostResult::FAILURE_FACTORY_SHUTDOWN); | 78 GpuChannelHostResult::FAILURE_FACTORY_SHUTDOWN); |
| 79 } | 79 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 } | 129 } |
| 130 | 130 |
| 131 cc::SurfaceManager* ContextProviderFactoryImpl::GetSurfaceManager() { | 131 cc::SurfaceManager* ContextProviderFactoryImpl::GetSurfaceManager() { |
| 132 if (!surface_manager_) | 132 if (!surface_manager_) |
| 133 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 133 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
| 134 | 134 |
| 135 return surface_manager_.get(); | 135 return surface_manager_.get(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 cc::FrameSinkId ContextProviderFactoryImpl::AllocateFrameSinkId() { | 138 cc::FrameSinkId ContextProviderFactoryImpl::AllocateFrameSinkId() { |
| 139 return cc::FrameSinkId(++next_client_id_, 0 /* sink_id */); | 139 return cc::FrameSinkId(0 /* client_id */, ++next_sink_id_); |
|
Fady Samuel
2017/01/26 20:52:20
next_sink_id_++ to match other platforms.
This sk
xlai (Olivia)
2017/01/26 20:59:44
Done.
| |
| 140 } | 140 } |
| 141 | 141 |
| 142 gpu::GpuMemoryBufferManager* | 142 gpu::GpuMemoryBufferManager* |
| 143 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() { | 143 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() { |
| 144 return BrowserGpuMemoryBufferManager::current(); | 144 return BrowserGpuMemoryBufferManager::current(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 scoped_refptr<cc::ContextProvider> | 147 scoped_refptr<cc::ContextProvider> |
| 148 ContextProviderFactoryImpl::CreateContextProviderInternal( | 148 ContextProviderFactoryImpl::CreateContextProviderInternal( |
| 149 ui::command_buffer_metrics::ContextType context_type, | 149 ui::command_buffer_metrics::ContextType context_type, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 nullptr, | 233 nullptr, |
| 234 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED); | 234 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { | 238 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { |
| 239 LOG(FATAL) << "Timed out waiting for GPU channel."; | 239 LOG(FATAL) << "Timed out waiting for GPU channel."; |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace content | 242 } // namespace content |
| OLD | NEW |