| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/synchronous_compositor_host.h" | 5 #include "content/browser/android/synchronous_compositor_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 SynchronousCompositorHost::SynchronousCompositorHost( | 65 SynchronousCompositorHost::SynchronousCompositorHost( |
| 66 RenderWidgetHostViewAndroid* rwhva, | 66 RenderWidgetHostViewAndroid* rwhva, |
| 67 SynchronousCompositorClient* client, | 67 SynchronousCompositorClient* client, |
| 68 bool async_input, | 68 bool async_input, |
| 69 bool use_in_proc_software_draw) | 69 bool use_in_proc_software_draw) |
| 70 : rwhva_(rwhva), | 70 : rwhva_(rwhva), |
| 71 client_(client), | 71 client_(client), |
| 72 ui_task_runner_( | 72 ui_task_runner_( |
| 73 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), | 73 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), |
| 74 routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()), | 74 routing_id_(rwhva_->GetRenderWidgetHost()->GetRoutingID()), |
| 75 process_id_(rwhva_->GetRenderWidgetHost()->GetProcess()->GetID()), |
| 75 sender_(rwhva_->GetRenderWidgetHost()), | 76 sender_(rwhva_->GetRenderWidgetHost()), |
| 76 async_input_(async_input), | 77 async_input_(async_input), |
| 77 use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), | 78 use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), |
| 78 is_active_(false), | 79 is_active_(false), |
| 79 bytes_limit_(0u), | 80 bytes_limit_(0u), |
| 80 renderer_param_version_(0u), | 81 renderer_param_version_(0u), |
| 81 need_animate_scroll_(false), | 82 need_animate_scroll_(false), |
| 82 need_invalidate_count_(0u), | 83 need_invalidate_count_(0u), |
| 83 need_begin_frame_(false), | 84 need_begin_frame_(false), |
| 84 did_activate_pending_tree_count_(0u), | 85 did_activate_pending_tree_count_(0u), |
| 85 weak_ptr_factory_(this) { | 86 weak_ptr_factory_(this) { |
| 86 client_->DidInitializeCompositor(this); | 87 client_->DidInitializeCompositor(this, process_id_, routing_id_); |
| 87 } | 88 } |
| 88 | 89 |
| 89 SynchronousCompositorHost::~SynchronousCompositorHost() { | 90 SynchronousCompositorHost::~SynchronousCompositorHost() { |
| 90 client_->DidDestroyCompositor(this); | 91 client_->DidDestroyCompositor(this, process_id_, routing_id_); |
| 91 if (weak_ptr_factory_.HasWeakPtrs()) | 92 if (weak_ptr_factory_.HasWeakPtrs()) |
| 92 UpdateStateTask(); | 93 UpdateStateTask(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { | 96 bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { |
| 96 bool handled = true; | 97 bool handled = true; |
| 97 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) | 98 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) |
| 98 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OutputSurfaceCreated, | 99 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OutputSurfaceCreated, |
| 99 OutputSurfaceCreated) | 100 OutputSurfaceCreated) |
| 100 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) | 101 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) |
| 101 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OverScroll, OnOverScroll) | 102 IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_OverScroll, OnOverScroll) |
| 102 IPC_MESSAGE_UNHANDLED(handled = false) | 103 IPC_MESSAGE_UNHANDLED(handled = false) |
| 103 IPC_END_MESSAGE_MAP() | 104 IPC_END_MESSAGE_MAP() |
| 104 return handled; | 105 return handled; |
| 105 } | 106 } |
| 106 | 107 |
| 107 void SynchronousCompositorHost::DidBecomeCurrent() { | |
| 108 client_->DidBecomeCurrent(this); | |
| 109 } | |
| 110 | |
| 111 SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( | 108 SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( |
| 112 const gfx::Size& surface_size, | 109 const gfx::Size& surface_size, |
| 113 const gfx::Transform& transform, | 110 const gfx::Transform& transform, |
| 114 const gfx::Rect& viewport, | 111 const gfx::Rect& viewport, |
| 115 const gfx::Rect& clip, | 112 const gfx::Rect& clip, |
| 116 const gfx::Rect& viewport_rect_for_tile_priority, | 113 const gfx::Rect& viewport_rect_for_tile_priority, |
| 117 const gfx::Transform& transform_for_tile_priority) { | 114 const gfx::Transform& transform_for_tile_priority) { |
| 118 SyncCompositorDemandDrawHwParams params(surface_size, transform, viewport, | 115 SyncCompositorDemandDrawHwParams params(surface_size, transform, viewport, |
| 119 clip, viewport_rect_for_tile_priority, | 116 clip, viewport_rect_for_tile_priority, |
| 120 transform_for_tile_priority); | 117 transform_for_tile_priority); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 params.scrollable_size, params.page_scale_factor, | 478 params.scrollable_size, params.page_scale_factor, |
| 482 params.min_page_scale_factor, params.max_page_scale_factor); | 479 params.min_page_scale_factor, params.max_page_scale_factor); |
| 483 } | 480 } |
| 484 } | 481 } |
| 485 | 482 |
| 486 void SynchronousCompositorHost::UpdateNeedsBeginFrames() { | 483 void SynchronousCompositorHost::UpdateNeedsBeginFrames() { |
| 487 rwhva_->OnSetNeedsBeginFrames(is_active_ && need_begin_frame_); | 484 rwhva_->OnSetNeedsBeginFrames(is_active_ && need_begin_frame_); |
| 488 } | 485 } |
| 489 | 486 |
| 490 } // namespace content | 487 } // namespace content |
| OLD | NEW |