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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.cc

Issue 628333003: Remove implicit conversions from scoped_refptr to T* in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | content/browser/android/in_process/synchronous_compositor_output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/android/in_process/synchronous_compositor_factory_impl .h" 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h" 8 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/renderer/gpu/frame_swap_message_queue.h" 10 #include "content/renderer/gpu/frame_swap_message_queue.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const blink::WebGraphicsContext3D::Attributes& attributes, 194 const blink::WebGraphicsContext3D::Attributes& attributes,
195 const std::string& debug_name) { 195 const std::string& debug_name) {
196 scoped_ptr<gpu::GLInProcessContext> context = 196 scoped_ptr<gpu::GLInProcessContext> context =
197 CreateOffscreenContext(attributes); 197 CreateOffscreenContext(attributes);
198 return webkit::gpu::ContextProviderInProcess::Create( 198 return webkit::gpu::ContextProviderInProcess::Create(
199 WrapContext(context.Pass()), debug_name); 199 WrapContext(context.Pass()), debug_name);
200 } 200 }
201 201
202 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: 202 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
203 CreateOnscreenContextProviderForCompositorThread() { 203 CreateOnscreenContextProviderForCompositorThread() {
204 DCHECK(service_); 204 DCHECK(service_.get());
205 205
206 gpu::GLInProcessContextSharedMemoryLimits mem_limits; 206 gpu::GLInProcessContextSharedMemoryLimits mem_limits;
207 // This is half of what RenderWidget uses because synchronous compositor 207 // This is half of what RenderWidget uses because synchronous compositor
208 // pipeline is only one frame deep. 208 // pipeline is only one frame deep.
209 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; 209 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024;
210 return webkit::gpu::ContextProviderInProcess::Create( 210 return webkit::gpu::ContextProviderInProcess::Create(
211 WrapContext(CreateContext(service_, mem_limits)), 211 WrapContext(CreateContext(service_, mem_limits)),
212 "Child-Compositor"); 212 "Child-Compositor");
213 } 213 }
214 214
(...skipping 11 matching lines...) Expand all
226 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl* 226 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl*
227 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( 227 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D(
228 const blink::WebGraphicsContext3D::Attributes& attributes) { 228 const blink::WebGraphicsContext3D::Attributes& attributes) {
229 return WrapContextWithAttributes(CreateOffscreenContext(attributes), 229 return WrapContextWithAttributes(CreateOffscreenContext(attributes),
230 attributes).release(); 230 attributes).release();
231 } 231 }
232 232
233 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { 233 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() {
234 base::AutoLock lock(num_hardware_compositor_lock_); 234 base::AutoLock lock(num_hardware_compositor_lock_);
235 num_hardware_compositors_++; 235 num_hardware_compositors_++;
236 if (num_hardware_compositors_ == 1 && main_thread_proxy_) { 236 if (num_hardware_compositors_ == 1 && main_thread_proxy_.get()) {
237 main_thread_proxy_->PostTask( 237 main_thread_proxy_->PostTask(
238 FROM_HERE, 238 FROM_HERE,
239 base::Bind( 239 base::Bind(
240 &SynchronousCompositorFactoryImpl::RestoreContextOnMainThread, 240 &SynchronousCompositorFactoryImpl::RestoreContextOnMainThread,
241 base::Unretained(this))); 241 base::Unretained(this)));
242 } 242 }
243 } 243 }
244 244
245 void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw() { 245 void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw() {
246 base::AutoLock lock(num_hardware_compositor_lock_); 246 base::AutoLock lock(num_hardware_compositor_lock_);
247 DCHECK_GT(num_hardware_compositors_, 0u); 247 DCHECK_GT(num_hardware_compositors_, 0u);
248 num_hardware_compositors_--; 248 num_hardware_compositors_--;
249 } 249 }
250 250
251 void SynchronousCompositorFactoryImpl::RestoreContextOnMainThread() { 251 void SynchronousCompositorFactoryImpl::RestoreContextOnMainThread() {
252 if (CanCreateMainThreadContext() && video_context_provider_ ) 252 if (CanCreateMainThreadContext() && video_context_provider_.get())
253 video_context_provider_->RestoreContext(); 253 video_context_provider_->RestoreContext();
254 } 254 }
255 255
256 bool SynchronousCompositorFactoryImpl::CanCreateMainThreadContext() { 256 bool SynchronousCompositorFactoryImpl::CanCreateMainThreadContext() {
257 base::AutoLock lock(num_hardware_compositor_lock_); 257 base::AutoLock lock(num_hardware_compositor_lock_);
258 return num_hardware_compositors_ > 0; 258 return num_hardware_compositors_ > 0;
259 } 259 }
260 260
261 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider> 261 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>
262 SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() { 262 SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() {
263 { 263 {
264 base::AutoLock lock(num_hardware_compositor_lock_); 264 base::AutoLock lock(num_hardware_compositor_lock_);
265 main_thread_proxy_ = base::MessageLoopProxy::current(); 265 main_thread_proxy_ = base::MessageLoopProxy::current();
266 } 266 }
267 267
268 // Always fail creation even if |video_context_provider_| is not NULL. 268 // Always fail creation even if |video_context_provider_| is not NULL.
269 // This is to avoid synchronous calls that may deadlock. Setting 269 // This is to avoid synchronous calls that may deadlock. Setting
270 // |video_context_provider_| to null is also not safe since it makes 270 // |video_context_provider_| to null is also not safe since it makes
271 // synchronous destruction uncontrolled and possibly deadlock. 271 // synchronous destruction uncontrolled and possibly deadlock.
272 if (!CanCreateMainThreadContext()) { 272 if (!CanCreateMainThreadContext()) {
273 return 273 return
274 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); 274 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>();
275 } 275 }
276 276
277 if (!video_context_provider_) { 277 if (!video_context_provider_.get()) {
278 DCHECK(service_); 278 DCHECK(service_.get());
279 279
280 video_context_provider_ = new VideoContextProvider( 280 video_context_provider_ = new VideoContextProvider(
281 CreateContext(service_, 281 CreateContext(service_,
282 gpu::GLInProcessContextSharedMemoryLimits())); 282 gpu::GLInProcessContextSharedMemoryLimits()));
283 } 283 }
284 return video_context_provider_; 284 return video_context_provider_;
285 } 285 }
286 286
287 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( 287 void SynchronousCompositorFactoryImpl::SetDeferredGpuService(
288 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 288 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
289 DCHECK(!service_); 289 DCHECK(!service_.get());
290 service_ = service; 290 service_ = service;
291 } 291 }
292 292
293 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( 293 void SynchronousCompositorFactoryImpl::SetRecordFullDocument(
294 bool record_full_document) { 294 bool record_full_document) {
295 record_full_layer_ = record_full_document; 295 record_full_layer_ = record_full_document;
296 } 296 }
297 297
298 } // namespace content 298 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/in_process/synchronous_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698