Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: content/browser/renderer_host/context_provider_factory_impl_android.cc

Issue 2656893003: Let DelegateFrameHost in Mac and Android use correct FrameSinkId during creation (Closed)
Patch Set: more comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // The FrameSinkId generated here must be unique with
140 // RenderWidgetHostViewAndroid's
141 // FrameSinkId allocation.
142 // TODO(crbug.com/685777): Centralize allocation in one place for easier
143 // maintenance.
144 return cc::FrameSinkId(0 /* client_id */, next_sink_id_++);
140 } 145 }
141 146
142 gpu::GpuMemoryBufferManager* 147 gpu::GpuMemoryBufferManager*
143 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() { 148 ContextProviderFactoryImpl::GetGpuMemoryBufferManager() {
144 return BrowserGpuMemoryBufferManager::current(); 149 return BrowserGpuMemoryBufferManager::current();
145 } 150 }
146 151
147 scoped_refptr<cc::ContextProvider> 152 scoped_refptr<cc::ContextProvider>
148 ContextProviderFactoryImpl::CreateContextProviderInternal( 153 ContextProviderFactoryImpl::CreateContextProviderInternal(
149 ui::command_buffer_metrics::ContextType context_type, 154 ui::command_buffer_metrics::ContextType context_type,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 nullptr, 238 nullptr,
234 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED); 239 GpuChannelHostResult::FAILURE_GPU_PROCESS_INITIALIZATION_FAILED);
235 } 240 }
236 } 241 }
237 242
238 void ContextProviderFactoryImpl::OnGpuChannelTimeout() { 243 void ContextProviderFactoryImpl::OnGpuChannelTimeout() {
239 LOG(FATAL) << "Timed out waiting for GPU channel."; 244 LOG(FATAL) << "Timed out waiting for GPU channel.";
240 } 245 }
241 246
242 } // namespace content 247 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698