diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 00:36:32 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 00:36:32 +0000 |
commit | 1612da9cfa90f8130e80a72bff381d8bfd68b7ef (patch) | |
tree | 28cd00a10d04817e9308187712b45c17a5045e93 /content | |
parent | 752c2868a758494c4ccea0fe6bf11ded3df5b2f3 (diff) | |
download | chromium_src-1612da9cfa90f8130e80a72bff381d8bfd68b7ef.zip chromium_src-1612da9cfa90f8130e80a72bff381d8bfd68b7ef.tar.gz chromium_src-1612da9cfa90f8130e80a72bff381d8bfd68b7ef.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
19 files changed, 63 insertions, 80 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 9e8e517..68db4d9 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 std::string& mailbox_name, + const gpu::Mailbox& mailbox, uint32 sync_point) { AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox_name = mailbox_name; + ack_params.mailbox = mailbox; 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_name, params.sync_point); + params.mailbox, 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 a986bdb..870783c 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -67,6 +67,10 @@ namespace gfx { class Range; } +namespace gpu { +struct Mailbox; +} + namespace content { class BrowserPluginHostFactory; @@ -286,7 +290,7 @@ class CONTENT_EXPORT BrowserPluginGuest // BrowserPluginGuest is already destroyed. static void AcknowledgeBufferPresent(int route_id, int gpu_host_id, - const std::string& mailbox_name, + const gpu::Mailbox& mailbox, 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 405a233..4ef9e29 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_name, + params.mailbox, params.sync_point); } diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index d72958b..6724060 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -29,6 +29,7 @@ #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" @@ -113,29 +114,27 @@ class ImageTransportClientTexture : public OwnedTexture { device_scale_factor, texture_id) {} - virtual void Consume(const std::string& mailbox_name, + virtual void Consume(const gpu::Mailbox& mailbox, const gfx::Size& new_size) OVERRIDE { - DCHECK(mailbox_name.size() == GL_MAILBOX_SIZE_CHROMIUM); - mailbox_name_ = mailbox_name; - if (mailbox_name.empty()) + mailbox_ = mailbox; + if (mailbox.IsZero()) return; DCHECK(provider_ && texture_id_); GLES2Interface* gl = provider_->ContextGL(); gl->BindTexture(GL_TEXTURE_2D, texture_id_); - gl->ConsumeTextureCHROMIUM( - GL_TEXTURE_2D, reinterpret_cast<const GLbyte*>(mailbox_name.c_str())); + gl->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); size_ = new_size; gl->ShallowFlushCHROMIUM(); } - virtual std::string Produce() OVERRIDE { return mailbox_name_; } + virtual gpu::Mailbox Produce() OVERRIDE { return mailbox_; } protected: virtual ~ImageTransportClientTexture() {} private: - std::string mailbox_name_; + gpu::Mailbox mailbox_; 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 f278e49..d67be0c 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 std::string& mailbox_name, + virtual void Consume(const gpu::Mailbox& mailbox, 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 f386df8..0378181 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_name = gpu_params.mailbox_name; + params.mailbox = gpu_params.mailbox; 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_name = params.mailbox_name; + ack_params.mailbox = params.mailbox; 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 0e26c92..eef781b 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_name = params.mailbox_name; + guest_params.mailbox = params.mailbox; 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 4d46484..ec62dff 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -288,17 +288,13 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( "GpuHostMsg_AcceleratedSurfaceBuffersSwapped")) return; AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox_name = params.mailbox_name; + ack_params.mailbox = params.mailbox; 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) @@ -338,17 +334,13 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( "GpuHostMsg_AcceleratedSurfacePostSubBuffer")) return; AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.mailbox_name = params.mailbox_name; + ack_params.mailbox = params.mailbox; 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 81245e5..2a926bc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -327,10 +327,7 @@ void SendCompositorFrameAck( DCHECK(!texture_to_produce.get() || !skip_frame); if (texture_to_produce.get()) { GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); - 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->mailbox = texture_to_produce->Produce(); ack.gl_frame_data->size = texture_to_produce->size(); ack.gl_frame_data->sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; @@ -348,7 +345,7 @@ void SendCompositorFrameAck( void AcknowledgeBufferForGpu( int32 route_id, int gpu_host_id, - const std::string& received_mailbox, + const gpu::Mailbox& received_mailbox, bool skip_frame, const scoped_refptr<ui::Texture>& texture_to_produce) { AcceleratedSurfaceMsg_BufferPresented_Params ack; @@ -356,10 +353,10 @@ void AcknowledgeBufferForGpu( DCHECK(!texture_to_produce.get() || !skip_frame); if (texture_to_produce.get()) { GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); - ack.mailbox_name = texture_to_produce->Produce(); + ack.mailbox = texture_to_produce->Produce(); sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0; } else if (skip_frame) { - ack.mailbox_name = received_mailbox; + ack.mailbox = received_mailbox; ack.sync_point = 0; } @@ -1302,7 +1299,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( const gfx::Rect& surface_rect, float surface_scale_factor, const gfx::Rect& damage_rect, - const std::string& mailbox_name, + const gpu::Mailbox& mailbox, const BufferPresentedCallback& ack_callback) { if (last_swapped_surface_size_ != surface_rect.size()) { // The surface could have shrunk since we skipped an update, in which @@ -1315,7 +1312,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( if (ShouldSkipFrame(ConvertSizeToDIP(surface_scale_factor, surface_rect.size())) || - mailbox_name.empty()) { + mailbox.IsZero()) { skipped_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op); ack_callback.Run(true, scoped_refptr<ui::Texture>()); return false; @@ -1330,7 +1327,7 @@ bool RenderWidgetHostViewAura::SwapBuffersPrepare( return false; } - current_surface_->Consume(mailbox_name, surface_rect.size()); + current_surface_->Consume(mailbox, surface_rect.size()); released_front_lock_ = NULL; UpdateExternalTexture(); @@ -1396,11 +1393,11 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( &AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, - params_in_pixel.mailbox_name); + params_in_pixel.mailbox); BuffersSwapped(params_in_pixel.size, gfx::Rect(params_in_pixel.size), params_in_pixel.scale_factor, - params_in_pixel.mailbox_name, + params_in_pixel.mailbox, params_in_pixel.latency_info, ack_callback); } @@ -1691,13 +1688,10 @@ 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, - mailbox_name, + frame->gl_frame_data->mailbox, frame->metadata.latency_info, ack_callback); } @@ -1725,7 +1719,7 @@ void RenderWidgetHostViewAura::BuffersSwapped( const gfx::Size& surface_size, const gfx::Rect& damage_rect, float surface_scale_factor, - const std::string& mailbox_name, + const gpu::Mailbox& mailbox, const std::vector<ui::LatencyInfo>& latency_info, const BufferPresentedCallback& ack_callback) { scoped_refptr<ui::Texture> previous_texture(current_surface_); @@ -1735,7 +1729,7 @@ void RenderWidgetHostViewAura::BuffersSwapped( if (!SwapBuffersPrepare(surface_rect, surface_scale_factor, damage_rect, - mailbox_name, + mailbox, ack_callback)) { return; } @@ -1802,11 +1796,11 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( base::Bind(&AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, - params_in_pixel.mailbox_name); + params_in_pixel.mailbox); BuffersSwapped(params_in_pixel.surface_size, damage_rect, params_in_pixel.surface_scale_factor, - params_in_pixel.mailbox_name, + params_in_pixel.mailbox, 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 3c3757d..0e01067 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -60,6 +60,10 @@ class Canvas; class Display; } +namespace gpu { +struct Mailbox; +} + namespace ui { class CompositorLock; class CompositorVSyncManager; @@ -530,14 +534,14 @@ class CONTENT_EXPORT RenderWidgetHostViewAura void BuffersSwapped(const gfx::Size& surface_size, const gfx::Rect& damage_rect, float surface_scale_factor, - const std::string& mailbox_name, + const gpu::Mailbox& mailbox, 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 std::string& mailbox_name, + const gpu::Mailbox& mailbox, 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 6911f28..cd5cb3f 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(); - params.mailbox_name = std::string(64, '1'); + memset(params.mailbox.name, '1', sizeof(params.mailbox.name)); 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(); - post_params.mailbox_name = std::string(64, '1'); + memset(post_params.mailbox.name, '1', sizeof(post_params.mailbox.name)); 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 2cd44e7..3f37975 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(std::string, mailbox_name) + IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) 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(std::string, mailbox_name) + IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) 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 7754ec3..2db1a1d 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(std::string, mailbox_name) + IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) 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(std::string, mailbox_name) + IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) 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(std::string, mailbox_name) + IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox) 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 f13a986..30a54fb 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -218,9 +218,7 @@ bool TextureImageTransportSurface::SwapBuffers() { GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; params.size = backbuffer_size(); params.scale_factor = scale_factor_; - params.mailbox_name.assign( - reinterpret_cast<const char*>(&back_mailbox_), - sizeof(back_mailbox_)); + params.mailbox = back_mailbox_; glFlush(); @@ -258,9 +256,7 @@ bool TextureImageTransportSurface::PostSubBuffer( params.y = y; params.width = width; params.height = height; - params.mailbox_name.assign( - reinterpret_cast<const char*>(&back_mailbox_), - sizeof(back_mailbox_)); + params.mailbox = back_mailbox_; glFlush(); @@ -294,18 +290,17 @@ unsigned TextureImageTransportSurface::GetFormat() { void TextureImageTransportSurface::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) { if (params.sync_point == 0) { - BufferPresentedImpl(params.mailbox_name); + BufferPresentedImpl(params.mailbox); } else { helper_->manager()->sync_point_manager()->AddSyncPointCallback( params.sync_point, base::Bind(&TextureImageTransportSurface::BufferPresentedImpl, this, - params.mailbox_name)); + params.mailbox)); } } -void TextureImageTransportSurface::BufferPresentedImpl( - const std::string& mailbox_name) { +void TextureImageTransportSurface::BufferPresentedImpl(const Mailbox& mailbox) { DCHECK(is_swap_buffers_pending_); is_swap_buffers_pending_ = false; @@ -321,11 +316,8 @@ void TextureImageTransportSurface::BufferPresentedImpl( DCHECK(backbuffer_.get()); bool swap = true; - if (!mailbox_name.empty()) { - DCHECK(mailbox_name.length() == GL_MAILBOX_SIZE_CHROMIUM); - if (!memcmp(mailbox_name.data(), - &back_mailbox_, - mailbox_name.length())) { + if (!mailbox.IsZero()) { + if (mailbox != back_mailbox_) { // 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 ab3eb44..a86ff27 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 std::string& mailbox_name); + void BufferPresentedImpl(const gpu::Mailbox& 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 974c3b0..3d20a6e 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_name, + params.mailbox, 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 15cf383..cc3bc50 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc @@ -246,12 +246,10 @@ 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_name = mailbox_name; + params.mailbox = mailbox.name; params.sync_point = sync_point; SendBuffersSwappedACKToBrowser(params); break; @@ -378,12 +376,12 @@ void ChildFrameCompositingHelper::OnBuffersSwappedPrivate( void ChildFrameCompositingHelper::OnBuffersSwapped( const gfx::Size& size, - const std::string& mailbox_name, + const gpu::Mailbox& mailbox, int gpu_route_id, int gpu_host_id, float device_scale_factor) { SwapBuffersInfo swap_info; - swap_info.name.SetName(reinterpret_cast<const int8*>(mailbox_name.data())); + swap_info.name = mailbox; 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 686d9a2..1ec0585 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 std::string& mailbox_name, + const gpu::Mailbox& mailbox, 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 1b13f68..af5e0d5 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_name, + params.mailbox, params.gpu_route_id, params.gpu_host_id, render_view_->GetWebView()->deviceScaleFactor()); |