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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 189333003: cc: Allow pepper to avoid DCHECK but reuse gpu::Mailbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: baddcheck: compile Created 6 years, 9 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
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 container_->scrollRect(dx, dy, rect); 718 container_->scrollRect(dx, dy, rect);
719 } else { 719 } else {
720 // Can't do optimized scrolling since there could be other elements on top 720 // Can't do optimized scrolling since there could be other elements on top
721 // of us or the view renders via the accelerated compositor which is 721 // of us or the view renders via the accelerated compositor which is
722 // incompatible with the move and backfill scrolling model. 722 // incompatible with the move and backfill scrolling model.
723 InvalidateRect(rect); 723 InvalidateRect(rect);
724 } 724 }
725 } 725 }
726 } 726 }
727 727
728 static void IgnoreCallback(uint32, bool) {}
729
730 void PepperPluginInstanceImpl::CommitBackingTexture() { 728 void PepperPluginInstanceImpl::CommitBackingTexture() {
731 if (!texture_layer_.get()) 729 if (!texture_layer_.get())
732 return; 730 return;
733 PlatformContext3D* context = bound_graphics_3d_->platform_context(); 731 PlatformContext3D* context = bound_graphics_3d_->platform_context();
734 gpu::Mailbox mailbox; 732 gpu::Mailbox mailbox;
735 uint32 sync_point = 0; 733 uint32 sync_point = 0;
736 context->GetBackingMailbox(&mailbox, &sync_point); 734 context->GetBackingMailbox(&mailbox, &sync_point);
737 DCHECK(!mailbox.IsZero()); 735 DCHECK(!mailbox.IsZero());
738 DCHECK_NE(sync_point, 0u); 736 DCHECK_NE(sync_point, 0u);
739 texture_layer_->SetTextureMailbox( 737 texture_layer_->SetTextureMailboxWithoutReleaseCallback(
740 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), 738 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point));
741 cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback)));
742 texture_layer_->SetNeedsDisplay(); 739 texture_layer_->SetNeedsDisplay();
743 } 740 }
744 741
745 void PepperPluginInstanceImpl::InstanceCrashed() { 742 void PepperPluginInstanceImpl::InstanceCrashed() {
746 // Force free all resources and vars. 743 // Force free all resources and vars.
747 HostGlobals::Get()->InstanceCrashed(pp_instance()); 744 HostGlobals::Get()->InstanceCrashed(pp_instance());
748 745
749 // Free any associated graphics. 746 // Free any associated graphics.
750 SetFullscreen(false); 747 SetFullscreen(false);
751 FlashSetFullscreen(false, false); 748 FlashSetFullscreen(false, false);
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 fullscreen_container_->SetLayer(NULL); 1953 fullscreen_container_->SetLayer(NULL);
1957 web_layer_.reset(); 1954 web_layer_.reset();
1958 texture_layer_ = NULL; 1955 texture_layer_ = NULL;
1959 } 1956 }
1960 if (want_layer) { 1957 if (want_layer) {
1961 bool opaque = false; 1958 bool opaque = false;
1962 if (want_3d_layer) { 1959 if (want_3d_layer) {
1963 DCHECK(bound_graphics_3d_.get()); 1960 DCHECK(bound_graphics_3d_.get());
1964 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); 1961 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL);
1965 opaque = bound_graphics_3d_->IsOpaque(); 1962 opaque = bound_graphics_3d_->IsOpaque();
1966 texture_layer_->SetTextureMailbox( 1963 texture_layer_->SetTextureMailboxWithoutReleaseCallback(
1967 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), 1964 cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point));
1968 cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback)));
1969 } else { 1965 } else {
1970 DCHECK(bound_graphics_2d_platform_); 1966 DCHECK(bound_graphics_2d_platform_);
1971 texture_layer_ = cc::TextureLayer::CreateForMailbox(this); 1967 texture_layer_ = cc::TextureLayer::CreateForMailbox(this);
1972 bound_graphics_2d_platform_->AttachedToNewLayer(); 1968 bound_graphics_2d_platform_->AttachedToNewLayer();
1973 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); 1969 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque();
1974 texture_layer_->SetFlipped(false); 1970 texture_layer_->SetFlipped(false);
1975 } 1971 }
1976 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_)); 1972 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_));
1977 if (fullscreen_container_) { 1973 if (fullscreen_container_) {
1978 fullscreen_container_->SetLayer(web_layer_.get()); 1974 fullscreen_container_->SetLayer(web_layer_.get());
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 // Running out-of-process. Initiate an IPC call to notify the plugin 3140 // Running out-of-process. Initiate an IPC call to notify the plugin
3145 // process. 3141 // process.
3146 ppapi::proxy::HostDispatcher* dispatcher = 3142 ppapi::proxy::HostDispatcher* dispatcher =
3147 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3143 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3148 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3144 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3149 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3145 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3150 } 3146 }
3151 } 3147 }
3152 3148
3153 } // namespace content 3149 } // namespace content
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698