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

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

Issue 195623004: Merge 254840 "ppapi: Send sync point whenever the pepper texture..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: 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
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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 container_->scrollRect(dx, dy, rect); 693 container_->scrollRect(dx, dy, rect);
694 } else { 694 } else {
695 // Can't do optimized scrolling since there could be other elements on top 695 // Can't do optimized scrolling since there could be other elements on top
696 // of us or the view renders via the accelerated compositor which is 696 // of us or the view renders via the accelerated compositor which is
697 // incompatible with the move and backfill scrolling model. 697 // incompatible with the move and backfill scrolling model.
698 InvalidateRect(rect); 698 InvalidateRect(rect);
699 } 699 }
700 } 700 }
701 } 701 }
702 702
703 static void IgnoreCallback(unsigned, bool) {}
704
703 void PepperPluginInstanceImpl::CommitBackingTexture() { 705 void PepperPluginInstanceImpl::CommitBackingTexture() {
704 if (texture_layer_.get()) 706 if (!texture_layer_.get())
705 texture_layer_->SetNeedsDisplay(); 707 return;
708 PlatformContext3D* context = bound_graphics_3d_->platform_context();
709 gpu::Mailbox mailbox;
710 uint32 sync_point = 0;
711 context->GetBackingMailbox(&mailbox, &sync_point);
712 DCHECK(!mailbox.IsZero());
713 DCHECK_NE(sync_point, 0u);
714 texture_layer_->SetTextureMailbox(
715 cc::TextureMailbox(mailbox, sync_point),
716 cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback)));
717 texture_layer_->SetNeedsDisplay();
706 } 718 }
707 719
708 void PepperPluginInstanceImpl::InstanceCrashed() { 720 void PepperPluginInstanceImpl::InstanceCrashed() {
709 // Force free all resources and vars. 721 // Force free all resources and vars.
710 HostGlobals::Get()->InstanceCrashed(pp_instance()); 722 HostGlobals::Get()->InstanceCrashed(pp_instance());
711 723
712 // Free any associated graphics. 724 // Free any associated graphics.
713 SetFullscreen(false); 725 SetFullscreen(false);
714 FlashSetFullscreen(false, false); 726 FlashSetFullscreen(false, false);
715 // Unbind current 2D or 3D graphics context. 727 // Unbind current 2D or 3D graphics context.
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 skia::EndPlatformPaint(canvas); 1862 skia::EndPlatformPaint(canvas);
1851 } 1863 }
1852 #endif // defined(OS_WIN) 1864 #endif // defined(OS_WIN)
1853 1865
1854 return ret; 1866 return ret;
1855 #else // defined(ENABLE_FULL_PRINTING) 1867 #else // defined(ENABLE_FULL_PRINTING)
1856 return false; 1868 return false;
1857 #endif 1869 #endif
1858 } 1870 }
1859 1871
1860 static void IgnoreCallback(unsigned, bool) {}
1861
1862 void PepperPluginInstanceImpl::UpdateLayer() { 1872 void PepperPluginInstanceImpl::UpdateLayer() {
1863 if (!container_) 1873 if (!container_)
1864 return; 1874 return;
1865 1875
1866 gpu::Mailbox mailbox; 1876 gpu::Mailbox mailbox;
1877 uint32 sync_point = 0;
1867 if (bound_graphics_3d_.get()) { 1878 if (bound_graphics_3d_.get()) {
1868 PlatformContext3D* context = bound_graphics_3d_->platform_context(); 1879 PlatformContext3D* context = bound_graphics_3d_->platform_context();
1869 context->GetBackingMailbox(&mailbox); 1880 context->GetBackingMailbox(&mailbox, &sync_point);
1881 DCHECK_EQ(mailbox.IsZero(), sync_point == 0);
1870 } 1882 }
1871 bool want_3d_layer = !mailbox.IsZero(); 1883 bool want_3d_layer = !mailbox.IsZero();
1872 bool want_2d_layer = bound_graphics_2d_platform_ && 1884 bool want_2d_layer = bound_graphics_2d_platform_ &&
1873 CommandLine::ForCurrentProcess()->HasSwitch( 1885 CommandLine::ForCurrentProcess()->HasSwitch(
1874 switches::kEnableSoftwareCompositing); 1886 switches::kEnableSoftwareCompositing);
1875 bool want_layer = want_3d_layer || want_2d_layer; 1887 bool want_layer = want_3d_layer || want_2d_layer;
1876 1888
1877 if ((want_layer == !!texture_layer_.get()) && 1889 if ((want_layer == !!texture_layer_.get()) &&
1878 (want_3d_layer == layer_is_hardware_) && 1890 (want_3d_layer == layer_is_hardware_) &&
1879 layer_bound_to_fullscreen_ == !!fullscreen_container_) { 1891 layer_bound_to_fullscreen_ == !!fullscreen_container_) {
1880 return; 1892 return;
1881 } 1893 }
1882 1894
1883 if (texture_layer_) { 1895 if (texture_layer_) {
1884 if (!layer_bound_to_fullscreen_) 1896 if (!layer_bound_to_fullscreen_)
1885 container_->setWebLayer(NULL); 1897 container_->setWebLayer(NULL);
1886 else if (fullscreen_container_) 1898 else if (fullscreen_container_)
1887 fullscreen_container_->SetLayer(NULL); 1899 fullscreen_container_->SetLayer(NULL);
1888 web_layer_.reset(); 1900 web_layer_.reset();
1889 texture_layer_ = NULL; 1901 texture_layer_ = NULL;
1890 } 1902 }
1891 if (want_layer) { 1903 if (want_layer) {
1892 bool opaque = false; 1904 bool opaque = false;
1893 if (want_3d_layer) { 1905 if (want_3d_layer) {
1894 DCHECK(bound_graphics_3d_.get()); 1906 DCHECK(bound_graphics_3d_.get());
1895 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); 1907 texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL);
1896 opaque = bound_graphics_3d_->IsOpaque(); 1908 opaque = bound_graphics_3d_->IsOpaque();
1897 texture_layer_->SetTextureMailbox( 1909 texture_layer_->SetTextureMailbox(
1898 cc::TextureMailbox(mailbox, 0), 1910 cc::TextureMailbox(mailbox, sync_point),
1899 cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback))); 1911 cc::SingleReleaseCallback::Create(base::Bind(&IgnoreCallback)));
1900 } else { 1912 } else {
1901 DCHECK(bound_graphics_2d_platform_); 1913 DCHECK(bound_graphics_2d_platform_);
1902 texture_layer_ = cc::TextureLayer::CreateForMailbox(this); 1914 texture_layer_ = cc::TextureLayer::CreateForMailbox(this);
1903 bound_graphics_2d_platform_->AttachedToNewLayer(); 1915 bound_graphics_2d_platform_->AttachedToNewLayer();
1904 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); 1916 opaque = bound_graphics_2d_platform_->IsAlwaysOpaque();
1905 texture_layer_->SetFlipped(false); 1917 texture_layer_->SetFlipped(false);
1906 } 1918 }
1907 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_)); 1919 web_layer_.reset(new webkit::WebLayerImpl(texture_layer_));
1908 if (fullscreen_container_) { 1920 if (fullscreen_container_) {
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 // Running out-of-process. Initiate an IPC call to notify the plugin 3047 // Running out-of-process. Initiate an IPC call to notify the plugin
3036 // process. 3048 // process.
3037 ppapi::proxy::HostDispatcher* dispatcher = 3049 ppapi::proxy::HostDispatcher* dispatcher =
3038 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3050 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3039 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3051 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3040 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3052 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3041 } 3053 }
3042 } 3054 }
3043 3055
3044 } // namespace content 3056 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_context_3d.cc ('k') | content/renderer/pepper/ppb_graphics_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698