diff options
author | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 12:17:08 +0000 |
---|---|---|
committer | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 12:17:08 +0000 |
commit | f0417f803f559ed4f941425c8566eb4b25e40919 (patch) | |
tree | 858bed66a880df6be06c4e0ef0c87cdc52163393 | |
parent | f4e1ea2430a5d5ae2765858c96b0c71738e71e0a (diff) | |
download | chromium_src-f0417f803f559ed4f941425c8566eb4b25e40919.zip chromium_src-f0417f803f559ed4f941425c8566eb4b25e40919.tar.gz chromium_src-f0417f803f559ed4f941425c8566eb4b25e40919.tar.bz2 |
Revert 251207 "Use gpu::Mailbox instead of std:string in IPCs"
Speculative revert to determine whether it is causing the below
WebViewTest.AutoSizeSW failure on the Linux Test bots (e.g.,
http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29/builds/30888/steps/browser_tests/logs/AutoSizeSW):
FATAL:texture_layer.cc(141)] Check failed: !mailbox.IsValid() || !holder_ref_
|| !mailbox.Equals(holder_ref_->holder()->mailbox()).
This failure also appeared on the trybot run for this CL.
> Use gpu::Mailbox instead of std:string in IPCs
>
> - easier to read
> - safer since gpu::Mailbox is constant size and checked in the ParamTraits
>
> BUG=None
>
> Review URL: https://codereview.chromium.org/148003006
TBR=piman@chromium.org
Review URL: https://codereview.chromium.org/163433008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251281 0039d316-1c4b-4281-b951-d872f2087c98
24 files changed, 90 insertions, 83 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 68db4d9..9e8e517 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -1157,10 +1157,10 @@ void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) { void BrowserPluginGuest::AcknowledgeBufferPresent( int route_id, int gpu_host_id, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, uint32 sync_point) { AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox = mailbox; + ack_params.mailbox_name = mailbox_name; ack_params.sync_point = sync_point; RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, gpu_host_id, @@ -1610,7 +1610,7 @@ void BrowserPluginGuest::OnSwapBuffersACK( int instance_id, const FrameHostMsg_BuffersSwappedACK_Params& params) { AcknowledgeBufferPresent(params.gpu_route_id, params.gpu_host_id, - params.mailbox, params.sync_point); + params.mailbox_name, params.sync_point); // This is only relevant on MACOSX and WIN when threaded compositing // is not enabled. In threaded mode, above ACK is sufficient. diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 870783c..a986bdb 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -67,10 +67,6 @@ namespace gfx { class Range; } -namespace gpu { -struct Mailbox; -} - namespace content { class BrowserPluginHostFactory; @@ -290,7 +286,7 @@ class CONTENT_EXPORT BrowserPluginGuest // BrowserPluginGuest is already destroyed. static void AcknowledgeBufferPresent(int route_id, int gpu_host_id, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, uint32 sync_point); // Returns whether BrowserPluginGuest is interested in receiving the given diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc index 4ef9e29..405a233 100644 --- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc +++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc @@ -221,7 +221,7 @@ void BrowserPluginGuestManager::OnUnhandledSwapBuffersACK( const FrameHostMsg_BuffersSwappedACK_Params& params) { BrowserPluginGuest::AcknowledgeBufferPresent(params.gpu_route_id, params.gpu_host_id, - params.mailbox, + params.mailbox_name, params.sync_point); } diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 6724060..d72958b 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -29,7 +29,6 @@ #include "content/common/gpu/gpu_process_launch_causes.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gles2_interface.h" -#include "gpu/command_buffer/common/mailbox.h" #include "third_party/khronos/GLES2/gl2.h" #include "ui/compositor/compositor.h" #include "ui/compositor/compositor_constants.h" @@ -114,27 +113,29 @@ class ImageTransportClientTexture : public OwnedTexture { device_scale_factor, texture_id) {} - virtual void Consume(const gpu::Mailbox& mailbox, + virtual void Consume(const std::string& mailbox_name, const gfx::Size& new_size) OVERRIDE { - mailbox_ = mailbox; - if (mailbox.IsZero()) + DCHECK(mailbox_name.size() == GL_MAILBOX_SIZE_CHROMIUM); + mailbox_name_ = mailbox_name; + if (mailbox_name.empty()) return; DCHECK(provider_ && texture_id_); GLES2Interface* gl = provider_->ContextGL(); gl->BindTexture(GL_TEXTURE_2D, texture_id_); - gl->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + gl->ConsumeTextureCHROMIUM( + GL_TEXTURE_2D, reinterpret_cast<const GLbyte*>(mailbox_name.c_str())); size_ = new_size; gl->ShallowFlushCHROMIUM(); } - virtual gpu::Mailbox Produce() OVERRIDE { return mailbox_; } + virtual std::string Produce() OVERRIDE { return mailbox_name_; } protected: virtual ~ImageTransportClientTexture() {} private: - gpu::Mailbox mailbox_; + std::string mailbox_name_; DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); }; diff --git a/content/browser/compositor/no_transport_image_transport_factory.cc b/content/browser/compositor/no_transport_image_transport_factory.cc index d67be0c..f278e49 100644 --- a/content/browser/compositor/no_transport_image_transport_factory.cc +++ b/content/browser/compositor/no_transport_image_transport_factory.cc @@ -25,7 +25,7 @@ class FakeTexture : public ui::Texture { virtual unsigned int PrepareTexture() OVERRIDE { return texture_; } - virtual void Consume(const gpu::Mailbox& mailbox, + virtual void Consume(const std::string& mailbox_name, const gfx::Size& new_size) OVERRIDE { size_ = new_size; } diff --git a/content/browser/frame_host/cross_process_frame_connector.cc b/content/browser/frame_host/cross_process_frame_connector.cc index 0378181..f386df8 100644 --- a/content/browser/frame_host/cross_process_frame_connector.cc +++ b/content/browser/frame_host/cross_process_frame_connector.cc @@ -67,7 +67,7 @@ void CrossProcessFrameConnector::ChildFrameBuffersSwapped( FrameMsg_BuffersSwapped_Params params; params.size = gpu_params.size; - params.mailbox = gpu_params.mailbox; + params.mailbox_name = gpu_params.mailbox_name; params.gpu_route_id = gpu_params.route_id; params.gpu_host_id = gpu_host_id; @@ -94,7 +94,7 @@ void CrossProcessFrameConnector::ChildFrameCompositorFrameSwapped( void CrossProcessFrameConnector::OnBuffersSwappedACK( const FrameHostMsg_BuffersSwappedACK_Params& params) { AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox = params.mailbox; + ack_params.mailbox_name = params.mailbox_name; ack_params.sync_point = params.sync_point; RenderWidgetHostImpl::AcknowledgeBufferPresent(params.gpu_route_id, params.gpu_host_id, diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index eef781b..0e26c92 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc @@ -170,7 +170,7 @@ void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped( guest_->clear_damage_buffer(); FrameMsg_BuffersSwapped_Params guest_params; guest_params.size = params.size; - guest_params.mailbox = params.mailbox; + guest_params.mailbox_name = params.mailbox_name; guest_params.gpu_route_id = params.route_id; guest_params.gpu_host_id = gpu_host_id; guest_->SendMessageToEmbedder( diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index ec62dff..4d46484 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -288,13 +288,17 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) return; AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox = params.mailbox; + ack_params.mailbox_name = params.mailbox_name; ack_params.sync_point = 0; ScopedSendOnIOThread delayed_send( host_id_, new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); + if (!params.mailbox_name.empty() && + params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) + return; + RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID( params.surface_id); if (!view) @@ -334,13 +338,17 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( "GpuHostMsg_AcceleratedSurfacePostSubBuffer")) return; AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox = params.mailbox; + ack_params.mailbox_name = params.mailbox_name; ack_params.sync_point = 0; ScopedSendOnIOThread delayed_send( host_id_, new AcceleratedSurfaceMsg_BufferPresented(params.route_id, ack_params)); + if (!params.mailbox_name.empty() && + params.mailbox_name.length() != GL_MAILBOX_SIZE_CHROMIUM) + return; + RenderWidgetHostViewPort* view = GetRenderWidgetHostViewFromSurfaceID(params.surface_id); if (!view) diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 2a926bc..81245e5 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -327,7 +327,10 @@ void SendCompositorFrameAck( DCHECK(!texture_to_produce.get() || !skip_frame); if (texture_to_produce.get()) { GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); - ack.gl_frame_data->mailbox = texture_to_produce->Produce(); + std::string mailbox_name = texture_to_produce->Produce(); + std::copy(mailbox_name.data(), + mailbox_name.data() + mailbox_name.length(), + reinterpret_cast<char*>(ack.gl_frame_data->mailbox.name)); ack.gl_frame_data->size = texture_to_produce->size(); ack.gl_frame_data->sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; @@ -345,7 +348,7 @@ void SendCompositorFrameAck( void AcknowledgeBufferForGpu( int32 route_id, int gpu_host_id, - const gpu::Mailbox& received_mailbox, + const std::string& received_mailbox, bool skip_frame, const scoped_refptr<ui::Texture>& texture_to_produce) { AcceleratedSurfaceMsg_BufferPresented_Params ack; @@ -353,10 +356,10 @@ void AcknowledgeBufferForGpu( DCHECK(!texture_to_produce.get() || !skip_frame); if (texture_to_produce.get()) { GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); - ack.mailbox = texture_to_produce->Produce(); + ack.mailbox_name = texture_to_produce->Produce(); sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; } else if (skip_frame) { - ack.mailbox = received_mailbox; + ack.mailbox_name = received_mailbox; ack.sync_point = 0; } @@ -1299,7 +1302,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( const gfx::Rect& surface_rect, float surface_scale_factor, const gfx::Rect& damage_rect, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, const BufferPresentedCallback& ack_callback) { if (last_swapped_surface_size_ != surface_rect.size()) { // The surface could have shrunk since we skipped an update, in which @@ -1312,7 +1315,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( if (ShouldSkipFrame(ConvertSizeToDIP(surface_scale_factor, surface_rect.size())) || - mailbox.IsZero()) { + mailbox_name.empty()) { skipped_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op); ack_callback.Run(true, scoped_refptr<ui::Texture>()); return false; @@ -1327,7 +1330,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( return false; } - current_surface_->Consume(mailbox, surface_rect.size()); + current_surface_->Consume(mailbox_name, surface_rect.size()); released_front_lock_ = NULL; UpdateExternalTexture(); @@ -1393,11 +1396,11 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( &AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, - params_in_pixel.mailbox); + params_in_pixel.mailbox_name); BuffersSwapped(params_in_pixel.size, gfx::Rect(params_in_pixel.size), params_in_pixel.scale_factor, - params_in_pixel.mailbox, + params_in_pixel.mailbox_name, params_in_pixel.latency_info, ack_callback); } @@ -1688,10 +1691,13 @@ void RenderWidgetHostViewAura::OnSwapCompositorFrame( GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); gl_helper->WaitSyncPoint(frame->gl_frame_data->sync_point); + std::string mailbox_name( + reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name), + sizeof(frame->gl_frame_data->mailbox.name)); BuffersSwapped(frame->gl_frame_data->size, frame->gl_frame_data->sub_buffer_rect, frame->metadata.device_scale_factor, - frame->gl_frame_data->mailbox, + mailbox_name, frame->metadata.latency_info, ack_callback); } @@ -1719,7 +1725,7 @@ void RenderWidgetHostViewAura::BuffersSwapped( const gfx::Size& surface_size, const gfx::Rect& damage_rect, float surface_scale_factor, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, const std::vector<ui::LatencyInfo>& latency_info, const BufferPresentedCallback& ack_callback) { scoped_refptr<ui::Texture> previous_texture(current_surface_); @@ -1729,7 +1735,7 @@ void RenderWidgetHostViewAura::BuffersSwapped( if (!SwapBuffersPrepare(surface_rect, surface_scale_factor, damage_rect, - mailbox, + mailbox_name, ack_callback)) { return; } @@ -1796,11 +1802,11 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( base::Bind(&AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, - params_in_pixel.mailbox); + params_in_pixel.mailbox_name); BuffersSwapped(params_in_pixel.surface_size, damage_rect, params_in_pixel.surface_scale_factor, - params_in_pixel.mailbox, + params_in_pixel.mailbox_name, params_in_pixel.latency_info, ack_callback); } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 0e01067..3c3757d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -60,10 +60,6 @@ class Canvas; class Display; } -namespace gpu { -struct Mailbox; -} - namespace ui { class CompositorLock; class CompositorVSyncManager; @@ -534,14 +530,14 @@ class CONTENT_EXPORT RenderWidgetHostViewAura void BuffersSwapped(const gfx::Size& surface_size, const gfx::Rect& damage_rect, float surface_scale_factor, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, const std::vector<ui::LatencyInfo>& latency_info, const BufferPresentedCallback& ack_callback); bool SwapBuffersPrepare(const gfx::Rect& surface_rect, float surface_scale_factor, const gfx::Rect& damage_rect, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, const BufferPresentedCallback& ack_callback); void SwapBuffersCompleted( diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index cd5cb3f..6911f28 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -949,7 +949,7 @@ TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; params.surface_id = widget_host_->surface_id(); params.route_id = widget_host_->GetRoutingID(); - memset(params.mailbox.name, '1', sizeof(params.mailbox.name)); + params.mailbox_name = std::string(64, '1'); params.size = view_size; params.scale_factor = 1.f; @@ -968,7 +968,7 @@ TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params post_params; post_params.surface_id = widget_host_->surface_id(); post_params.route_id = widget_host_->GetRoutingID(); - memset(post_params.mailbox.name, '1', sizeof(post_params.mailbox.name)); + post_params.mailbox_name = std::string(64, '1'); post_params.surface_size = gfx::Size(200, 200); post_params.surface_scale_factor = 2.f; post_params.x = 40; diff --git a/content/common/frame_param_macros.h b/content/common/frame_param_macros.h index 3f37975..2cd44e7 100644 --- a/content/common/frame_param_macros.h +++ b/content/common/frame_param_macros.h @@ -24,7 +24,7 @@ IPC_STRUCT_BEGIN(FrameMsg_BuffersSwapped_Params) IPC_STRUCT_MEMBER(int, gpu_host_id) IPC_STRUCT_MEMBER(int, gpu_route_id) - IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) + IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, size) IPC_STRUCT_END() @@ -40,7 +40,7 @@ IPC_STRUCT_END() IPC_STRUCT_BEGIN(FrameHostMsg_BuffersSwappedACK_Params) IPC_STRUCT_MEMBER(int, gpu_host_id) IPC_STRUCT_MEMBER(int, gpu_route_id) - IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) + IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(uint32, sync_point) IPC_STRUCT_END() diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 2db1a1d..7754ec3 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -70,7 +70,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) IPC_STRUCT_MEMBER(int32, surface_id) IPC_STRUCT_MEMBER(uint64, surface_handle) IPC_STRUCT_MEMBER(int32, route_id) - IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) + IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, size) IPC_STRUCT_MEMBER(float, scale_factor) IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) @@ -84,7 +84,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params) IPC_STRUCT_MEMBER(int, y) IPC_STRUCT_MEMBER(int, width) IPC_STRUCT_MEMBER(int, height) - IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) + IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(gfx::Size, surface_size) IPC_STRUCT_MEMBER(float, surface_scale_factor) IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) @@ -95,7 +95,7 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params) IPC_STRUCT_END() IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params) - IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) + IPC_STRUCT_MEMBER(std::string, mailbox_name) IPC_STRUCT_MEMBER(uint32, sync_point) #if defined(OS_MACOSX) IPC_STRUCT_MEMBER(int32, renderer_id) diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc index 30a54fb..f13a986 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -218,7 +218,9 @@ bool TextureImageTransportSurface::SwapBuffers() { GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; params.size = backbuffer_size(); params.scale_factor = scale_factor_; - params.mailbox = back_mailbox_; + params.mailbox_name.assign( + reinterpret_cast<const char*>(&back_mailbox_), + sizeof(back_mailbox_)); glFlush(); @@ -256,7 +258,9 @@ bool TextureImageTransportSurface::PostSubBuffer( params.y = y; params.width = width; params.height = height; - params.mailbox = back_mailbox_; + params.mailbox_name.assign( + reinterpret_cast<const char*>(&back_mailbox_), + sizeof(back_mailbox_)); glFlush(); @@ -290,17 +294,18 @@ unsigned TextureImageTransportSurface::GetFormat() { void TextureImageTransportSurface::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) { if (params.sync_point == 0) { - BufferPresentedImpl(params.mailbox); + BufferPresentedImpl(params.mailbox_name); } else { helper_->manager()->sync_point_manager()->AddSyncPointCallback( params.sync_point, base::Bind(&TextureImageTransportSurface::BufferPresentedImpl, this, - params.mailbox)); + params.mailbox_name)); } } -void TextureImageTransportSurface::BufferPresentedImpl(const Mailbox& mailbox) { +void TextureImageTransportSurface::BufferPresentedImpl( + const std::string& mailbox_name) { DCHECK(is_swap_buffers_pending_); is_swap_buffers_pending_ = false; @@ -316,8 +321,11 @@ void TextureImageTransportSurface::BufferPresentedImpl(const Mailbox& mailbox) { DCHECK(backbuffer_.get()); bool swap = true; - if (!mailbox.IsZero()) { - if (mailbox != back_mailbox_) { + if (!mailbox_name.empty()) { + DCHECK(mailbox_name.length() == GL_MAILBOX_SIZE_CHROMIUM); + if (!memcmp(mailbox_name.data(), + &back_mailbox_, + mailbox_name.length())) { // The browser has skipped the frame to unblock the GPU process, waiting // for one of the right size, and returned the back buffer, so don't swap. swap = false; diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h index a86ff27..ab3eb44 100644 --- a/content/common/gpu/texture_image_transport_surface.h +++ b/content/common/gpu/texture_image_transport_surface.h @@ -74,7 +74,7 @@ class TextureImageTransportSurface void AttachBackTextureToFBO(); void ReleaseBackTexture(); void ReleaseFrontTexture(); - void BufferPresentedImpl(const gpu::Mailbox& mailbox_name); + void BufferPresentedImpl(const std::string& mailbox_name); // The framebuffer that represents this surface (service id). Allocated lazily // in OnMakeCurrent. diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 3d20a6e..974c3b0 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -437,7 +437,7 @@ void BrowserPlugin::OnBuffersSwapped( EnableCompositing(true); compositing_helper_->OnBuffersSwapped(params.size, - params.mailbox, + params.mailbox_name, params.gpu_route_id, params.gpu_host_id, GetDeviceScaleFactor()); diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index cc3bc50..15cf383 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc @@ -246,10 +246,12 @@ void ChildFrameCompositingHelper::MailboxReleased(SwapBuffersInfo mailbox, ack_pending_ = false; switch (mailbox.type) { case TEXTURE_IMAGE_TRANSPORT: { + std::string mailbox_name(reinterpret_cast<const char*>(mailbox.name.name), + sizeof(mailbox.name.name)); FrameHostMsg_BuffersSwappedACK_Params params; params.gpu_host_id = mailbox.host_id; params.gpu_route_id = mailbox.route_id; - params.mailbox = mailbox.name; + params.mailbox_name = mailbox_name; params.sync_point = sync_point; SendBuffersSwappedACKToBrowser(params); break; @@ -376,12 +378,12 @@ void ChildFrameCompositingHelper::OnBuffersSwappedPrivate( void ChildFrameCompositingHelper::OnBuffersSwapped( const gfx::Size& size, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, int gpu_route_id, int gpu_host_id, float device_scale_factor) { SwapBuffersInfo swap_info; - swap_info.name = mailbox; + swap_info.name.SetName(reinterpret_cast<const int8*>(mailbox_name.data())); swap_info.type = TEXTURE_IMAGE_TRANSPORT; swap_info.size = size; swap_info.route_id = gpu_route_id; diff --git a/content/renderer/child_frame_compositing_helper.h b/content/renderer/child_frame_compositing_helper.h index 1ec0585..686d9a2 100644 --- a/content/renderer/child_frame_compositing_helper.h +++ b/content/renderer/child_frame_compositing_helper.h @@ -69,7 +69,7 @@ class CONTENT_EXPORT ChildFrameCompositingHelper void EnableCompositing(bool); void OnContainerDestroy(); void OnBuffersSwapped(const gfx::Size& size, - const gpu::Mailbox& mailbox, + const std::string& mailbox_name, int gpu_route_id, int gpu_host_id, float device_scale_factor); diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index af5e0d5..1b13f68 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -487,7 +487,7 @@ void RenderFrameImpl::OnBuffersSwapped( } compositing_helper_->OnBuffersSwapped( params.size, - params.mailbox, + params.mailbox_name, params.gpu_route_id, params.gpu_host_id, render_view_->GetWebView()->deviceScaleFactor()); diff --git a/gpu/command_buffer/common/mailbox.h b/gpu/command_buffer/common/mailbox.h index d9d25d4..938167f 100644 --- a/gpu/command_buffer/common/mailbox.h +++ b/gpu/command_buffer/common/mailbox.h @@ -21,12 +21,6 @@ struct GPU_EXPORT Mailbox { bool operator<(const Mailbox& other) const { return memcmp(this, &other, sizeof other) < 0; } - bool operator==(const Mailbox& other) const { - return memcmp(this, &other, sizeof other) == 0; - } - bool operator!=(const Mailbox& other) const { - return !operator==(other); - } }; } // namespace gpu diff --git a/gpu/command_buffer/service/mailbox_manager.h b/gpu/command_buffer/service/mailbox_manager.h index 01b74b2..e06ef2d 100644 --- a/gpu/command_buffer/service/mailbox_manager.h +++ b/gpu/command_buffer/service/mailbox_manager.h @@ -64,11 +64,11 @@ class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { // iterator in the MailboxToTextureMap to be able to manage changes to // the TextureToMailboxMap efficiently. typedef std::multimap<Texture*, TargetName> TextureToMailboxMap; - typedef std::map<TargetName, - TextureToMailboxMap::iterator, - std::pointer_to_binary_function<const TargetName&, - const TargetName&, - bool> > MailboxToTextureMap; + typedef std::map< + TargetName, + TextureToMailboxMap::iterator, + std::pointer_to_binary_function< + const TargetName&, const TargetName&, bool> > MailboxToTextureMap; MailboxToTextureMap mailbox_to_textures_; TextureToMailboxMap textures_to_mailboxes_; @@ -80,3 +80,4 @@ class GPU_EXPORT MailboxManager : public base::RefCounted<MailboxManager> { #endif // GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_H_ + diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 37a147a..7061599 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -92,8 +92,8 @@ Texture::Texture(bool flipped, const gfx::Size& size, float device_scale_factor) Texture::~Texture() { } -gpu::Mailbox Texture::Produce() { - return gpu::Mailbox(); +std::string Texture::Produce() { + return std::string(); } CompositorLock::CompositorLock(Compositor* compositor) diff --git a/ui/compositor/compositor.gyp b/ui/compositor/compositor.gyp index a1a1b20..e1bd763 100644 --- a/ui/compositor/compositor.gyp +++ b/ui/compositor/compositor.gyp @@ -14,7 +14,6 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/cc/cc.gyp:cc', - '<(DEPTH)/gpu/gpu.gyp:command_buffer_common', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/ui/gfx/gfx.gyp:gfx', '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 21c582e..84ed365 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -40,10 +40,6 @@ class Rect; class Size; } -namespace gpu { -struct Mailbox; -} - namespace ui { class Compositor; @@ -116,12 +112,12 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { virtual unsigned int PrepareTexture() = 0; // Replaces the texture with the texture from the specified mailbox. - virtual void Consume(const gpu::Mailbox& mailbox, + virtual void Consume(const std::string& mailbox_name, const gfx::Size& new_size) {} // Moves the texture into the mailbox and returns the mailbox name. // The texture must have been previously consumed from a mailbox. - virtual gpu::Mailbox Produce(); + virtual std::string Produce(); protected: virtual ~Texture(); |