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

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

Issue 1394263004: android webview: allow cc to fail hardware draw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests compile but crash Created 5 years, 2 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 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/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) 67 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue)
68 : cc::OutputSurface( 68 : cc::OutputSurface(
69 context_provider, 69 context_provider,
70 worker_context_provider, 70 worker_context_provider,
71 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), 71 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
72 routing_id_(routing_id), 72 routing_id_(routing_id),
73 registered_(false), 73 registered_(false),
74 current_sw_canvas_(nullptr), 74 current_sw_canvas_(nullptr),
75 memory_policy_(0), 75 memory_policy_(0),
76 frame_swap_message_queue_(frame_swap_message_queue) { 76 frame_swap_message_queue_(frame_swap_message_queue) {
77 capabilities_.draw_and_swap_full_viewport_every_frame = true;
78 capabilities_.adjust_deadline_for_parent = false; 77 capabilities_.adjust_deadline_for_parent = false;
79 capabilities_.delegated_rendering = true; 78 capabilities_.delegated_rendering = true;
80 capabilities_.max_frames_pending = 1; 79 capabilities_.max_frames_pending = 1;
81 memory_policy_.priority_cutoff_when_visible = 80 memory_policy_.priority_cutoff_when_visible =
82 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 81 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
83 } 82 }
84 83
85 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { 84 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
86 } 85 }
87 86
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 DCHECK(!frame_holder_.get()); 205 DCHECK(!frame_holder_.get());
207 206
208 gfx::Transform adjusted_transform = transform; 207 gfx::Transform adjusted_transform = transform;
209 AdjustTransform(&adjusted_transform, viewport); 208 AdjustTransform(&adjusted_transform, viewport);
210 SetExternalDrawConstraints(adjusted_transform, 209 SetExternalDrawConstraints(adjusted_transform,
211 viewport, 210 viewport,
212 clip, 211 clip,
213 viewport_rect_for_tile_priority, 212 viewport_rect_for_tile_priority,
214 transform_for_tile_priority, 213 transform_for_tile_priority,
215 !hardware_draw); 214 !hardware_draw);
216 SetNeedsRedrawRect(gfx::Rect(viewport.size())); 215 if (!hardware_draw) {
216 SetNeedsRedrawRect(gfx::Rect(viewport.size()));
217 }
217 218
218 client_->OnDraw(); 219 client_->OnDraw();
219 220
220 // After software draws (which might move the viewport arbitrarily), restore 221 // After software draws (which might move the viewport arbitrarily), restore
221 // the previous hardware viewport to allow CC's tile manager to prioritize 222 // the previous hardware viewport to allow CC's tile manager to prioritize
222 // properly. 223 // properly.
223 if (hardware_draw) { 224 if (hardware_draw) {
224 cached_hw_transform_ = adjusted_transform; 225 cached_hw_transform_ = adjusted_transform;
225 cached_hw_viewport_ = viewport; 226 cached_hw_viewport_ = viewport;
226 cached_hw_clip_ = clip; 227 cached_hw_clip_ = clip;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 284 }
284 285
285 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 286 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
286 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI 287 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI
287 // thread. 288 // thread.
288 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 289 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
289 return BrowserThread::CurrentlyOn(BrowserThread::UI); 290 return BrowserThread::CurrentlyOn(BrowserThread::UI);
290 } 291 }
291 292
292 } // namespace content 293 } // namespace content
OLDNEW
« cc/scheduler/scheduler_state_machine.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698