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

Side by Side Diff: webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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 "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 scoped_ptr<GpuMemoryBuffer> buffer = 350 scoped_ptr<GpuMemoryBuffer> buffer =
351 g_gpu_memory_buffer_creator(width, height); 351 g_gpu_memory_buffer_creator(width, height);
352 352
353 if (buffer.get() == NULL) 353 if (buffer.get() == NULL)
354 return buffer.Pass(); 354 return buffer.Pass();
355 355
356 scoped_refptr<gfx::GLImage> gl_image = 356 scoped_refptr<gfx::GLImage> gl_image =
357 gfx::GLImage::CreateGLImageForGpuMemoryBuffer(buffer->GetNativeBuffer(), 357 gfx::GLImage::CreateGLImageForGpuMemoryBuffer(buffer->GetNativeBuffer(),
358 gfx::Size(width, height)); 358 gfx::Size(width, height));
359 *image_id = ++next_id_; // Valid image_ids start from 1. 359 *image_id = ++next_id_; // Valid image_ids start from 1.
360 image_manager_->AddImage(gl_image, *image_id); 360 image_manager_->AddImage(gl_image.get(), *image_id);
361 return buffer.Pass(); 361 return buffer.Pass();
362 } 362 }
363 363
364 void ImageFactoryInProcess::DeleteGpuMemoryBuffer(unsigned int image_id) { 364 void ImageFactoryInProcess::DeleteGpuMemoryBuffer(unsigned int image_id) {
365 // We're taking the lock here because we're accessing the ContextGroup's 365 // We're taking the lock here because we're accessing the ContextGroup's
366 // shared ImageManager. 366 // shared ImageManager.
367 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(), 367 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(),
368 g_all_shared_contexts.Get()); 368 g_all_shared_contexts.Get());
369 image_manager_->RemoveImage(image_id); 369 image_manager_->RemoveImage(image_id);
370 } 370 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 decoder_.get(), 606 decoder_.get(),
607 decoder_.get())); 607 decoder_.get()));
608 608
609 decoder_->set_engine(gpu_scheduler_.get()); 609 decoder_->set_engine(gpu_scheduler_.get());
610 610
611 if (is_offscreen) 611 if (is_offscreen)
612 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); 612 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size);
613 else 613 else
614 surface_ = gfx::GLSurface::CreateViewGLSurface(false, window); 614 surface_ = gfx::GLSurface::CreateViewGLSurface(false, window);
615 615
616 if (!surface_) { 616 if (!surface_.get()) {
617 LOG(ERROR) << "Could not create GLSurface."; 617 LOG(ERROR) << "Could not create GLSurface.";
618 Destroy(); 618 Destroy();
619 return false; 619 return false;
620 } 620 }
621 621
622 if (g_use_virtualized_gl_context) { 622 if (g_use_virtualized_gl_context) {
623 context_ = share_group->GetSharedContext(); 623 context_ = share_group->GetSharedContext();
624 if (!context_) { 624 if (!context_.get()) {
625 context_ = gfx::GLContext::CreateGLContext(share_group.get(), 625 context_ = gfx::GLContext::CreateGLContext(
626 surface_.get(), 626 share_group.get(), surface_.get(), gpu_preference);
627 gpu_preference); 627 share_group->SetSharedContext(context_.get());
628 share_group->SetSharedContext(context_);
629 } 628 }
630 629
631 context_ = new ::gpu::GLContextVirtual(share_group.get(), 630 context_ = new ::gpu::GLContextVirtual(
632 context_, 631 share_group.get(), context_.get(), decoder_->AsWeakPtr());
633 decoder_->AsWeakPtr()); 632 if (context_->Initialize(surface_.get(), gpu_preference)) {
634 if (context_->Initialize(surface_, gpu_preference)) {
635 VLOG(1) << "Created virtual GL context."; 633 VLOG(1) << "Created virtual GL context.";
636 } else { 634 } else {
637 context_ = NULL; 635 context_ = NULL;
638 } 636 }
639 } else { 637 } else {
640 context_ = gfx::GLContext::CreateGLContext(share_group.get(), 638 context_ = gfx::GLContext::CreateGLContext(share_group.get(),
641 surface_.get(), 639 surface_.get(),
642 gpu_preference); 640 gpu_preference);
643 } 641 }
644 642
645 if (!context_) { 643 if (!context_.get()) {
646 LOG(ERROR) << "Could not create GLContext."; 644 LOG(ERROR) << "Could not create GLContext.";
647 Destroy(); 645 Destroy();
648 return false; 646 return false;
649 } 647 }
650 648
651 if (!context_->MakeCurrent(surface_)) { 649 if (!context_->MakeCurrent(surface_.get())) {
652 LOG(ERROR) << "Could not make context current."; 650 LOG(ERROR) << "Could not make context current.";
653 Destroy(); 651 Destroy();
654 return false; 652 return false;
655 } 653 }
656 654
657 ::gpu::gles2::DisallowedFeatures disallowed_features; 655 ::gpu::gles2::DisallowedFeatures disallowed_features;
658 disallowed_features.swap_buffer_complete_callback = true; 656 disallowed_features.swap_buffer_complete_callback = true;
659 disallowed_features.gpu_memory_manager = true; 657 disallowed_features.gpu_memory_manager = true;
660 if (!decoder_->Initialize(surface_, 658 if (!decoder_->Initialize(surface_,
661 context_, 659 context_,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 image_factory_ = new ImageFactoryInProcess(GetImageManager()); 707 image_factory_ = new ImageFactoryInProcess(GetImageManager());
710 } 708 }
711 709
712 // Create the object exposing the OpenGL API. 710 // Create the object exposing the OpenGL API.
713 gles2_implementation_.reset(new GLES2Implementation( 711 gles2_implementation_.reset(new GLES2Implementation(
714 gles2_helper_.get(), 712 gles2_helper_.get(),
715 context_group ? context_group->GetImplementation()->share_group() : NULL, 713 context_group ? context_group->GetImplementation()->share_group() : NULL,
716 transfer_buffer_.get(), 714 transfer_buffer_.get(),
717 true, 715 true,
718 false, 716 false,
719 image_factory_)); 717 image_factory_.get()));
720 718
721 if (!gles2_implementation_->Initialize( 719 if (!gles2_implementation_->Initialize(
722 kStartTransferBufferSize, 720 kStartTransferBufferSize,
723 kMinTransferBufferSize, 721 kMinTransferBufferSize,
724 kMaxTransferBufferSize)) { 722 kMaxTransferBufferSize)) {
725 return false; 723 return false;
726 } 724 }
727 725
728 if (share_resources_) { 726 if (share_resources_) {
729 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(), 727 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(),
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 2002 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
2005 WGC3Denum) 2003 WGC3Denum)
2006 2004
2007 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator( 2005 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator(
2008 GpuMemoryBufferCreator* creator) { 2006 GpuMemoryBufferCreator* creator) {
2009 g_gpu_memory_buffer_creator = creator; 2007 g_gpu_memory_buffer_creator = creator;
2010 } 2008 }
2011 2009
2012 } // namespace gpu 2010 } // namespace gpu
2013 } // namespace webkit 2011 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/common/gpu/test_context_provider_factory.cc ('k') | webkit/common/gpu/webgraphicscontext3d_in_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698