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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 12440005: Use gpu::Mailbox in IPCs instead of std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 #include "ui/gfx/display.h" 33 #include "ui/gfx/display.h"
34 #include "ui/gfx/screen.h" 34 #include "ui/gfx/screen.h"
35 #include "ui/gfx/size_conversions.h" 35 #include "ui/gfx/size_conversions.h"
36 #include "webkit/compositor_bindings/web_compositor_support_impl.h" 36 #include "webkit/compositor_bindings/web_compositor_support_impl.h"
37 37
38 namespace content { 38 namespace content {
39 39
40 namespace { 40 namespace {
41 41
42 void InsertSyncPointAndAckForGpu( 42 void InsertSyncPointAndAckForGpu(
43 int gpu_host_id, int route_id, const std::string& return_mailbox) { 43 int gpu_host_id, int route_id, const gpu::Mailbox& return_mailbox) {
44 uint32 sync_point = 44 uint32 sync_point =
45 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint(); 45 ImageTransportFactoryAndroid::GetInstance()->InsertSyncPoint();
46 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 46 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
47 ack_params.mailbox_name = return_mailbox; 47 ack_params.mailbox_name = return_mailbox;
48 ack_params.sync_point = sync_point; 48 ack_params.sync_point = sync_point;
49 RenderWidgetHostImpl::AcknowledgeBufferPresent( 49 RenderWidgetHostImpl::AcknowledgeBufferPresent(
50 route_id, gpu_host_id, ack_params); 50 route_id, gpu_host_id, ack_params);
51 } 51 }
52 52
53 void InsertSyncPointAndAckForCompositor( 53 void InsertSyncPointAndAckForCompositor(
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 BuffersSwapped( 497 BuffersSwapped(
498 frame->gl_frame_data->mailbox, frame->gl_frame_data->size, callback); 498 frame->gl_frame_data->mailbox, frame->gl_frame_data->size, callback);
499 499
500 } 500 }
501 501
502 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( 502 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped(
503 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 503 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
504 int gpu_host_id) { 504 int gpu_host_id) {
505 NOTREACHED() << "Deprecated. Use --composite-to-mailbox."; 505 NOTREACHED() << "Deprecated. Use --composite-to-mailbox.";
506 506
507 if (params.mailbox_name.empty()) 507 if (params.mailbox_name.IsZero())
508 return; 508 return;
509 509
510 std::string return_mailbox;
511 if (!current_mailbox_.IsZero()) {
512 return_mailbox.assign(
513 reinterpret_cast<const char*>(current_mailbox_.name),
514 sizeof(current_mailbox_.name));
515 }
516
517 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, 510 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu,
518 gpu_host_id, params.route_id, 511 gpu_host_id, params.route_id,
519 return_mailbox); 512 current_mailbox_);
520 513 BuffersSwapped(params.mailbox_name, params.size, callback);
521 gpu::Mailbox mailbox;
522 std::copy(params.mailbox_name.data(),
523 params.mailbox_name.data() + params.mailbox_name.length(),
524 reinterpret_cast<char*>(mailbox.name));
525
526 BuffersSwapped(mailbox, params.size, callback);
527 } 514 }
528 515
529 void RenderWidgetHostViewAndroid::BuffersSwapped( 516 void RenderWidgetHostViewAndroid::BuffersSwapped(
530 const gpu::Mailbox& mailbox, 517 const gpu::Mailbox& mailbox,
531 const gfx::Size size, 518 const gfx::Size size,
532 const base::Closure& ack_callback) { 519 const base::Closure& ack_callback) {
533 ImageTransportFactoryAndroid* factory = 520 ImageTransportFactoryAndroid* factory =
534 ImageTransportFactoryAndroid::GetInstance(); 521 ImageTransportFactoryAndroid::GetInstance();
535 522
536 // TODO(sievers): When running the impl thread in the browser we 523 // TODO(sievers): When running the impl thread in the browser we
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // RenderWidgetHostView, public: 730 // RenderWidgetHostView, public:
744 731
745 // static 732 // static
746 RenderWidgetHostView* 733 RenderWidgetHostView*
747 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 734 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
748 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 735 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
749 return new RenderWidgetHostViewAndroid(rwhi, NULL); 736 return new RenderWidgetHostViewAndroid(rwhi, NULL);
750 } 737 }
751 738
752 } // namespace content 739 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory.cc ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698