diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 19:58:23 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 19:58:23 +0000 |
commit | ee0dc4f2b31dc1b4f9c555afe36c648d77217c93 (patch) | |
tree | 86484f2556f5875dbc104836eac76aaa55c8d203 /webkit | |
parent | 1d01ed634bd4a4e3c15d89931aad1bfc62e0b6cd (diff) | |
download | chromium_src-ee0dc4f2b31dc1b4f9c555afe36c648d77217c93.zip chromium_src-ee0dc4f2b31dc1b4f9c555afe36c648d77217c93.tar.gz chromium_src-ee0dc4f2b31dc1b4f9c555afe36c648d77217c93.tar.bz2 |
Revert "Add some optimizations to plugin painting."
This reverts commit 60329.
TBR=brettw
BUG=
TEST=
Review URL: http://codereview.chromium.org/3442013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/pepper_graphics_2d.cc | 18 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_graphics_2d.h | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_delegate.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.cc | 24 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.h | 14 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_module.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_private2.cc | 32 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_private2.h | 23 | ||||
-rw-r--r-- | webkit/glue/plugins/ppb_private2.h | 21 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 |
11 files changed, 3 insertions, 149 deletions
diff --git a/webkit/glue/plugins/pepper_graphics_2d.cc b/webkit/glue/plugins/pepper_graphics_2d.cc index 5011f87..049c17d 100644 --- a/webkit/glue/plugins/pepper_graphics_2d.cc +++ b/webkit/glue/plugins/pepper_graphics_2d.cc @@ -174,8 +174,7 @@ Graphics2D::Graphics2D(PluginModule* module) : Resource(module), bound_instance_(NULL), flushed_any_data_(false), - offscreen_flush_pending_(false), - is_always_opaque_(false) { + offscreen_flush_pending_(false) { } Graphics2D::~Graphics2D() { @@ -194,7 +193,7 @@ bool Graphics2D::Init(int width, int height, bool is_always_opaque) { image_data_ = NULL; return false; } - is_always_opaque_ = is_always_opaque; + return true; } @@ -446,24 +445,13 @@ void Graphics2D::Paint(WebKit::WebCanvas* canvas, bounds.size.width = backing_bitmap.width(); bounds.size.height = backing_bitmap.height(); - // TODO(brettw) bug 56673: do a direct memcpy instead of going through CG - // if the is_always_opaque_ flag is set. - CGContextDrawImage(canvas, bounds, image); CGContextRestoreGState(canvas); #else - SkPaint paint; - if (is_always_opaque_) { - // When we know the device is opaque, we can disable blending for slightly - // more optimized painting. - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - } - gfx::Point origin(plugin_rect.origin().x(), plugin_rect.origin().y()); canvas->drawBitmap(backing_bitmap, SkIntToScalar(plugin_rect.origin().x()), - SkIntToScalar(plugin_rect.origin().y()), - &paint); + SkIntToScalar(plugin_rect.origin().y())); #endif } diff --git a/webkit/glue/plugins/pepper_graphics_2d.h b/webkit/glue/plugins/pepper_graphics_2d.h index 3af84ded..c3fad68 100644 --- a/webkit/glue/plugins/pepper_graphics_2d.h +++ b/webkit/glue/plugins/pepper_graphics_2d.h @@ -36,8 +36,6 @@ class Graphics2D : public Resource { bool Init(int width, int height, bool is_always_opaque); - bool is_always_opaque() const { return is_always_opaque_; } - // Resource override. virtual Graphics2D* AsGraphics2D() { return this; } @@ -168,10 +166,6 @@ class Graphics2D : public Resource { // enforce the "only one pending flush at a time" constraint in the API. bool offscreen_flush_pending_; - // Set to true if the plugin declares that this device will always be opaque. - // This allows us to do more optimized painting in some cases. - bool is_always_opaque_; - DISALLOW_COPY_AND_ASSIGN(Graphics2D); }; diff --git a/webkit/glue/plugins/pepper_image_data.h b/webkit/glue/plugins/pepper_image_data.h index 04d769c..c5937b2 100644 --- a/webkit/glue/plugins/pepper_image_data.h +++ b/webkit/glue/plugins/pepper_image_data.h @@ -37,10 +37,6 @@ class ImageData : public Resource { // invalid or not mapped. See ImageDataAutoMapper below. bool is_mapped() const { return !!mapped_canvas_.get(); } - PluginDelegate::PlatformImage2D* platform_image() const { - return platform_image_.get(); - } - // Returns a pointer to the interface implementing PPB_ImageData that is // exposed to the plugin. static const PPB_ImageData* GetInterface(); diff --git a/webkit/glue/plugins/pepper_plugin_delegate.h b/webkit/glue/plugins/pepper_plugin_delegate.h index 3bd8897..d650fa9 100644 --- a/webkit/glue/plugins/pepper_plugin_delegate.h +++ b/webkit/glue/plugins/pepper_plugin_delegate.h @@ -44,8 +44,6 @@ struct PP_VideoCompressedDataBuffer_Dev; struct PP_VideoDecoderConfig_Dev; struct PP_VideoUncompressedDataBuffer_Dev; -class TransportDIB; - namespace pepper { class FileIO; @@ -69,8 +67,6 @@ class PluginDelegate { // this image. This is used by NativeClient to send the image to the // out-of-process plugin. Returns 0 on failure. virtual intptr_t GetSharedMemoryHandle() const = 0; - - virtual TransportDIB* GetTransportDIB() const = 0; }; class PlatformContext3D { diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index ae0cdcc..b246872 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -247,7 +247,6 @@ PluginInstance::PluginInstance(PluginDelegate* delegate, #endif // defined (OS_LINUX) plugin_print_interface_(NULL), plugin_graphics_3d_interface_(NULL), - always_on_top_(false), fullscreen_container_(NULL) { memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); DCHECK(delegate); @@ -501,29 +500,6 @@ void PluginInstance::ViewFlushedPaint() { bound_graphics_2d_->ViewFlushedPaint(); } -bool PluginInstance::GetBitmapForOptimizedPluginPaint(gfx::Rect* bounds, - TransportDIB** dib) { - if (!always_on_top_) - return false; - if (!bound_graphics_2d_ || !bound_graphics_2d_->is_always_opaque()) - return false; - - // We specifically want to compare against the area covered by the backing - // store when seeing if we cover the given paint bounds, since the backing - // store could be smaller than the declared plugin area. - ImageData* image_data = bound_graphics_2d_->image_data(); - gfx::Rect plugin_backing_store_rect(position_.origin(), - gfx::Size(image_data->width(), - image_data->height())); - if (!plugin_backing_store_rect.Contains(*bounds)) - return false; - - // TODO(brettw) implement detection for always-on-top. - *bounds = plugin_backing_store_rect; - *dib = image_data->platform_image()->GetTransportDIB(); - return true; -} - string16 PluginInstance::GetSelectedText(bool html) { PP_Var rv = instance_interface_->GetSelectedText(GetPPInstance(), html); scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h index 8837193..0ed6ee6 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.h +++ b/webkit/glue/plugins/pepper_plugin_instance.h @@ -30,7 +30,6 @@ struct PPP_Instance; struct PPP_Zoom_Dev; class SkBitmap; -class TransportDIB; namespace gfx { class Rect; @@ -78,8 +77,6 @@ class PluginInstance : public base::RefCounted<PluginInstance> { int find_identifier() const { return find_identifier_; } - void set_always_on_top(bool on_top) { always_on_top_ = on_top; } - PP_Instance GetPPInstance(); // Paints the current backing store to the web page. @@ -120,13 +117,6 @@ class PluginInstance : public base::RefCounted<PluginInstance> { void ViewInitiatedPaint(); void ViewFlushedPaint(); - // If this plugin can be painted merely by copying the backing store to the - // screen, and the plugin bounds encloses the given paint bounds, returns - // true. In this case, the bounds will be updated to enclose the area covering - // the backing store of the plugin, and the ID of the backing store will be - // placed in |*dib|. - bool GetBitmapForOptimizedPluginPaint(gfx::Rect* bounds, TransportDIB** dib); - string16 GetSelectedText(bool html); void Zoom(float factor, bool text_only); bool StartFind(const string16& search_text, @@ -228,10 +218,6 @@ class PluginInstance : public base::RefCounted<PluginInstance> { // Containes the cursor if it's set by the plugin. scoped_ptr<WebKit::WebCursorInfo> cursor_; - // Set to true if this plugin thinks it will always be on top. This allows us - // to use a more optimized painting path in some cases. - bool always_on_top_; - // Plugin container for fullscreen mode. NULL if not in fullscreen mode. FullscreenContainer* fullscreen_container_; diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc index e43735f..7acf06239 100644 --- a/webkit/glue/plugins/pepper_plugin_module.cc +++ b/webkit/glue/plugins/pepper_plugin_module.cc @@ -59,7 +59,6 @@ #include "webkit/glue/plugins/pepper_plugin_instance.h" #include "webkit/glue/plugins/pepper_plugin_object.h" #include "webkit/glue/plugins/pepper_private.h" -#include "webkit/glue/plugins/pepper_private2.h" #include "webkit/glue/plugins/pepper_resource_tracker.h" #include "webkit/glue/plugins/pepper_scrollbar.h" #include "webkit/glue/plugins/pepper_transport.h" @@ -71,7 +70,6 @@ #include "webkit/glue/plugins/pepper_video_decoder.h" #include "webkit/glue/plugins/pepper_widget.h" #include "webkit/glue/plugins/ppb_private.h" -#include "webkit/glue/plugins/ppb_private2.h" #ifdef ENABLE_GPU #include "webkit/glue/plugins/pepper_graphics_3d.h" @@ -259,8 +257,6 @@ const void* GetInterface(const char* name) { return UrlUtil::GetInterface(); if (strcmp(name, PPB_PRIVATE_INTERFACE) == 0) return Private::GetInterface(); - if (strcmp(name, PPB_PRIVATE2_INTERFACE) == 0) - return Private2::GetInterface(); if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0) return FileChooser::GetInterface(); if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0) diff --git a/webkit/glue/plugins/pepper_private2.cc b/webkit/glue/plugins/pepper_private2.cc deleted file mode 100644 index 9a740aa..0000000 --- a/webkit/glue/plugins/pepper_private2.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/glue/plugins/pepper_private2.h" - -#include "webkit/glue/plugins/pepper_plugin_instance.h" -#include "webkit/glue/plugins/ppb_private2.h" - -namespace pepper { - -namespace { - -void SetInstanceAlwaysOnTop(PP_Instance pp_instance, bool on_top) { - PluginInstance* instance = PluginInstance::FromPPInstance(pp_instance); - if (!instance) - return; - instance->set_always_on_top(on_top); -} - -const PPB_Private2 ppb_private2 = { - &SetInstanceAlwaysOnTop -}; - -} // namespace - -// static -const PPB_Private2* Private2::GetInterface() { - return &ppb_private2; -} - -} // namespace pepper diff --git a/webkit/glue/plugins/pepper_private2.h b/webkit/glue/plugins/pepper_private2.h deleted file mode 100644 index 492669a..0000000 --- a/webkit/glue/plugins/pepper_private2.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE2_H_ -#define WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE2_H_ - -#include "webkit/glue/plugins/pepper_resource.h" - -struct PPB_Private2; - -namespace pepper { - -class Private2 { - public: - // Returns a pointer to the interface implementing PPB_Private2 that is - // exposed to the plugin. - static const PPB_Private2* GetInterface(); -}; - -} // namespace pepper - -#endif // WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE2_H_ diff --git a/webkit/glue/plugins/ppb_private2.h b/webkit/glue/plugins/ppb_private2.h deleted file mode 100644 index ca45471..0000000 --- a/webkit/glue/plugins/ppb_private2.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE2_H_ -#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE2_H_ - -#include "third_party/ppapi/c/pp_instance.h" -#include "third_party/ppapi/c/pp_module.h" -#include "third_party/ppapi/c/pp_var.h" - -#define PPB_PRIVATE2_INTERFACE "PPB_Private2;1" - -struct PPB_Private2 { - // Sets or clears the rendering hint that the given plugin instance is always - // on top of page content. Somewhat more optimized painting can be used in - // this case. - void (*SetInstanceAlwaysOnTop)(PP_Instance instance, bool on_top); -}; - -#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE2_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 354b2d0..e27f297 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -222,8 +222,6 @@ 'plugins/pepper_plugin_object.h', 'plugins/pepper_private.cc', 'plugins/pepper_private.h', - 'plugins/pepper_private2.cc', - 'plugins/pepper_private2.h', 'plugins/pepper_resource_tracker.cc', 'plugins/pepper_resource_tracker.h', 'plugins/pepper_resource.cc', |