summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 18:53:12 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 18:53:12 +0000
commit3014c2191c848afd47e9528deea70e54708ea0aa (patch)
tree5da8b7cd925146acc6ebb97d88952378e4dea567 /chrome
parentbaedfdf14e911a4e9a3fbf36cd726e065bd08673 (diff)
downloadchromium_src-3014c2191c848afd47e9528deea70e54708ea0aa.zip
chromium_src-3014c2191c848afd47e9528deea70e54708ea0aa.tar.gz
chromium_src-3014c2191c848afd47e9528deea70e54708ea0aa.tar.bz2
Add some Linux make and scons files to the svn:ignore properties.
TEST=none BUG=none R=thomasvl git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc38
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.h11
-rwxr-xr-xchrome/renderer/render_view.cc34
-rw-r--r--chrome/renderer/render_view.h6
-rw-r--r--chrome/test/ui/ppapi_uitest.cc2
5 files changed, 75 insertions, 16 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index 535dff1..b2a4931 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -6,6 +6,7 @@
#include "app/surface/transport_dib.h"
#include "base/scoped_ptr.h"
+#include "webkit/glue/plugins/pepper_plugin_instance.h"
#if defined(OS_MACOSX)
#include "chrome/common/render_messages.h"
@@ -46,6 +47,43 @@ PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderView* render_view)
: render_view_(render_view) {
}
+void PepperPluginDelegateImpl::ViewInitiatedPaint() {
+ // Notify all of our instances that we started painting. This is used for
+ // internal bookkeeping only, so we know that the set can not change under
+ // us.
+ for (std::set<pepper::PluginInstance*>::iterator i =
+ active_instances_.begin();
+ i != active_instances_.end(); ++i)
+ (*i)->ViewInitiatedPaint();
+}
+
+void PepperPluginDelegateImpl::ViewFlushedPaint() {
+ // Notify all instances that we painted. This will call into the plugin, and
+ // we it may ask to close itself as a result. This will, in turn, modify our
+ // set, possibly invalidating the iterator. So we iterate on a copy that
+ // won't change out from under us.
+ std::set<pepper::PluginInstance*> plugins = active_instances_;
+ for (std::set<pepper::PluginInstance*>::iterator i = plugins.begin();
+ i != plugins.end(); ++i) {
+ // The copy above makes sure our iterator is never invalid if some plugins
+ // are destroyed. But some plugin may decide to close all of its views in
+ // response to a paint in one of them, so we need to make sure each one is
+ // still "current" before using it.
+ if (active_instances_.find(*i) != active_instances_.end())
+ (*i)->ViewFlushedPaint();
+ }
+}
+
+void PepperPluginDelegateImpl::InstanceCreated(
+ pepper::PluginInstance* instance) {
+ active_instances_.insert(instance);
+}
+
+void PepperPluginDelegateImpl::InstanceDeleted(
+ pepper::PluginInstance* instance) {
+ active_instances_.erase(instance);
+}
+
pepper::PluginDelegate::PlatformImage2D*
PepperPluginDelegateImpl::CreateImage2D(int width, int height) {
uint32 buffer_size = width * height * 4;
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h
index 870a032..058a79c 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.h
+++ b/chrome/renderer/pepper_plugin_delegate_impl.h
@@ -5,6 +5,8 @@
#ifndef CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
#define CHROME_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
+#include <set>
+
#include "base/basictypes.h"
#include "base/weak_ptr.h"
#include "webkit/glue/plugins/pepper_plugin_delegate.h"
@@ -17,13 +19,22 @@ class PepperPluginDelegateImpl
public:
explicit PepperPluginDelegateImpl(RenderView* render_view);
+ // Called by RenderView to tell us about painting events, these two functions
+ // just correspond to the DidInitiatePaint and DidFlushPaint in R.V..
+ void ViewInitiatedPaint();
+ void ViewFlushedPaint();
+
// pepper::PluginDelegate implementation.
+ virtual void InstanceCreated(pepper::PluginInstance* instance);
+ virtual void InstanceDeleted(pepper::PluginInstance* instance);
virtual PlatformImage2D* CreateImage2D(int width, int height);
private:
// Pointer to the RenderView that owns us.
RenderView* render_view_;
+ std::set<pepper::PluginInstance*> active_instances_;
+
DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl);
};
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 29f0f1a..77ab1f9 100755
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -3266,7 +3266,7 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate(
if (use_pepper_host) {
WebPluginDelegatePepper* pepper_plugin =
WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr());
- current_pepper_plugins_.insert(pepper_plugin);
+ current_oldstyle_pepper_plugins_.insert(pepper_plugin);
return pepper_plugin;
} else {
#if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac.
@@ -3779,12 +3779,12 @@ void RenderView::InsertCSS(const std::wstring& frame_xpath,
void RenderView::OnPepperPluginDestroy(
WebPluginDelegatePepper* pepper_plugin) {
std::set<WebPluginDelegatePepper*>::iterator found_pepper =
- current_pepper_plugins_.find(pepper_plugin);
- if (found_pepper == current_pepper_plugins_.end()) {
+ current_oldstyle_pepper_plugins_.find(pepper_plugin);
+ if (found_pepper == current_oldstyle_pepper_plugins_.end()) {
NOTREACHED();
return;
}
- current_pepper_plugins_.erase(found_pepper);
+ current_oldstyle_pepper_plugins_.erase(found_pepper);
// The plugin could have been destroyed while it was waiting for a file
// choose callback, so check all pending completion callbacks and NULL them.
@@ -4280,12 +4280,15 @@ void RenderView::OnResize(const gfx::Size& new_size,
}
void RenderView::DidInitiatePaint() {
- // Notify any pepper plugins that we started painting. The plugin "should"
- // never notified that we started painting, this is used for internal
- // bookkeeping only, so we know that the set can not change under us.
+ // Notify the pepper plugins that we started painting.
+ pepper_delegate_.ViewInitiatedPaint();
+
+ // Notify any "old-style" pepper plugins that we started painting. This is
+ // used for internal bookkeeping only, so we know that the set can not change
+ // under us.
for (std::set<WebPluginDelegatePepper*>::iterator i =
- current_pepper_plugins_.begin();
- i != current_pepper_plugins_.end(); ++i)
+ current_oldstyle_pepper_plugins_.begin();
+ i != current_oldstyle_pepper_plugins_.end(); ++i)
(*i)->RenderViewInitiatedPaint();
}
@@ -4294,14 +4297,22 @@ void RenderView::DidFlushPaint() {
// and we it may ask to close itself as a result. This will, in turn, modify
// our set, possibly invalidating the iterator. So we iterate on a copy that
// won't change out from under us.
- std::set<WebPluginDelegatePepper*> plugins = current_pepper_plugins_;
+ pepper_delegate_.ViewFlushedPaint();
+
+ // Notify any old-style pepper plugins that we painted. This will call into
+ // the plugin, and we it may ask to close itself as a result. This will, in
+ // turn, modify our set, possibly invalidating the iterator. So we iterate on
+ // a copy that won't change out from under us.
+ // This should be deleted when we don't support old Pepper anymore.
+ std::set<WebPluginDelegatePepper*> plugins = current_oldstyle_pepper_plugins_;
for (std::set<WebPluginDelegatePepper*>::iterator i = plugins.begin();
i != plugins.end(); ++i) {
// The copy above makes sure our iterator is never invalid if some plugins
// are destroyed. But some plugin may decide to close all of its views in
// response to a paint in one of them, so we need to make sure each one is
// still "current" before using it.
- if (current_pepper_plugins_.find(*i) != current_pepper_plugins_.end())
+ if (current_oldstyle_pepper_plugins_.find(*i) !=
+ current_oldstyle_pepper_plugins_.end())
(*i)->RenderViewFlushedPaint();
}
@@ -4325,7 +4336,6 @@ void RenderView::DidFlushPaint() {
}
}
-
void RenderView::OnClearFocusedNode() {
if (webview())
webview()->clearFocusedNode();
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 34457ac..3d0789e 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -1179,9 +1179,9 @@ class RenderView : public RenderWidget,
std::set<WebPluginDelegateProxy*> plugin_delegates_;
#endif
- // A list of all pepper plugins that we've created that haven't been
- // destroyed yet.
- std::set<WebPluginDelegatePepper*> current_pepper_plugins_;
+ // A list of all Pepper v1 plugins that we've created that haven't been
+ // destroyed yet. Pepper v2 plugins are tracked by the pepper_delegate_.
+ std::set<WebPluginDelegatePepper*> current_oldstyle_pepper_plugins_;
// Helper objects ------------------------------------------------------------
diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc
index 822ee70..27de9b1 100644
--- a/chrome/test/ui/ppapi_uitest.cc
+++ b/chrome/test/ui/ppapi_uitest.cc
@@ -76,7 +76,7 @@ class PPAPITest : public UITest {
};
// TODO(brettw) fails on Mac, Linux 64 & Windows for unknown reasons.
-TEST_F(PPAPITest, DISABLED_DeviceContext2D) {
+TEST_F(PPAPITest, DeviceContext2D) {
RunTest(FILE_PATH_LITERAL("test_device_context_2d.html"));
}