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 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 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.empty()) | 499 if (params.mailbox_name.IsZero()) |
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 | |
509 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, | 502 base::Closure callback = base::Bind(&InsertSyncPointAndAckForGpu, |
510 gpu_host_id, params.route_id, | 503 gpu_host_id, params.route_id, |
511 return_mailbox); | 504 current_mailbox_); |
512 | 505 BuffersSwapped(params.mailbox_name, params.size, callback); |
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); | |
519 } | 506 } |
520 | 507 |
521 void RenderWidgetHostViewAndroid::BuffersSwapped( | 508 void RenderWidgetHostViewAndroid::BuffersSwapped( |
522 const gpu::Mailbox& mailbox, | 509 const gpu::Mailbox& mailbox, |
523 const gfx::Size size, | 510 const gfx::Size size, |
524 const base::Closure& ack_callback) { | 511 const base::Closure& ack_callback) { |
525 ImageTransportFactoryAndroid* factory = | 512 ImageTransportFactoryAndroid* factory = |
526 ImageTransportFactoryAndroid::GetInstance(); | 513 ImageTransportFactoryAndroid::GetInstance(); |
527 | 514 |
528 // TODO(sievers): When running the impl thread in the browser we | 515 // TODO(sievers): When running the impl thread in the browser we |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // RenderWidgetHostView, public: | 727 // RenderWidgetHostView, public: |
741 | 728 |
742 // static | 729 // static |
743 RenderWidgetHostView* | 730 RenderWidgetHostView* |
744 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 731 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
745 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 732 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
746 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 733 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
747 } | 734 } |
748 | 735 |
749 } // namespace content | 736 } // namespace content |
OLD | NEW |