| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "cc/output/compositor_frame_ack.h" | |
| 15 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 14 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 16 #include "content/browser/web_contents/web_contents_android.h" | 15 #include "content/browser/web_contents/web_contents_android.h" |
| 17 #include "content/browser/web_contents/web_contents_impl.h" | 16 #include "content/browser/web_contents/web_contents_impl.h" |
| 18 #include "content/common/android/sync_compositor_messages.h" | 17 #include "content/common/android/sync_compositor_messages.h" |
| 19 #include "content/common/android/sync_compositor_statics.h" | 18 #include "content/common/android/sync_compositor_statics.h" |
| 20 #include "content/public/browser/android/synchronous_compositor_client.h" | 19 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 24 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 ProcessCommonParams(common_renderer_params); | 277 ProcessCommonParams(common_renderer_params); |
| 279 } | 278 } |
| 280 | 279 |
| 281 void SynchronousCompositorHost::SendZeroMemory() { | 280 void SynchronousCompositorHost::SendZeroMemory() { |
| 282 // No need to check return value. | 281 // No need to check return value. |
| 283 sender_->Send(new SyncCompositorMsg_ZeroSharedMemory(routing_id_)); | 282 sender_->Send(new SyncCompositorMsg_ZeroSharedMemory(routing_id_)); |
| 284 } | 283 } |
| 285 | 284 |
| 286 void SynchronousCompositorHost::ReturnResources( | 285 void SynchronousCompositorHost::ReturnResources( |
| 287 uint32_t output_surface_id, | 286 uint32_t output_surface_id, |
| 288 const cc::CompositorFrameAck& frame_ack) { | 287 const cc::ReturnedResourceArray& resources) { |
| 289 DCHECK(!frame_ack.resources.empty()); | 288 DCHECK(!resources.empty()); |
| 290 sender_->Send(new SyncCompositorMsg_ReclaimResources( | 289 sender_->Send(new SyncCompositorMsg_ReclaimResources( |
| 291 routing_id_, output_surface_id, frame_ack)); | 290 routing_id_, output_surface_id, resources)); |
| 292 } | 291 } |
| 293 | 292 |
| 294 void SynchronousCompositorHost::SetMemoryPolicy(size_t bytes_limit) { | 293 void SynchronousCompositorHost::SetMemoryPolicy(size_t bytes_limit) { |
| 295 if (bytes_limit_ == bytes_limit) | 294 if (bytes_limit_ == bytes_limit) |
| 296 return; | 295 return; |
| 297 | 296 |
| 298 if (sender_->Send( | 297 if (sender_->Send( |
| 299 new SyncCompositorMsg_SetMemoryPolicy(routing_id_, bytes_limit))) { | 298 new SyncCompositorMsg_SetMemoryPolicy(routing_id_, bytes_limit))) { |
| 300 bytes_limit_ = bytes_limit; | 299 bytes_limit_ = bytes_limit; |
| 301 } | 300 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (params.page_scale_factor) { | 381 if (params.page_scale_factor) { |
| 383 client_->UpdateRootLayerState( | 382 client_->UpdateRootLayerState( |
| 384 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), | 383 this, gfx::ScrollOffsetToVector2dF(params.total_scroll_offset), |
| 385 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), | 384 gfx::ScrollOffsetToVector2dF(params.max_scroll_offset), |
| 386 params.scrollable_size, params.page_scale_factor, | 385 params.scrollable_size, params.page_scale_factor, |
| 387 params.min_page_scale_factor, params.max_page_scale_factor); | 386 params.min_page_scale_factor, params.max_page_scale_factor); |
| 388 } | 387 } |
| 389 } | 388 } |
| 390 | 389 |
| 391 } // namespace content | 390 } // namespace content |
| OLD | NEW |