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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.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
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/ppapi_webplugin_impl.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 (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/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 for (PluginObjectSet::iterator i = plugin_object_copy.begin(); 474 for (PluginObjectSet::iterator i = plugin_object_copy.begin();
475 i != plugin_object_copy.end(); ++i) 475 i != plugin_object_copy.end(); ++i)
476 delete *i; 476 delete *i;
477 477
478 if (TrackedCallback::IsPending(lock_mouse_callback_)) 478 if (TrackedCallback::IsPending(lock_mouse_callback_))
479 lock_mouse_callback_->Abort(); 479 lock_mouse_callback_->Abort();
480 480
481 delegate_->InstanceDeleted(this); 481 delegate_->InstanceDeleted(this);
482 module_->InstanceDeleted(this); 482 module_->InstanceDeleted(this);
483 // If we switched from the NaCl plugin module, notify it too. 483 // If we switched from the NaCl plugin module, notify it too.
484 if (original_module_) 484 if (original_module_.get())
485 original_module_->InstanceDeleted(this); 485 original_module_->InstanceDeleted(this);
486 486
487 // This should be last since some of the above "instance deleted" calls will 487 // This should be last since some of the above "instance deleted" calls will
488 // want to look up in the global map to get info off of our object. 488 // want to look up in the global map to get info off of our object.
489 HostGlobals::Get()->InstanceDeleted(pp_instance_); 489 HostGlobals::Get()->InstanceDeleted(pp_instance_);
490 } 490 }
491 491
492 // NOTE: Any of these methods that calls into the plugin needs to take into 492 // NOTE: Any of these methods that calls into the plugin needs to take into
493 // account that the plugin may use Var to remove the <embed> from the DOM, which 493 // account that the plugin may use Var to remove the <embed> from the DOM, which
494 // will make the WebPluginImpl drop its reference, usually the last one. If a 494 // will make the WebPluginImpl drop its reference, usually the last one. If a
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } else { 567 } else {
568 // Can't do optimized scrolling since there could be other elements on top 568 // Can't do optimized scrolling since there could be other elements on top
569 // of us or the view renders via the accelerated compositor which is 569 // of us or the view renders via the accelerated compositor which is
570 // incompatible with the move and backfill scrolling model. 570 // incompatible with the move and backfill scrolling model.
571 InvalidateRect(rect); 571 InvalidateRect(rect);
572 } 572 }
573 } 573 }
574 } 574 }
575 575
576 unsigned PluginInstance::GetBackingTextureId() { 576 unsigned PluginInstance::GetBackingTextureId() {
577 if (bound_graphics_3d_) 577 if (bound_graphics_3d_.get())
578 return bound_graphics_3d_->GetBackingTextureId(); 578 return bound_graphics_3d_->GetBackingTextureId();
579 579
580 return 0; 580 return 0;
581 } 581 }
582 582
583 void PluginInstance::CommitBackingTexture() { 583 void PluginInstance::CommitBackingTexture() {
584 if (texture_layer_) 584 if (texture_layer_.get())
585 texture_layer_->SetNeedsDisplay(); 585 texture_layer_->SetNeedsDisplay();
586 } 586 }
587 587
588 void PluginInstance::InstanceCrashed() { 588 void PluginInstance::InstanceCrashed() {
589 // Force free all resources and vars. 589 // Force free all resources and vars.
590 HostGlobals::Get()->InstanceCrashed(pp_instance()); 590 HostGlobals::Get()->InstanceCrashed(pp_instance());
591 591
592 // Free any associated graphics. 592 // Free any associated graphics.
593 SetFullscreen(false); 593 SetFullscreen(false);
594 FlashSetFullscreen(false, false); 594 FlashSetFullscreen(false, false);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // immediately. It is possible that PluginInstance::ViewChanged() hasn't been 988 // immediately. It is possible that PluginInstance::ViewChanged() hasn't been
989 // called for the first time. In that case, most of the fields in |view_data_| 989 // called for the first time. In that case, most of the fields in |view_data_|
990 // haven't been properly initialized. 990 // haven't been properly initialized.
991 if (sent_initial_did_change_view_) 991 if (sent_initial_did_change_view_)
992 SendDidChangeView(); 992 SendDidChangeView();
993 } 993 }
994 994
995 void PluginInstance::ViewWillInitiatePaint() { 995 void PluginInstance::ViewWillInitiatePaint() {
996 if (GetBoundGraphics2D()) 996 if (GetBoundGraphics2D())
997 GetBoundGraphics2D()->ViewWillInitiatePaint(); 997 GetBoundGraphics2D()->ViewWillInitiatePaint();
998 else if (bound_graphics_3d_) 998 else if (bound_graphics_3d_.get())
999 bound_graphics_3d_->ViewWillInitiatePaint(); 999 bound_graphics_3d_->ViewWillInitiatePaint();
1000 } 1000 }
1001 1001
1002 void PluginInstance::ViewInitiatedPaint() { 1002 void PluginInstance::ViewInitiatedPaint() {
1003 if (GetBoundGraphics2D()) 1003 if (GetBoundGraphics2D())
1004 GetBoundGraphics2D()->ViewInitiatedPaint(); 1004 GetBoundGraphics2D()->ViewInitiatedPaint();
1005 else if (bound_graphics_3d_) 1005 else if (bound_graphics_3d_.get())
1006 bound_graphics_3d_->ViewInitiatedPaint(); 1006 bound_graphics_3d_->ViewInitiatedPaint();
1007 } 1007 }
1008 1008
1009 void PluginInstance::ViewFlushedPaint() { 1009 void PluginInstance::ViewFlushedPaint() {
1010 // Keep a reference on the stack. See NOTE above. 1010 // Keep a reference on the stack. See NOTE above.
1011 scoped_refptr<PluginInstance> ref(this); 1011 scoped_refptr<PluginInstance> ref(this);
1012 if (GetBoundGraphics2D()) 1012 if (GetBoundGraphics2D())
1013 GetBoundGraphics2D()->ViewFlushedPaint(); 1013 GetBoundGraphics2D()->ViewFlushedPaint();
1014 else if (bound_graphics_3d_) 1014 else if (bound_graphics_3d_.get())
1015 bound_graphics_3d_->ViewFlushedPaint(); 1015 bound_graphics_3d_->ViewFlushedPaint();
1016 } 1016 }
1017 1017
1018 bool PluginInstance::GetBitmapForOptimizedPluginPaint( 1018 bool PluginInstance::GetBitmapForOptimizedPluginPaint(
1019 const gfx::Rect& paint_bounds, 1019 const gfx::Rect& paint_bounds,
1020 TransportDIB** dib, 1020 TransportDIB** dib,
1021 gfx::Rect* location, 1021 gfx::Rect* location,
1022 gfx::Rect* clip, 1022 gfx::Rect* clip,
1023 float* scale_factor) { 1023 float* scale_factor) {
1024 if (!always_on_top_) 1024 if (!always_on_top_)
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 void PluginInstance::UpdateLayer() { 1784 void PluginInstance::UpdateLayer() {
1785 if (!container_) 1785 if (!container_)
1786 return; 1786 return;
1787 1787
1788 bool want_layer = GetBackingTextureId(); 1788 bool want_layer = GetBackingTextureId();
1789 1789
1790 if (want_layer == !!texture_layer_.get() && 1790 if (want_layer == !!texture_layer_.get() &&
1791 layer_bound_to_fullscreen_ == !!fullscreen_container_) 1791 layer_bound_to_fullscreen_ == !!fullscreen_container_)
1792 return; 1792 return;
1793 1793
1794 if (texture_layer_) { 1794 if (texture_layer_.get()) {
1795 texture_layer_->ClearClient(); 1795 texture_layer_->ClearClient();
1796 if (!layer_bound_to_fullscreen_) 1796 if (!layer_bound_to_fullscreen_)
1797 container_->setWebLayer(NULL); 1797 container_->setWebLayer(NULL);
1798 else if (fullscreen_container_) 1798 else if (fullscreen_container_)
1799 fullscreen_container_->SetLayer(NULL); 1799 fullscreen_container_->SetLayer(NULL);
1800 web_layer_.reset(); 1800 web_layer_.reset();
1801 texture_layer_ = NULL; 1801 texture_layer_ = NULL;
1802 } 1802 }
1803 if (want_layer) { 1803 if (want_layer) {
1804 DCHECK(bound_graphics_3d_.get()); 1804 DCHECK(bound_graphics_3d_.get());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 new ContentDecryptorDelegate(pp_instance_, plugin_decryption_interface)); 1950 new ContentDecryptorDelegate(pp_instance_, plugin_decryption_interface));
1951 return content_decryptor_delegate_.get(); 1951 return content_decryptor_delegate_.get();
1952 } 1952 }
1953 1953
1954 PP_Bool PluginInstance::BindGraphics(PP_Instance instance, 1954 PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
1955 PP_Resource device) { 1955 PP_Resource device) {
1956 TRACE_EVENT0("ppapi", "PluginInstance::BindGraphics"); 1956 TRACE_EVENT0("ppapi", "PluginInstance::BindGraphics");
1957 // The Graphics3D instance can't be destroyed until we call 1957 // The Graphics3D instance can't be destroyed until we call
1958 // UpdateLayer(). 1958 // UpdateLayer().
1959 scoped_refptr< ::ppapi::Resource> old_graphics = bound_graphics_3d_.get(); 1959 scoped_refptr< ::ppapi::Resource> old_graphics = bound_graphics_3d_.get();
1960 if (bound_graphics_3d_) { 1960 if (bound_graphics_3d_.get()) {
1961 bound_graphics_3d_->BindToInstance(false); 1961 bound_graphics_3d_->BindToInstance(false);
1962 bound_graphics_3d_ = NULL; 1962 bound_graphics_3d_ = NULL;
1963 } 1963 }
1964 if (bound_graphics_2d_platform_) { 1964 if (bound_graphics_2d_platform_) {
1965 GetBoundGraphics2D()->BindToInstance(NULL); 1965 GetBoundGraphics2D()->BindToInstance(NULL);
1966 bound_graphics_2d_platform_ = NULL; 1966 bound_graphics_2d_platform_ = NULL;
1967 } 1967 }
1968 1968
1969 // Special-case clearing the current device. 1969 // Special-case clearing the current device.
1970 if (!device) { 1970 if (!device) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 case ::ppapi::EXTENSIONS_COMMON_SINGLETON_ID: 2232 case ::ppapi::EXTENSIONS_COMMON_SINGLETON_ID:
2233 case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID: 2233 case ::ppapi::FLASH_CLIPBOARD_SINGLETON_ID:
2234 case ::ppapi::FLASH_FILE_SINGLETON_ID: 2234 case ::ppapi::FLASH_FILE_SINGLETON_ID:
2235 case ::ppapi::FLASH_FULLSCREEN_SINGLETON_ID: 2235 case ::ppapi::FLASH_FULLSCREEN_SINGLETON_ID:
2236 case ::ppapi::FLASH_SINGLETON_ID: 2236 case ::ppapi::FLASH_SINGLETON_ID:
2237 case ::ppapi::PDF_SINGLETON_ID: 2237 case ::ppapi::PDF_SINGLETON_ID:
2238 case ::ppapi::TRUETYPE_FONT_SINGLETON_ID: 2238 case ::ppapi::TRUETYPE_FONT_SINGLETON_ID:
2239 NOTIMPLEMENTED(); 2239 NOTIMPLEMENTED();
2240 return NULL; 2240 return NULL;
2241 case ::ppapi::GAMEPAD_SINGLETON_ID: 2241 case ::ppapi::GAMEPAD_SINGLETON_ID:
2242 return gamepad_impl_; 2242 return gamepad_impl_.get();
2243 } 2243 }
2244 2244
2245 NOTREACHED(); 2245 NOTREACHED();
2246 return NULL; 2246 return NULL;
2247 } 2247 }
2248 2248
2249 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, 2249 int32_t PluginInstance::RequestInputEvents(PP_Instance instance,
2250 uint32_t event_classes) { 2250 uint32_t event_classes) {
2251 input_event_mask_ |= event_classes; 2251 input_event_mask_ |= event_classes;
2252 filtered_input_event_mask_ &= ~(event_classes); 2252 filtered_input_event_mask_ &= ~(event_classes);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2613 screen_size_for_fullscreen_ = gfx::Size(); 2613 screen_size_for_fullscreen_ = gfx::Size();
2614 WebElement element = container_->element(); 2614 WebElement element = container_->element();
2615 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2615 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2616 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2616 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2617 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2617 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2618 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2618 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2619 } 2619 }
2620 2620
2621 } // namespace ppapi 2621 } // namespace ppapi
2622 } // namespace webkit 2622 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/ppapi_webplugin_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698