OLD | NEW |
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 Loading... |
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 gpu::Mailbox& return_mailbox) { | 43 int gpu_host_id, int route_id, const std::string& 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 ImageTransportFactoryAndroid::GetInstance()->WaitSyncPoint( | 489 ImageTransportFactoryAndroid::GetInstance()->WaitSyncPoint( |
490 frame->gl_frame_data->sync_point); | 490 frame->gl_frame_data->sync_point); |
491 BuffersSwapped( | 491 BuffersSwapped( |
492 frame->gl_frame_data->mailbox, frame->gl_frame_data->size, callback); | 492 frame->gl_frame_data->mailbox, frame->gl_frame_data->size, callback); |
493 | 493 |
494 } | 494 } |
495 | 495 |
496 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( | 496 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( |
497 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 497 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
498 int gpu_host_id) { | 498 int gpu_host_id) { |
499 if (params.mailbox_name.IsZero()) | 499 if (params.mailbox_name.empty()) |
500 return; | 500 return; |
501 | 501 |
| 502 std::string return_mailbox; |
| 503 if (!current_mailbox_.IsZero()) { |
| 504 return_mailbox.assign( |
| 505 reinterpret_cast<const char*>(current_mailbox_.name), |
| 506 sizeof(current_mailbox_.name)); |
| 507 } |
| 508 |
502 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, | 509 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, |
503 gpu_host_id, params.route_id, | 510 gpu_host_id, params.route_id, |
504 current_mailbox_); | 511 return_mailbox); |
505 BuffersSwapped(params.mailbox_name, params.size, callback); | 512 |
| 513 gpu::Mailbox mailbox; |
| 514 std::copy(params.mailbox_name.data(), |
| 515 params.mailbox_name.data() + params.mailbox_name.length(), |
| 516 reinterpret_cast<char*>(mailbox.name)); |
| 517 |
| 518 BuffersSwapped(mailbox, params.size, callback); |
506 } | 519 } |
507 | 520 |
508 void RenderWidgetHostViewAndroid::BuffersSwapped( | 521 void RenderWidgetHostViewAndroid::BuffersSwapped( |
509 const gpu::Mailbox& mailbox, | 522 const gpu::Mailbox& mailbox, |
510 const gfx::Size size, | 523 const gfx::Size size, |
511 const base::Closure& ack_callback) { | 524 const base::Closure& ack_callback) { |
512 ImageTransportFactoryAndroid* factory = | 525 ImageTransportFactoryAndroid* factory = |
513 ImageTransportFactoryAndroid::GetInstance(); | 526 ImageTransportFactoryAndroid::GetInstance(); |
514 | 527 |
515 // TODO(sievers): When running the impl thread in the browser we | 528 // TODO(sievers): When running the impl thread in the browser we |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 // RenderWidgetHostView, public: | 735 // RenderWidgetHostView, public: |
723 | 736 |
724 // static | 737 // static |
725 RenderWidgetHostView* | 738 RenderWidgetHostView* |
726 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 739 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
727 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 740 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
728 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 741 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
729 } | 742 } |
730 | 743 |
731 } // namespace content | 744 } // namespace content |
OLD | NEW |