| 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/ref_counted.h" | 10 #include "base/memory/ref_counted.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 surface_client_id_(0), | 69 next_client_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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 shared_context_provider, std::move(gpu_channel_host)); | 128 shared_context_provider, std::move(gpu_channel_host)); |
| 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 uint32_t ContextProviderFactoryImpl::AllocateSurfaceClientId() { | 138 cc::FrameSinkId ContextProviderFactoryImpl::AllocateFrameSinkId() { |
| 139 return ++surface_client_id_; | 139 return cc::FrameSinkId(next_client_id_, 0 /* sink_id */); |
| 140 } | 140 } |
| 141 | 141 |
| 142 cc::SharedBitmapManager* ContextProviderFactoryImpl::GetSharedBitmapManager() { | 142 cc::SharedBitmapManager* ContextProviderFactoryImpl::GetSharedBitmapManager() { |
| 143 return HostSharedBitmapManager::current(); | 143 return HostSharedBitmapManager::current(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 gpu::GpuMemoryBufferManager* | 146 gpu::GpuMemoryBufferManager* |
| 147 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() { | 147 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() { |
| 148 return BrowserGpuMemoryBufferManager::current(); | 148 return BrowserGpuMemoryBufferManager::current(); |
| 149 } | 149 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 nullptr, | 234 nullptr, |
| 235 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED); | 235 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { | 239 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { |
| 240 LOG(FATAL) << "Timed out waiting for GPU channel."; | 240 LOG(FATAL) << "Timed out waiting for GPU channel."; |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace content | 243 } // namespace content |
| OLD | NEW |