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

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

Issue 2035993003: Android WebView: Always send memory policy from Browser to Renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « content/browser/android/synchronous_compositor_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_output_surface.h" 5 #include "content/renderer/android/synchronous_compositor_output_surface.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 memory_policy_.priority_cutoff_when_visible = 99 memory_policy_.priority_cutoff_when_visible =
100 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 100 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
101 } 101 }
102 102
103 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {} 103 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {}
104 104
105 void SynchronousCompositorOutputSurface::SetSyncClient( 105 void SynchronousCompositorOutputSurface::SetSyncClient(
106 SynchronousCompositorOutputSurfaceClient* compositor) { 106 SynchronousCompositorOutputSurfaceClient* compositor) {
107 DCHECK(CalledOnValidThread()); 107 DCHECK(CalledOnValidThread());
108 sync_client_ = compositor; 108 sync_client_ = compositor;
109 Send(new SyncCompositorHostMsg_OutputSurfaceCreated(routing_id_));
boliu 2016/06/04 00:47:01 only do this if sync_client_ is not null
109 } 110 }
110 111
111 bool SynchronousCompositorOutputSurface::OnMessageReceived( 112 bool SynchronousCompositorOutputSurface::OnMessageReceived(
112 const IPC::Message& message) { 113 const IPC::Message& message) {
113 bool handled = true; 114 bool handled = true;
114 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorOutputSurface, message) 115 IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorOutputSurface, message)
115 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetMemoryPolicy, SetMemoryPolicy) 116 IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetMemoryPolicy, SetMemoryPolicy)
116 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ReclaimResources, OnReclaimResources) 117 IPC_MESSAGE_HANDLER(SyncCompositorMsg_ReclaimResources, OnReclaimResources)
117 IPC_MESSAGE_UNHANDLED(handled = false) 118 IPC_MESSAGE_UNHANDLED(handled = false)
118 IPC_END_MESSAGE_MAP() 119 IPC_END_MESSAGE_MAP()
119 return handled; 120 return handled;
120 } 121 }
121 122
122 bool SynchronousCompositorOutputSurface::BindToClient( 123 bool SynchronousCompositorOutputSurface::BindToClient(
123 cc::OutputSurfaceClient* surface_client) { 124 cc::OutputSurfaceClient* surface_client) {
124 DCHECK(CalledOnValidThread()); 125 DCHECK(CalledOnValidThread());
125 if (!cc::OutputSurface::BindToClient(surface_client)) 126 if (!cc::OutputSurface::BindToClient(surface_client))
126 return false; 127 return false;
127 128
128 client_->SetMemoryPolicy(memory_policy_); 129 client_->SetMemoryPolicy(memory_policy_);
129 client_->SetTreeActivationCallback( 130 client_->SetTreeActivationCallback(
130 base::Bind(&SynchronousCompositorOutputSurface::DidActivatePendingTree, 131 base::Bind(&SynchronousCompositorOutputSurface::DidActivatePendingTree,
131 base::Unretained(this))); 132 base::Unretained(this)));
132 registry_->RegisterOutputSurface(routing_id_, this); 133 registry_->RegisterOutputSurface(routing_id_, this);
133 registered_ = true; 134 registered_ = true;
134 Send(new SyncCompositorHostMsg_OutputSurfaceCreated(routing_id_));
135 return true; 135 return true;
136 } 136 }
137 137
138 void SynchronousCompositorOutputSurface::DetachFromClient() { 138 void SynchronousCompositorOutputSurface::DetachFromClient() {
139 DCHECK(CalledOnValidThread()); 139 DCHECK(CalledOnValidThread());
140 if (registered_) { 140 if (registered_) {
141 registry_->UnregisterOutputSurface(routing_id_, this); 141 registry_->UnregisterOutputSurface(routing_id_, this);
142 } 142 }
143 client_->SetTreeActivationCallback(base::Closure()); 143 client_->SetTreeActivationCallback(base::Closure());
144 cc::OutputSurface::DetachFromClient(); 144 cc::OutputSurface::DetachFromClient();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 bool SynchronousCompositorOutputSurface::Send(IPC::Message* message) { 303 bool SynchronousCompositorOutputSurface::Send(IPC::Message* message) {
304 DCHECK(CalledOnValidThread()); 304 DCHECK(CalledOnValidThread());
305 return sender_->Send(message); 305 return sender_->Send(message);
306 } 306 }
307 307
308 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 308 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
309 return thread_checker_.CalledOnValidThread(); 309 return thread_checker_.CalledOnValidThread();
310 } 310 }
311 311
312 } // namespace content 312 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/synchronous_compositor_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698