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

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

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerTreeHostClientTakeAwayOutputSurface test. Content provider is always destroyed on the clie… Created 5 years, 3 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 77 capabilities_.draw_and_swap_full_viewport_every_frame = true;
78 capabilities_.adjust_deadline_for_parent = false; 78 capabilities_.adjust_deadline_for_parent = false;
79 capabilities_.delegated_rendering = true; 79 capabilities_.delegated_rendering = true;
80 capabilities_.max_frames_pending = 1; 80 capabilities_.max_frames_pending = 1;
81 memory_policy_.priority_cutoff_when_visible = 81 memory_policy_.priority_cutoff_when_visible =
82 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 82 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
83 } 83 }
84 84
85 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { 85 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
86 DCHECK(CalledOnValidThread());
87 if (registered_) {
88 SynchronousCompositorRegistry::GetInstance()->UnregisterOutputSurface(
89 routing_id_, this);
90 }
91 } 86 }
92 87
93 bool SynchronousCompositorOutputSurface::BindToClient( 88 bool SynchronousCompositorOutputSurface::BindToClient(
94 cc::OutputSurfaceClient* surface_client) { 89 cc::OutputSurfaceClient* surface_client) {
95 DCHECK(CalledOnValidThread()); 90 DCHECK(CalledOnValidThread());
96 if (!cc::OutputSurface::BindToClient(surface_client)) 91 if (!cc::OutputSurface::BindToClient(surface_client))
97 return false; 92 return false;
98 93
99 client_->SetMemoryPolicy(memory_policy_); 94 client_->SetMemoryPolicy(memory_policy_);
100 95
101 SynchronousCompositorRegistry::GetInstance()->RegisterOutputSurface( 96 SynchronousCompositorRegistry::GetInstance()->RegisterOutputSurface(
102 routing_id_, this); 97 routing_id_, this);
103 registered_ = true; 98 registered_ = true;
104 99
105 return true; 100 return true;
106 } 101 }
107 102
103 void SynchronousCompositorOutputSurface::DetachFromClient() {
104 DCHECK(CalledOnValidThread());
105 if (registered_) {
106 SynchronousCompositorRegistry::GetInstance()->UnregisterOutputSurface(
107 routing_id_, this);
108 }
109 cc::OutputSurface::DetachFromClient();
110 }
111
108 void SynchronousCompositorOutputSurface::SetCompositor( 112 void SynchronousCompositorOutputSurface::SetCompositor(
109 SynchronousCompositorImpl* compositor) { 113 SynchronousCompositorImpl* compositor) {
110 DCHECK(CalledOnValidThread()); 114 DCHECK(CalledOnValidThread());
111 compositor_ = compositor; 115 compositor_ = compositor;
112 } 116 }
113 117
114 void SynchronousCompositorOutputSurface::Reshape( 118 void SynchronousCompositorOutputSurface::Reshape(
115 const gfx::Size& size, float scale_factor) { 119 const gfx::Size& size, float scale_factor) {
116 // Intentional no-op: surface size is controlled by the embedder. 120 // Intentional no-op: surface size is controlled by the embedder.
117 } 121 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 283 }
280 284
281 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 285 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
282 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI 286 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI
283 // thread. 287 // thread.
284 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 288 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
285 return BrowserThread::CurrentlyOn(BrowserThread::UI); 289 return BrowserThread::CurrentlyOn(BrowserThread::UI);
286 } 290 }
287 291
288 } // namespace content 292 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698