| 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/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
| 12 #include "cc/output/compositor_frame_ack.h" | 12 #include "cc/output/compositor_frame_ack.h" |
| 13 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" | |
| 14 #include "content/browser/android/in_process/synchronous_compositor_renderer_sta
tics.h" | 13 #include "content/browser/android/in_process/synchronous_compositor_renderer_sta
tics.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_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
| 17 #include "content/common/android/sync_compositor_messages.h" | 16 #include "content/common/android/sync_compositor_messages.h" |
| 18 #include "content/public/browser/android/synchronous_compositor_client.h" | 17 #include "content/public/browser/android/synchronous_compositor_client.h" |
| 19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 21 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
| 22 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 23 #include "third_party/skia/include/core/SkCanvas.h" | 22 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (output_surface_id_from_last_draw_ != output_surface_id) | 282 if (output_surface_id_from_last_draw_ != output_surface_id) |
| 284 return; | 283 return; |
| 285 returned_resources_.insert(returned_resources_.end(), | 284 returned_resources_.insert(returned_resources_.end(), |
| 286 frame_ack.resources.begin(), | 285 frame_ack.resources.begin(), |
| 287 frame_ack.resources.end()); | 286 frame_ack.resources.end()); |
| 288 } | 287 } |
| 289 | 288 |
| 290 void SynchronousCompositorHost::SetMemoryPolicy(size_t bytes_limit) { | 289 void SynchronousCompositorHost::SetMemoryPolicy(size_t bytes_limit) { |
| 291 if (bytes_limit_ == bytes_limit) | 290 if (bytes_limit_ == bytes_limit) |
| 292 return; | 291 return; |
| 293 size_t current_bytes_limit = bytes_limit_; | |
| 294 bytes_limit_ = bytes_limit; | 292 bytes_limit_ = bytes_limit; |
| 295 SendAsyncCompositorStateIfNeeded(); | 293 SendAsyncCompositorStateIfNeeded(); |
| 296 | |
| 297 if (bytes_limit && !current_bytes_limit) { | |
| 298 SynchronousCompositorStreamTextureFactoryImpl::GetInstance() | |
| 299 ->CompositorInitializedHardwareDraw(); | |
| 300 } else if (!bytes_limit && current_bytes_limit) { | |
| 301 SynchronousCompositorStreamTextureFactoryImpl::GetInstance() | |
| 302 ->CompositorReleasedHardwareDraw(); | |
| 303 } | |
| 304 } | 294 } |
| 305 | 295 |
| 306 void SynchronousCompositorHost::DidChangeRootLayerScrollOffset( | 296 void SynchronousCompositorHost::DidChangeRootLayerScrollOffset( |
| 307 const gfx::ScrollOffset& root_offset) { | 297 const gfx::ScrollOffset& root_offset) { |
| 308 if (root_scroll_offset_ == root_offset) | 298 if (root_scroll_offset_ == root_offset) |
| 309 return; | 299 return; |
| 310 root_scroll_offset_updated_by_browser_ = true; | 300 root_scroll_offset_updated_by_browser_ = true; |
| 311 root_scroll_offset_ = root_offset; | 301 root_scroll_offset_ = root_offset; |
| 312 SendAsyncCompositorStateIfNeeded(); | 302 SendAsyncCompositorStateIfNeeded(); |
| 313 } | 303 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 params.scrollable_size, params.page_scale_factor, | 453 params.scrollable_size, params.page_scale_factor, |
| 464 params.min_page_scale_factor, params.max_page_scale_factor); | 454 params.min_page_scale_factor, params.max_page_scale_factor); |
| 465 } | 455 } |
| 466 } | 456 } |
| 467 | 457 |
| 468 void SynchronousCompositorHost::UpdateNeedsBeginFrames() { | 458 void SynchronousCompositorHost::UpdateNeedsBeginFrames() { |
| 469 rwhva_->OnSetNeedsBeginFrames(is_active_ && need_begin_frame_); | 459 rwhva_->OnSetNeedsBeginFrames(is_active_ && need_begin_frame_); |
| 470 } | 460 } |
| 471 | 461 |
| 472 } // namespace content | 462 } // namespace content |
| OLD | NEW |