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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_output_surface.cc

Issue 643993005: Remove limit on number of resources in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no cc change Created 6 years, 1 month 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 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/browser/android/in_process/synchronous_compositor_output_surfa ce.h" 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/output/begin_frame_args.h" 9 #include "cc/output/begin_frame_args.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/context_provider.h" 11 #include "cc/output/context_provider.h"
12 #include "cc/output/output_surface_client.h" 12 #include "cc/output/output_surface_client.h"
13 #include "cc/output/software_output_device.h" 13 #include "cc/output/software_output_device.h"
14 #include "content/browser/android/in_process/synchronous_compositor_impl.h" 14 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
15 #include "content/browser/gpu/compositor_util.h" 15 #include "content/browser/gpu/compositor_util.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/renderer/gpu/frame_swap_message_queue.h" 17 #include "content/renderer/gpu/frame_swap_message_queue.h"
18 #include "gpu/command_buffer/client/gles2_interface.h" 18 #include "gpu/command_buffer/client/gles2_interface.h"
19 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 19 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
20 #include "third_party/skia/include/core/SkCanvas.h" 20 #include "third_party/skia/include/core/SkCanvas.h"
21 #include "ui/gfx/rect_conversions.h" 21 #include "ui/gfx/rect_conversions.h"
22 #include "ui/gfx/skia_util.h" 22 #include "ui/gfx/skia_util.h"
23 #include "ui/gfx/transform.h" 23 #include "ui/gfx/transform.h"
24 24
25 namespace content { 25 namespace content {
26 26
27 namespace { 27 namespace {
28 28
29 // Do not limit number of resources, so use an unrealistically high value.
30 const size_t kNumResourcesLimit = 10 * 1000 * 1000;
31
29 void DidActivatePendingTree(int routing_id) { 32 void DidActivatePendingTree(int routing_id) {
30 SynchronousCompositorOutputSurfaceDelegate* delegate = 33 SynchronousCompositorOutputSurfaceDelegate* delegate =
31 SynchronousCompositorImpl::FromRoutingID(routing_id); 34 SynchronousCompositorImpl::FromRoutingID(routing_id);
32 if (delegate) 35 if (delegate)
33 delegate->DidActivatePendingTree(); 36 delegate->DidActivatePendingTree();
34 } 37 }
35 38
36 } // namespace 39 } // namespace
37 40
38 class SynchronousCompositorOutputSurface::SoftwareDevice 41 class SynchronousCompositorOutputSurface::SoftwareDevice
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); 264 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate();
262 if (delegate) 265 if (delegate)
263 delegate->SetContinuousInvalidate(needs_begin_frame_); 266 delegate->SetContinuousInvalidate(needs_begin_frame_);
264 } 267 }
265 268
266 void SynchronousCompositorOutputSurface::ReturnResources( 269 void SynchronousCompositorOutputSurface::ReturnResources(
267 const cc::CompositorFrameAck& frame_ack) { 270 const cc::CompositorFrameAck& frame_ack) {
268 ReclaimResources(&frame_ack); 271 ReclaimResources(&frame_ack);
269 } 272 }
270 273
271 void SynchronousCompositorOutputSurface::SetMemoryPolicy( 274 void SynchronousCompositorOutputSurface::SetMemoryPolicy(size_t bytes_limit) {
272 const SynchronousCompositorMemoryPolicy& policy) {
273 DCHECK(CalledOnValidThread()); 275 DCHECK(CalledOnValidThread());
274 memory_policy_.bytes_limit_when_visible = policy.bytes_limit; 276 memory_policy_.bytes_limit_when_visible = bytes_limit;
275 memory_policy_.num_resources_limit = policy.num_resources_limit; 277 memory_policy_.num_resources_limit = kNumResourcesLimit;
276 278
277 if (output_surface_client_) 279 if (output_surface_client_)
278 output_surface_client_->SetMemoryPolicy(memory_policy_); 280 output_surface_client_->SetMemoryPolicy(memory_policy_);
279 } 281 }
280 282
281 void SynchronousCompositorOutputSurface::GetMessagesToDeliver( 283 void SynchronousCompositorOutputSurface::GetMessagesToDeliver(
282 ScopedVector<IPC::Message>* messages) { 284 ScopedVector<IPC::Message>* messages) {
283 DCHECK(CalledOnValidThread()); 285 DCHECK(CalledOnValidThread());
284 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = 286 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope =
285 frame_swap_message_queue_->AcquireSendMessageScope(); 287 frame_swap_message_queue_->AcquireSendMessageScope();
286 frame_swap_message_queue_->DrainMessages(messages); 288 frame_swap_message_queue_->DrainMessages(messages);
287 } 289 }
288 290
289 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 291 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
290 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI 292 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI
291 // thread. 293 // thread.
292 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 294 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
293 return BrowserThread::CurrentlyOn(BrowserThread::UI); 295 return BrowserThread::CurrentlyOn(BrowserThread::UI);
294 } 296 }
295 297
296 SynchronousCompositorOutputSurfaceDelegate* 298 SynchronousCompositorOutputSurfaceDelegate*
297 SynchronousCompositorOutputSurface::GetDelegate() { 299 SynchronousCompositorOutputSurface::GetDelegate() {
298 return SynchronousCompositorImpl::FromRoutingID(routing_id_); 300 return SynchronousCompositorImpl::FromRoutingID(routing_id_);
299 } 301 }
300 302
301 } // namespace content 303 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_output_surface.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698