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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 1199963011: Force new surface on BrowserPluginGuest reattach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test, and add check for null surface id in test. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 22696314621b4af82d931e56373010603b803114..0d13794f81a03b3392bda6182ac19f6495ea34f0 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -78,6 +78,7 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
: WebContentsObserver(web_contents),
owner_web_contents_(nullptr),
attached_(false),
+ has_attached_since_surface_set_(false),
browser_plugin_instance_id_(browser_plugin::kInstanceIDNone),
focused_(false),
mouse_locked_(false),
@@ -404,6 +405,7 @@ void BrowserPluginGuest::SetChildFrameSurface(
const gfx::Size& frame_size,
float scale_factor,
const cc::SurfaceSequence& sequence) {
+ has_attached_since_surface_set_ = false;
SendMessageToEmbedder(new BrowserPluginMsg_SetChildFrameSurface(
browser_plugin_instance_id(), surface_id, frame_size, scale_factor,
sequence));
@@ -467,7 +469,9 @@ gfx::Point BrowserPluginGuest::GetScreenCoordinates(
}
void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
- if (!attached()) {
+ // During tests, attache() may be true when there is no owner_web_contents_;
+ // in this case just queue any messages we receive.
+ if (!attached() || !owner_web_contents_) {
// Some pages such as data URLs, javascript URLs, and about:blank
// do not load external resources and so they load prior to attachment.
// As a result, we must save all these IPCs until attachment and then
@@ -711,6 +715,7 @@ void BrowserPluginGuest::OnWillAttachComplete(
InitInternal(params, embedder_web_contents);
attached_ = true;
+ has_attached_since_surface_set_ = true;
SendQueuedMessages();
delegate_->DidAttach(GetGuestProxyRoutingID());

Powered by Google App Engine
This is Rietveld 408576698