Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: content/renderer/android/synchronous_compositor_proxy.cc

Issue 1970863002: sync compositor: Memory policy async IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drop os id Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer/android/synchronous_compositor_proxy.h" 5 #include "content/renderer/android/synchronous_compositor_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "content/common/android/sync_compositor_messages.h" 10 #include "content/common/android/sync_compositor_messages.h"
(...skipping 22 matching lines...) Expand all
33 begin_frame_source_(begin_frame_source), 33 begin_frame_source_(begin_frame_source),
34 input_handler_proxy_(input_handler_proxy), 34 input_handler_proxy_(input_handler_proxy),
35 input_handler_(handler), 35 input_handler_(handler),
36 use_in_process_zero_copy_software_draw_( 36 use_in_process_zero_copy_software_draw_(
37 base::CommandLine::ForCurrentProcess()->HasSwitch( 37 base::CommandLine::ForCurrentProcess()->HasSwitch(
38 switches::kSingleProcess)), 38 switches::kSingleProcess)),
39 output_surface_(nullptr), 39 output_surface_(nullptr),
40 inside_receive_(false), 40 inside_receive_(false),
41 hardware_draw_reply_(nullptr), 41 hardware_draw_reply_(nullptr),
42 software_draw_reply_(nullptr), 42 software_draw_reply_(nullptr),
43 bytes_limit_(0u),
44 version_(0u), 43 version_(0u),
45 page_scale_factor_(0.f), 44 page_scale_factor_(0.f),
46 min_page_scale_factor_(0.f), 45 min_page_scale_factor_(0.f),
47 max_page_scale_factor_(0.f), 46 max_page_scale_factor_(0.f),
48 need_animate_scroll_(false), 47 need_animate_scroll_(false),
49 need_invalidate_count_(0u), 48 need_invalidate_count_(0u),
50 need_begin_frame_(false), 49 need_begin_frame_(false),
51 did_activate_pending_tree_count_(0u) { 50 did_activate_pending_tree_count_(0u) {
52 DCHECK(begin_frame_source_); 51 DCHECK(begin_frame_source_);
53 DCHECK(input_handler_proxy_); 52 DCHECK(input_handler_proxy_);
(...skipping 14 matching lines...) Expand all
68 if (output_surface_) { 67 if (output_surface_) {
69 output_surface_->SetSyncClient(nullptr); 68 output_surface_->SetSyncClient(nullptr);
70 output_surface_->SetTreeActivationCallback(base::Closure()); 69 output_surface_->SetTreeActivationCallback(base::Closure());
71 } 70 }
72 output_surface_ = output_surface; 71 output_surface_ = output_surface;
73 if (output_surface_) { 72 if (output_surface_) {
74 output_surface_->SetSyncClient(this); 73 output_surface_->SetSyncClient(this);
75 output_surface_->SetTreeActivationCallback( 74 output_surface_->SetTreeActivationCallback(
76 base::Bind(&SynchronousCompositorProxy::DidActivatePendingTree, 75 base::Bind(&SynchronousCompositorProxy::DidActivatePendingTree,
77 base::Unretained(this))); 76 base::Unretained(this)));
78 output_surface_->SetMemoryPolicy(bytes_limit_);
79 } 77 }
80 } 78 }
81 79
82 void SynchronousCompositorProxy::SetNeedsSynchronousAnimateInput() { 80 void SynchronousCompositorProxy::SetNeedsSynchronousAnimateInput() {
83 need_animate_scroll_ = true; 81 need_animate_scroll_ = true;
84 Invalidate(); 82 Invalidate();
85 } 83 }
86 84
87 void SynchronousCompositorProxy::UpdateRootLayerState( 85 void SynchronousCompositorProxy::UpdateRootLayerState(
88 const gfx::ScrollOffset& total_scroll_offset, 86 const gfx::ScrollOffset& total_scroll_offset,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 void SynchronousCompositorProxy::DidOverscroll( 402 void SynchronousCompositorProxy::DidOverscroll(
405 const DidOverscrollParams& did_overscroll_params) { 403 const DidOverscrollParams& did_overscroll_params) {
406 SyncCompositorCommonRendererParams params; 404 SyncCompositorCommonRendererParams params;
407 PopulateCommonParams(&params); 405 PopulateCommonParams(&params);
408 Send(new SyncCompositorHostMsg_OverScroll(routing_id_, params, 406 Send(new SyncCompositorHostMsg_OverScroll(routing_id_, params,
409 did_overscroll_params)); 407 did_overscroll_params));
410 } 408 }
411 409
412 void SynchronousCompositorProxy::ProcessCommonParams( 410 void SynchronousCompositorProxy::ProcessCommonParams(
413 const SyncCompositorCommonBrowserParams& common_params) { 411 const SyncCompositorCommonBrowserParams& common_params) {
414 if (bytes_limit_ != common_params.bytes_limit) {
415 bytes_limit_ = common_params.bytes_limit;
416 if (output_surface_)
417 output_surface_->SetMemoryPolicy(bytes_limit_);
418 }
419 if (common_params.update_root_scroll_offset && 412 if (common_params.update_root_scroll_offset &&
420 total_scroll_offset_ != common_params.root_scroll_offset) { 413 total_scroll_offset_ != common_params.root_scroll_offset) {
421 total_scroll_offset_ = common_params.root_scroll_offset; 414 total_scroll_offset_ = common_params.root_scroll_offset;
422 input_handler_proxy_->SynchronouslySetRootScrollOffset( 415 input_handler_proxy_->SynchronouslySetRootScrollOffset(
423 total_scroll_offset_); 416 total_scroll_offset_);
424 } 417 }
425 begin_frame_source_->SetBeginFrameSourcePaused( 418 begin_frame_source_->SetBeginFrameSourcePaused(
426 common_params.begin_frame_source_paused); 419 common_params.begin_frame_source_paused);
427 } 420 }
428 421
429 } // namespace content 422 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698