Commit a135a784 authored by fsamuel's avatar fsamuel Committed by Commit bot

Remove some dead BrowserPlugin and OOPIF compositing code.

BUG=330264

Review URL: https://codereview.chromium.org/590523003

Cr-Commit-Position: refs/heads/master@{#295804}
parent 413d7545
......@@ -10,7 +10,6 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
......@@ -39,14 +38,7 @@ bool BrowserPluginMessageFilter::OnMessageReceived(
// thread.
return true;
}
bool handled = true;
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
IPC_BEGIN_MESSAGE_MAP(BrowserPluginMessageFilter, message)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
OnSwapBuffersACK)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
return false;
}
void BrowserPluginMessageFilter::OnDestruct() const {
......@@ -87,16 +79,4 @@ void BrowserPluginMessageFilter::ForwardMessageToGuest(
->OnMessageReceivedFromEmbedder(message);
}
void BrowserPluginMessageFilter::OnSwapBuffersACK(
const FrameHostMsg_BuffersSwappedACK_Params& params) {
GpuProcessHost* gpu_host = GpuProcessHost::FromID(params.gpu_host_id);
if (!gpu_host)
return;
AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
ack_params.mailbox = params.mailbox;
ack_params.sync_point = params.sync_point;
gpu_host->Send(new AcceleratedSurfaceMsg_BufferPresented(params.gpu_route_id,
ack_params));
}
} // namespace content
......@@ -34,8 +34,6 @@ class BrowserPluginMessageFilter : public BrowserMessageFilter {
void ForwardMessageToGuest(const IPC::Message& message);
void OnSwapBuffersACK(const FrameHostMsg_BuffersSwappedACK_Params& params);
int render_process_id_;
DISALLOW_COPY_AND_ASSIGN(BrowserPluginMessageFilter);
......
......@@ -30,7 +30,6 @@ bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg)
IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK)
IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK,
OnCompositorFrameSwappedACK)
IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources,
......@@ -65,20 +64,6 @@ void CrossProcessFrameConnector::RenderProcessGone() {
frame_proxy_in_parent_renderer_->GetRoutingID()));
}
void CrossProcessFrameConnector::ChildFrameBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& gpu_params,
int gpu_host_id) {
FrameMsg_BuffersSwapped_Params params;
params.size = gpu_params.size;
params.mailbox = gpu_params.mailbox;
params.gpu_route_id = gpu_params.route_id;
params.gpu_host_id = gpu_host_id;
frame_proxy_in_parent_renderer_->Send(new FrameMsg_BuffersSwapped(
frame_proxy_in_parent_renderer_->GetRoutingID(), params));
}
void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped(
uint32 output_surface_id,
int host_id,
......@@ -93,18 +78,6 @@ void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped(
frame_proxy_in_parent_renderer_->GetRoutingID(), params));
}
void CrossProcessFrameConnector::OnBuffersSwappedACK(
const FrameHostMsg_BuffersSwappedACK_Params& params) {
AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
ack_params.mailbox = params.mailbox;
ack_params.sync_point = params.sync_point;
RenderWidgetHostImpl::AcknowledgeBufferPresent(params.gpu_route_id,
params.gpu_host_id,
ack_params);
// TODO(kenrb): Special case stuff for Win + Mac.
}
void CrossProcessFrameConnector::OnCompositorFrameSwappedACK(
const FrameHostMsg_CompositorFrameSwappedACK_Params& params) {
RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id,
......
......@@ -16,10 +16,8 @@ namespace IPC {
class Message;
}
struct FrameHostMsg_BuffersSwappedACK_Params;
struct FrameHostMsg_CompositorFrameSwappedACK_Params;
struct FrameHostMsg_ReclaimCompositorResources_Params;
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
namespace content {
class RenderFrameProxyHost;
......@@ -78,13 +76,6 @@ class CrossProcessFrameConnector {
void RenderProcessGone();
// 'Platform' functionality exposed to RenderWidgetHostViewChildFrame.
// These methods can forward messages to the child frame proxy in the parent
// frame's renderer or attempt to handle them within the browser process.
void ChildFrameBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id);
void ChildFrameCompositorFrameSwapped(uint32 output_surface_id,
int host_id,
int route_id,
......@@ -94,8 +85,6 @@ class CrossProcessFrameConnector {
private:
// Handlers for messages received from the parent frame.
void OnBuffersSwappedACK(
const FrameHostMsg_BuffersSwappedACK_Params& params);
void OnCompositorFrameSwappedACK(
const FrameHostMsg_CompositorFrameSwappedACK_Params& params);
void OnReclaimCompositorResources(
......
......@@ -207,8 +207,7 @@ void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id,
void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) {
if (frame_connector_)
frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id);
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer(
......
......@@ -196,17 +196,7 @@ void RenderWidgetHostViewGuest::SetTooltipText(
void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) {
if (!guest_)
return;
FrameMsg_BuffersSwapped_Params guest_params;
guest_params.size = params.size;
guest_params.mailbox = params.mailbox;
guest_params.gpu_route_id = params.route_id;
guest_params.gpu_host_id = gpu_host_id;
guest_->SendMessageToEmbedder(
new BrowserPluginMsg_BuffersSwapped(guest_->browser_plugin_instance_id(),
guest_params));
NOTREACHED();
}
void RenderWidgetHostViewGuest::AcceleratedSurfacePostSubBuffer(
......
......@@ -209,15 +209,6 @@ IPC_MESSAGE_CONTROL4(BrowserPluginMsg_CopyFromCompositingSurface,
gfx::Rect /* source_rect */,
gfx::Size /* dest_size */)
// Guest renders into an FBO with textures provided by the embedder.
// BrowserPlugin shares mostly the same logic as out-of-process RenderFrames but
// because BrowserPlugins implement custom a second level of routing logic,
// the IPCs need to be annotated with an extra browser_plugin_instance_id. These
// messages provide that extra id.
IPC_MESSAGE_CONTROL2(BrowserPluginMsg_BuffersSwapped,
int /* browser_plugin_instance_id */,
FrameMsg_BuffersSwapped_Params /* params */)
IPC_MESSAGE_CONTROL2(BrowserPluginMsg_CompositorFrameSwapped,
int /* browser_plugin_instance_id */,
FrameMsg_CompositorFrameSwapped_Params /* params */)
......@@ -227,12 +218,6 @@ IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock,
int /* browser_plugin_instance_id */,
bool /* enable */)
// See comment about BrowserPluginMsg_BuffersSwapped and
// BrowserPluginMsg_CompositorFrameSwapped for how these related
// to the FrameHostMsg variants.
IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_BuffersSwappedACK,
FrameHostMsg_BuffersSwappedACK_Params /* params */)
// Acknowledge that we presented an ubercomp frame.
IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_CompositorFrameSwappedACK,
int /* browser_plugin_instance_id */,
......
......@@ -335,16 +335,6 @@ IPC_STRUCT_END()
// -----------------------------------------------------------------------------
// Messages sent from the browser to the renderer.
// When HW accelerated buffers are swapped in an out-of-process child frame
// renderer, the message is forwarded to the embedding frame to notify it of
// a new texture available for compositing. When the buffer has finished
// presenting, a FrameHostMsg_BuffersSwappedACK should be sent back to
// gpu host that produced this buffer.
//
// This is used in the non-ubercomp HW accelerated compositing path.
IPC_MESSAGE_ROUTED1(FrameMsg_BuffersSwapped,
FrameMsg_BuffersSwapped_Params /* params */)
// Notifies the embedding frame that a new CompositorFrame is ready to be
// presented. When the frame finishes presenting, a matching
// FrameHostMsg_CompositorFrameSwappedACK should be sent back to the
......@@ -648,14 +638,6 @@ IPC_SYNC_MESSAGE_CONTROL4_2(FrameHostMsg_OpenChannelToPlugin,
IPC::ChannelHandle /* channel_handle */,
content::WebPluginInfo /* info */)
// Acknowledge that we presented a HW buffer and provide a sync point
// to specify the location in the command stream when the compositor
// is no longer using it.
//
// See FrameMsg_BuffersSwapped.
IPC_MESSAGE_ROUTED1(FrameHostMsg_BuffersSwappedACK,
FrameHostMsg_BuffersSwappedACK_Params /* params */)
// Acknowledge that we presented an ubercomp frame.
//
// See FrameMsg_CompositorFrameSwapped
......
......@@ -40,7 +40,6 @@ bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) {
case FrameHostMsg_Detach::ID:
case FrameHostMsg_DomOperationResponse::ID:
case FrameHostMsg_CompositorFrameSwappedACK::ID:
case FrameHostMsg_BuffersSwappedACK::ID:
case FrameHostMsg_ReclaimCompositorResources::ID:
// Input events propagate from parent to child.
case FrameHostMsg_ForwardInputEvent::ID:
......
......@@ -102,7 +102,6 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(BrowserPlugin, message)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_Attach_ACK, OnAttachACK)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_BuffersSwapped, OnBuffersSwapped)
IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped,
OnCompositorFrameSwapped(message))
IPC_MESSAGE_HANDLER(BrowserPluginMsg_CopyFromCompositingSurface,
......@@ -224,18 +223,6 @@ void BrowserPlugin::OnAttachACK(int browser_plugin_instance_id) {
attach_pending_ = false;
}
void BrowserPlugin::OnBuffersSwapped(
int instance_id,
const FrameMsg_BuffersSwapped_Params& params) {
EnableCompositing(true);
compositing_helper_->OnBuffersSwapped(params.size,
params.mailbox,
params.gpu_route_id,
params.gpu_host_id,
GetDeviceScaleFactor());
}
void BrowserPlugin::OnCompositorFrameSwapped(const IPC::Message& message) {
BrowserPluginMsg_CompositorFrameSwapped::Param param;
if (!BrowserPluginMsg_CompositorFrameSwapped::Read(&message, &param))
......@@ -497,7 +484,6 @@ bool BrowserPlugin::ShouldForwardToBrowserPlugin(
switch (message.type()) {
case BrowserPluginMsg_Attach_ACK::ID:
case BrowserPluginMsg_AdvanceFocus::ID:
case BrowserPluginMsg_BuffersSwapped::ID:
case BrowserPluginMsg_CompositorFrameSwapped::ID:
case BrowserPluginMsg_CopyFromCompositingSurface::ID:
case BrowserPluginMsg_GuestGone::ID:
......
......@@ -189,8 +189,6 @@ class CONTENT_EXPORT BrowserPlugin :
// Please keep in alphabetical order.
void OnAdvanceFocus(int instance_id, bool reverse);
void OnAttachACK(int browser_plugin_instance_id);
void OnBuffersSwapped(int instance_id,
const FrameMsg_BuffersSwapped_Params& params);
void OnCompositorFrameSwapped(const IPC::Message& message);
void OnCopyFromCompositingSurface(int instance_id,
int request_id,
......
......@@ -9,7 +9,6 @@
#include "cc/layers/delegated_frame_resource_collection.h"
#include "cc/layers/delegated_renderer_layer.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/layers/texture_layer.h"
#include "cc/output/context_provider.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
......@@ -23,7 +22,6 @@
#include "content/renderer/render_frame_proxy.h"
#include "content/renderer/render_thread_impl.h"
#include "skia/ext/image_operations.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/khronos/GLES2/gl2.h"
......@@ -32,13 +30,6 @@
namespace content {
ChildFrameCompositingHelper::SwapBuffersInfo::SwapBuffersInfo()
: route_id(0),
output_surface_id(0),
host_id(0),
software_frame_id(0),
shared_memory(NULL) {}
ChildFrameCompositingHelper*
ChildFrameCompositingHelper::CreateForBrowserPlugin(
const base::WeakPtr<BrowserPlugin>& browser_plugin) {
......@@ -64,9 +55,7 @@ ChildFrameCompositingHelper::ChildFrameCompositingHelper(
last_route_id_(0),
last_output_surface_id_(0),
last_host_id_(0),
last_mailbox_valid_(false),
ack_pending_(true),
software_ack_pending_(false),
opaque_(true),
browser_plugin_(browser_plugin),
render_frame_proxy_(render_frame_proxy),
......@@ -109,19 +98,6 @@ void ChildFrameCompositingHelper::SendCompositorFrameSwappedACKToBrowser(
}
}
void ChildFrameCompositingHelper::SendBuffersSwappedACKToBrowser(
FrameHostMsg_BuffersSwappedACK_Params& params) {
// This function will be removed when BrowserPluginManager is removed and
// BrowserPlugin is modified to use a RenderFrame.
if (GetBrowserPluginManager()) {
GetBrowserPluginManager()->Send(new BrowserPluginHostMsg_BuffersSwappedACK(
host_routing_id_, params));
} else if (render_frame_proxy_) {
render_frame_proxy_->Send(
new FrameHostMsg_BuffersSwappedACK(host_routing_id_, params));
}
}
void ChildFrameCompositingHelper::SendReclaimCompositorResourcesToBrowser(
FrameHostMsg_ReclaimCompositorResources_Params& params) {
// This function will be removed when BrowserPluginManager is removed and
......@@ -152,20 +128,6 @@ void ChildFrameCompositingHelper::CopyFromCompositingSurface(
}
void ChildFrameCompositingHelper::DidCommitCompositorFrame() {
if (software_ack_pending_) {
FrameHostMsg_CompositorFrameSwappedACK_Params params;
params.producing_host_id = last_host_id_;
params.producing_route_id = last_route_id_;
params.output_surface_id = last_output_surface_id_;
if (!unacked_software_frames_.empty()) {
params.ack.last_software_frame_id = unacked_software_frames_.back();
unacked_software_frames_.pop_back();
}
SendCompositorFrameSwappedACKToBrowser(params);
software_ack_pending_ = false;
}
if (!resource_collection_.get() || !ack_pending_)
return;
......@@ -216,62 +178,6 @@ void ChildFrameCompositingHelper::CheckSizeAndAdjustLayerProperties(
background_layer_->SetIsDrawable(false);
}
void ChildFrameCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox,
uint32 sync_point,
bool lost_resource) {
if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME) {
delete mailbox.shared_memory;
mailbox.shared_memory = NULL;
} else if (lost_resource) {
// Reset mailbox's name if the resource was lost.
mailbox.name.SetZero();
}
// This means the GPU process crashed or guest crashed.
if (last_host_id_ != mailbox.host_id ||
last_output_surface_id_ != mailbox.output_surface_id ||
last_route_id_ != mailbox.route_id)
return;
if (mailbox.type == SOFTWARE_COMPOSITOR_FRAME)
unacked_software_frames_.push_back(mailbox.software_frame_id);
// We need to send an ACK to for every buffer sent to us.
// However, if a buffer is freed up from
// the compositor in cases like switching back to SW mode without a new
// buffer arriving, no ACK is needed.
if (!ack_pending_) {
last_mailbox_valid_ = false;
return;
}
ack_pending_ = false;
switch (mailbox.type) {
case TEXTURE_IMAGE_TRANSPORT: {
FrameHostMsg_BuffersSwappedACK_Params params;
params.gpu_host_id = mailbox.host_id;
params.gpu_route_id = mailbox.route_id;
params.mailbox = mailbox.name;
params.sync_point = sync_point;
SendBuffersSwappedACKToBrowser(params);
break;
}
case GL_COMPOSITOR_FRAME: {
FrameHostMsg_CompositorFrameSwappedACK_Params params;
params.producing_host_id = mailbox.host_id;
params.producing_route_id = mailbox.route_id;
params.output_surface_id = mailbox.output_surface_id;
params.ack.gl_frame_data.reset(new cc::GLFrameData());
params.ack.gl_frame_data->mailbox = mailbox.name;
params.ack.gl_frame_data->size = mailbox.size;
params.ack.gl_frame_data->sync_point = sync_point;
SendCompositorFrameSwappedACKToBrowser(params);
break;
}
case SOFTWARE_COMPOSITOR_FRAME:
break;
}
}
void ChildFrameCompositingHelper::OnContainerDestroy() {
if (GetContainer())
GetContainer()->setWebLayer(NULL);
......@@ -280,10 +186,8 @@ void ChildFrameCompositingHelper::OnContainerDestroy() {
resource_collection_->SetClient(NULL);
ack_pending_ = false;
software_ack_pending_ = false;
resource_collection_ = NULL;
frame_provider_ = NULL;
texture_layer_ = NULL;
delegated_layer_ = NULL;
background_layer_ = NULL;
web_layer_.reset();
......@@ -296,156 +200,12 @@ void ChildFrameCompositingHelper::ChildFrameGone() {
background_layer_->SetContentsOpaque(true);
}
void ChildFrameCompositingHelper::OnBuffersSwappedPrivate(
const SwapBuffersInfo& mailbox,
uint32 sync_point,
float device_scale_factor) {
DCHECK(!delegated_layer_.get());
// If these mismatch, we are either just starting up, GPU process crashed or
// guest renderer crashed.
// In this case, we are communicating with a new image transport
// surface and must ACK with the new ID's and an empty mailbox.
if (last_route_id_ != mailbox.route_id ||
last_output_surface_id_ != mailbox.output_surface_id ||
last_host_id_ != mailbox.host_id)
last_mailbox_valid_ = false;
last_route_id_ = mailbox.route_id;
last_output_surface_id_ = mailbox.output_surface_id;
last_host_id_ = mailbox.host_id;
ack_pending_ = true;
// Browser plugin getting destroyed, do a fast ACK.
if (!background_layer_.get()) {
MailboxReleased(mailbox, sync_point, false);
return;
}
if (!texture_layer_.get()) {
texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL);
texture_layer_->SetIsDrawable(true);
SetContentsOpaque(opaque_);
background_layer_->AddChild(texture_layer_);
}
// The size of browser plugin container is not always equal to the size
// of the buffer that arrives here. This could be for a number of reasons,
// including autosize and a resize in progress.
// During resize, the container size changes first and then some time
// later, a new buffer with updated size will arrive. During this process,
// we need to make sure that things are still displayed pixel perfect.
// We accomplish this by modifying bounds of the texture layer only
// when a new buffer arrives.
// Visually, this will either display a smaller part of the buffer
// or introduce a gutter around it.
CheckSizeAndAdjustLayerProperties(
mailbox.size, device_scale_factor, texture_layer_.get());
bool is_software_frame = mailbox.type == SOFTWARE_COMPOSITOR_FRAME;
bool current_mailbox_valid = is_software_frame ? mailbox.shared_memory != NULL
: !mailbox.name.IsZero();
if (!is_software_frame && !last_mailbox_valid_) {
SwapBuffersInfo empty_info = mailbox;
empty_info.name.SetZero();
MailboxReleased(empty_info, 0, false);
if (!current_mailbox_valid)
return;
}
cc::TextureMailbox texture_mailbox;
scoped_ptr<cc::SingleReleaseCallback> release_callback;
if (current_mailbox_valid) {
release_callback =
cc::SingleReleaseCallback::Create(
base::Bind(&ChildFrameCompositingHelper::MailboxReleased,
scoped_refptr<ChildFrameCompositingHelper>(this),
mailbox)).Pass();
if (is_software_frame) {
texture_mailbox = cc::TextureMailbox(mailbox.shared_memory, mailbox.size);
} else {
texture_mailbox =
cc::TextureMailbox(mailbox.name, GL_TEXTURE_2D, sync_point);
}
}
texture_layer_->SetFlipped(!is_software_frame);
texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass());
texture_layer_->SetNeedsDisplay();
last_mailbox_valid_ = current_mailbox_valid;
}
void ChildFrameCompositingHelper::OnBuffersSwapped(
const gfx::Size& size,
const gpu::Mailbox& mailbox,
int gpu_route_id,
int gpu_host_id,
float device_scale_factor) {
SwapBuffersInfo swap_info;
swap_info.name = mailbox;
swap_info.type = TEXTURE_IMAGE_TRANSPORT;
swap_info.size = size;
swap_info.route_id = gpu_route_id;
swap_info.output_surface_id = 0;
swap_info.host_id = gpu_host_id;
OnBuffersSwappedPrivate(swap_info, 0, device_scale_factor);
}
void ChildFrameCompositingHelper::OnCompositorFrameSwapped(
scoped_ptr<cc::CompositorFrame> frame,
int route_id,
uint32 output_surface_id,
int host_id,
base::SharedMemoryHandle handle) {
if (frame->gl_frame_data) {
SwapBuffersInfo swap_info;
swap_info.name = frame->gl_frame_data->mailbox;
swap_info.type = GL_COMPOSITOR_FRAME;
swap_info.size = frame->gl_frame_data->size;
swap_info.route_id = route_id;
swap_info.output_surface_id = output_surface_id;
swap_info.host_id = host_id;
OnBuffersSwappedPrivate(swap_info,
frame->gl_frame_data->sync_point,
frame->metadata.device_scale_factor);
return;
}
if (frame->software_frame_data) {
cc::SoftwareFrameData* frame_data = frame->software_frame_data.get();
SwapBuffersInfo swap_info;
swap_info.type = SOFTWARE_COMPOSITOR_FRAME;
swap_info.size = frame_data->size;
swap_info.route_id = route_id;
swap_info.output_surface_id = output_surface_id;
swap_info.host_id = host_id;
swap_info.software_frame_id = frame_data->id;
scoped_ptr<base::SharedMemory> shared_memory(
new base::SharedMemory(handle, true));
const size_t size_in_bytes = 4 * frame_data->size.GetArea();
if (!shared_memory->Map(size_in_bytes)) {
LOG(ERROR) << "Failed to map shared memory of size " << size_in_bytes;
// Send ACK right away.
software_ack_pending_ = true;
MailboxReleased(swap_info, 0, false);
DidCommitCompositorFrame();
return;
}
swap_info.shared_memory = shared_memory.release();
OnBuffersSwappedPrivate(swap_info, 0, frame->metadata.device_scale_factor);
software_ack_pending_ = true;
last_route_id_ = route_id;
last_output_surface_id_ = output_surface_id;
last_host_id_ = host_id;
return;
}
DCHECK(!texture_layer_.get());
cc::DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
// Do nothing if we are getting destroyed or have no frame data.
if (!frame_data || !background_layer_.get())
......@@ -507,8 +267,6 @@ void ChildFrameCompositingHelper::OnCompositorFrameSwapped(
}
void ChildFrameCompositingHelper::UpdateVisibility(bool visible) {
if (texture_layer_.get())
texture_layer_->SetIsDrawable(visible);
if (delegated_layer_.get())
delegated_layer_->SetIsDrawable(visible);
}
......@@ -535,9 +293,6 @@ void ChildFrameCompositingHelper::SendReturnedDelegatedResources() {
void ChildFrameCompositingHelper::SetContentsOpaque(bool opaque) {
opaque_ = opaque;
if (texture_layer_.get())
texture_layer_->SetContentsOpaque(opaque_);
if (delegated_layer_.get())
delegated_layer_->SetContentsOpaque(opaque_);
}
......
......@@ -13,7 +13,6 @@
#include "base/memory/shared_memory.h"
#include "cc/layers/delegated_frame_resource_collection.h"
#include "content/common/content_export.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "ui/gfx/size.h"
namespace base {
......@@ -25,7 +24,6 @@ class CompositorFrame;
class CopyOutputResult;
class Layer;
class SolidColorLayer;
class TextureLayer;
class DelegatedFrameProvider;
class DelegatedFrameResourceCollection;
class DelegatedRendererLayer;
......@@ -67,11 +65,6 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
void DidCommitCompositorFrame();
void EnableCompositing(bool);
void OnContainerDestroy();
void OnBuffersSwapped(const gfx::Size& size,
const gpu::Mailbox& mailbox,
int gpu_route_id,
int gpu_host_id,
float device_scale_factor);
void OnCompositorFrameSwapped(scoped_ptr<cc::CompositorFrame> frame,
int route_id,
uint32 output_surface_id,
......@@ -95,23 +88,6 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
RenderFrameProxy* render_frame_proxy,
int host_routing_id);
enum SwapBuffersType {
TEXTURE_IMAGE_TRANSPORT,
GL_COMPOSITOR_FRAME,
SOFTWARE_COMPOSITOR_FRAME,
};
struct SwapBuffersInfo {
SwapBuffersInfo();
gpu::Mailbox name;
SwapBuffersType type;
gfx::Size size;
int route_id;
uint32 output_surface_id;
int host_id;
unsigned software_frame_id;
base::SharedMemory* shared_memory;
};
virtual ~ChildFrameCompositingHelper();
BrowserPluginManager* GetBrowserPluginManager();
......@@ -120,19 +96,11 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
void SendCompositorFrameSwappedACKToBrowser(
FrameHostMsg_CompositorFrameSwappedACK_Params& params);
void SendBuffersSwappedACKToBrowser(
FrameHostMsg_BuffersSwappedACK_Params& params);
void SendReclaimCompositorResourcesToBrowser(
FrameHostMsg_ReclaimCompositorResources_Params& params);
void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size,
float device_scale_factor,
cc::Layer* layer);
void OnBuffersSwappedPrivate(const SwapBuffersInfo& mailbox,
unsigned sync_point,
float device_scale_factor);
void MailboxReleased(SwapBuffersInfo mailbox,
unsigned sync_point,
bool lost_resource);
void SendReturnedDelegatedResources();
void CopyFromCompositingSurfaceHasResult(
int request_id,
......@@ -143,11 +111,8 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
int last_route_id_;
uint32 last_output_surface_id_;
int last_host_id_;
bool last_mailbox_valid_;
bool ack_pending_;
bool software_ack_pending_;
bool opaque_;
std::vector<unsigned> unacked_software_frames_;
gfx::Size buffer_size_;
......@@ -161,7 +126,6 @@ class CONTENT_EXPORT ChildFrameCompositingHelper
scoped_refptr<cc::DelegatedFrameProvider> frame_provider_;
scoped_refptr<cc::SolidColorLayer> background_layer_;
scoped_refptr<cc::TextureLayer> texture_layer_;
scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_;
scoped_ptr<blink::WebLayer> web_layer_;
blink::WebFrame* frame_;
......
......@@ -149,7 +149,6 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(RenderFrameProxy, msg)
IPC_MESSAGE_HANDLER(FrameMsg_DeleteProxy, OnDeleteProxy)
IPC_MESSAGE_HANDLER(FrameMsg_ChildFrameProcessGone, OnChildFrameProcessGone)
IPC_MESSAGE_HANDLER(FrameMsg_BuffersSwapped, OnBuffersSwapped)
IPC_MESSAGE_HANDLER_GENERIC(FrameMsg_CompositorFrameSwapped,
OnCompositorFrameSwapped(msg))
IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener)
......@@ -189,21 +188,6 @@ void RenderFrameProxy::OnChildFrameProcessGone() {
compositing_helper_->ChildFrameGone();
}
void RenderFrameProxy::OnBuffersSwapped(
const FrameMsg_BuffersSwapped_Params& params) {
if (!compositing_helper_.get()) {
compositing_helper_ =
ChildFrameCompositingHelper::CreateForRenderFrameProxy(this);
compositing_helper_->EnableCompositing(true);
}
compositing_helper_->OnBuffersSwapped(
params.size,
params.mailbox,
params.gpu_route_id,
params.gpu_host_id,
web_frame()->view()->deviceScaleFactor());
}
void RenderFrameProxy::OnCompositorFrameSwapped(const IPC::Message& message) {
FrameMsg_CompositorFrameSwapped::Param param;
if (!FrameMsg_CompositorFrameSwapped::Read(&message, &param))
......
......@@ -111,7 +111,6 @@ class CONTENT_EXPORT RenderFrameProxy
// IPC handlers
void OnDeleteProxy();
void OnChildFrameProcessGone();
void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params);
void OnCompositorFrameSwapped(const IPC::Message& message);
void OnDisownOpener();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment