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

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

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use the correct baseline Created 8 years, 4 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_host.cc
diff --git a/content/browser/browser_plugin/browser_plugin_host.cc b/content/browser/browser_plugin/browser_plugin_host.cc
index 63ea7b8e4bea2a686cf89e23c77d795c604582c7..7bc16789e57f790fb33b7442aeb5bae1f02cce14 100644
--- a/content/browser/browser_plugin/browser_plugin_host.cc
+++ b/content/browser/browser_plugin/browser_plugin_host.cc
@@ -34,7 +34,9 @@ BrowserPluginHost::BrowserPluginHost(
embedder_render_process_host_(NULL),
instance_id_(0),
damage_buffer_(NULL),
- pending_update_counter_(0) {
+ pending_update_counter_(0),
+ // Explicitly zero-initialize
+ surface_params_() {
// Listen to visibility changes so that an embedder hides its guests
// as well.
registrar_.Add(this,
@@ -43,7 +45,7 @@ BrowserPluginHost::BrowserPluginHost(
// Construct plumbing helpers when a new RenderViewHost is created for
// this BrowserPluginHost's WebContentsImpl.
registrar_.Add(this,
- NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
+ NOTIFICATION_WEB_CONTENTS_WILL_CREATE_RENDER_VIEW,
Source<WebContents>(web_contents));
}
@@ -93,7 +95,8 @@ void BrowserPluginHost::NavigateGuest(
int instance_id,
int64 frame_id,
const std::string& src,
- const gfx::Size& size) {
+ const gfx::Size& size,
+ const BrowserPluginHostMsg_Surface_Params& params) {
BrowserPluginHost* guest = GetGuestByInstanceID(instance_id);
WebContentsImpl* guest_web_contents = NULL;
GURL url(src);
@@ -116,6 +119,7 @@ void BrowserPluginHost::NavigateGuest(
NULL // base WebContents
));
guest = guest_web_contents->browser_plugin_host();
+ guest->set_surface_params(params);
guest->set_embedder_render_process_host(
render_view_host->GetProcess());
guest->set_instance_id(instance_id);
@@ -124,6 +128,7 @@ void BrowserPluginHost::NavigateGuest(
AddGuest(instance_id, guest, frame_id);
} else {
guest_web_contents = static_cast<WebContentsImpl*>(guest->web_contents());
+ guest_web_contents->browser_plugin_host()->set_surface_params(params);
}
guest->web_contents()->SetDelegate(guest);
guest->web_contents()->GetController().LoadURL(
@@ -163,12 +168,6 @@ void BrowserPluginHost::ResizeGuest(int instance_id,
void BrowserPluginHost::UpdateRect(
RenderViewHost* render_view_host,
const ViewHostMsg_UpdateRect_Params& params) {
- // This handler is only of interest to us for the 2D software rendering path.
- // needs_ack should always be true for the 2D path.
- // TODO(fsamuel): Do we need to do something different in the 3D case?
- if (!params.needs_ack)
- return;
-
// Only copy damage if the guest's view size is equal to the damage buffer's
// size and the guest's scale factor is equal to the damage buffer's scale
// factor.
@@ -195,6 +194,7 @@ void BrowserPluginHost::UpdateRect(
relay_params.scale_factor = params.scale_factor;
relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack(
params.flags);
+ relay_params.needs_ack = params.needs_ack;
// We need to send the ACK to the same render_view_host that issued
// the UpdateRect. We keep track of this correspondence via a message_id.
@@ -280,6 +280,20 @@ void BrowserPluginHost::SetFocus(bool focused) {
new ViewMsg_SetFocus(render_view_host->GetRoutingID(), focused));
}
+void BrowserPluginHost::SendBuffersSwappedToEmbedder(
+ uint64 surface_handle,
+ const BrowserPlugin_SwapInfo& info) {
+ DCHECK(embedder_render_process_host());
+ embedder_render_process_host()->Send(
+ new BrowserPluginMsg_BuffersSwapped(instance_id_, surface_handle, info));
+}
+
+void BrowserPluginHost::SendSurfaceResizeToEmbedder(const gfx::Size& size) {
+ DCHECK(embedder_render_process_host());
+ embedder_render_process_host()->Send(
+ new BrowserPluginMsg_SurfaceResize(instance_id_, size));
+}
+
void BrowserPluginHost::ShowWidget(RenderViewHost* render_view_host,
int route_id,
const gfx::Rect& initial_pos) {
@@ -394,12 +408,12 @@ void BrowserPluginHost::Observe(
const NotificationSource& source,
const NotificationDetails& details) {
switch (type) {
- case NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: {
+ case NOTIFICATION_WEB_CONTENTS_WILL_CREATE_RENDER_VIEW: {
RenderViewHost* render_view_host =
Details<RenderViewHost>(details).ptr();
// BrowserPluginHostHelper is destroyed when its associated RenderViewHost
// is destroyed.
- new BrowserPluginHostHelper(this, render_view_host);
+ new BrowserPluginHostHelper(this, render_view_host, surface_params_);
break;
}
case NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED: {
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_host.h ('k') | content/browser/browser_plugin/browser_plugin_host_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698