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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11369071: A speculative Revert for r165872 - Remove static thread pointers from CC, attempt 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host.h" 7 #include "cc/layer_tree_host.h"
8 8
9 #include "Region.h" 9 #include "Region.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "cc/font_atlas.h" 12 #include "cc/font_atlas.h"
13 #include "cc/graphics_context.h" 13 #include "cc/graphics_context.h"
14 #include "cc/heads_up_display_layer.h" 14 #include "cc/heads_up_display_layer.h"
15 #include "cc/heads_up_display_layer_impl.h" 15 #include "cc/heads_up_display_layer_impl.h"
16 #include "cc/layer.h" 16 #include "cc/layer.h"
17 #include "cc/layer_animation_controller.h" 17 #include "cc/layer_animation_controller.h"
18 #include "cc/layer_iterator.h" 18 #include "cc/layer_iterator.h"
19 #include "cc/layer_tree_host_client.h" 19 #include "cc/layer_tree_host_client.h"
20 #include "cc/layer_tree_host_common.h" 20 #include "cc/layer_tree_host_common.h"
21 #include "cc/layer_tree_host_impl.h" 21 #include "cc/layer_tree_host_impl.h"
22 #include "cc/math_util.h" 22 #include "cc/math_util.h"
23 #include "cc/occlusion_tracker.h" 23 #include "cc/occlusion_tracker.h"
24 #include "cc/overdraw_metrics.h" 24 #include "cc/overdraw_metrics.h"
25 #include "cc/settings.h" 25 #include "cc/settings.h"
26 #include "cc/single_thread_proxy.h" 26 #include "cc/single_thread_proxy.h"
27 #include "cc/thread.h"
28 #include "cc/thread_proxy.h" 27 #include "cc/thread_proxy.h"
29 #include "cc/tree_synchronizer.h" 28 #include "cc/tree_synchronizer.h"
30 29
31 using namespace std; 30 using namespace std;
32 31
33 namespace { 32 namespace {
34 static int numLayerTreeInstances; 33 static int numLayerTreeInstances;
35 } 34 }
36 35
37 namespace cc { 36 namespace cc {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 76
78 RendererCapabilities::~RendererCapabilities() 77 RendererCapabilities::~RendererCapabilities()
79 { 78 {
80 } 79 }
81 80
82 bool LayerTreeHost::anyLayerTreeHostInstanceExists() 81 bool LayerTreeHost::anyLayerTreeHostInstanceExists()
83 { 82 {
84 return numLayerTreeInstances > 0; 83 return numLayerTreeInstances > 0;
85 } 84 }
86 85
87 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con st LayerTreeSettings& settings, scoped_ptr<Thread> implThread) 86 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con st LayerTreeSettings& settings)
88 { 87 {
89 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)) ; 88 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)) ;
90 if (!layerTreeHost->initialize(implThread.Pass())) 89 if (!layerTreeHost->initialize())
91 return scoped_ptr<LayerTreeHost>(); 90 return scoped_ptr<LayerTreeHost>();
92 return layerTreeHost.Pass(); 91 return layerTreeHost.Pass();
93 } 92 }
94 93
95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings) 94 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings)
96 : m_animating(false) 95 : m_animating(false)
97 , m_needsAnimateLayers(false) 96 , m_needsAnimateLayers(false)
98 , m_client(client) 97 , m_client(client)
99 , m_commitNumber(0) 98 , m_commitNumber(0)
100 , m_renderingStats() 99 , m_renderingStats()
101 , m_rendererInitialized(false) 100 , m_rendererInitialized(false)
102 , m_contextLost(false) 101 , m_contextLost(false)
103 , m_numTimesRecreateShouldFail(0) 102 , m_numTimesRecreateShouldFail(0)
104 , m_numFailedRecreateAttempts(0) 103 , m_numFailedRecreateAttempts(0)
105 , m_settings(settings) 104 , m_settings(settings)
106 , m_deviceScaleFactor(1) 105 , m_deviceScaleFactor(1)
107 , m_visible(true) 106 , m_visible(true)
108 , m_pageScaleFactor(1) 107 , m_pageScaleFactor(1)
109 , m_minPageScaleFactor(1) 108 , m_minPageScaleFactor(1)
110 , m_maxPageScaleFactor(1) 109 , m_maxPageScaleFactor(1)
111 , m_triggerIdleUpdates(true) 110 , m_triggerIdleUpdates(true)
112 , m_backgroundColor(SK_ColorWHITE) 111 , m_backgroundColor(SK_ColorWHITE)
113 , m_hasTransparentBackground(false) 112 , m_hasTransparentBackground(false)
114 , m_partialTextureUpdateRequests(0) 113 , m_partialTextureUpdateRequests(0)
115 { 114 {
115 DCHECK(Proxy::isMainThread());
116 numLayerTreeInstances++; 116 numLayerTreeInstances++;
117 } 117 }
118 118
119 bool LayerTreeHost::initialize(scoped_ptr<Thread> implThread) 119 bool LayerTreeHost::initialize()
120 { 120 {
121 TRACE_EVENT0("cc", "LayerTreeHost::initialize"); 121 TRACE_EVENT0("cc", "LayerTreeHost::initialize");
122 122
123 if (implThread) 123 if (Proxy::hasImplThread())
124 m_proxy = ThreadProxy::create(this, implThread.Pass()); 124 m_proxy = ThreadProxy::create(this);
125 else 125 else
126 m_proxy = SingleThreadProxy::create(this); 126 m_proxy = SingleThreadProxy::create(this);
127 m_proxy->start(); 127 m_proxy->start();
128 128
129 return m_proxy->initializeContext(); 129 return m_proxy->initializeContext();
130 } 130 }
131 131
132 LayerTreeHost::~LayerTreeHost() 132 LayerTreeHost::~LayerTreeHost()
133 { 133 {
134 if (m_rootLayer) 134 if (m_rootLayer)
135 m_rootLayer->setLayerTreeHost(0); 135 m_rootLayer->setLayerTreeHost(0);
136 DCHECK(m_proxy); 136 DCHECK(Proxy::isMainThread());
137 DCHECK(m_proxy->isMainThread());
138 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); 137 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost");
138 DCHECK(m_proxy.get());
139 m_proxy->stop(); 139 m_proxy->stop();
140 m_proxy.reset();
140 numLayerTreeInstances--; 141 numLayerTreeInstances--;
141 RateLimiterMap::iterator it = m_rateLimiters.begin(); 142 RateLimiterMap::iterator it = m_rateLimiters.begin();
142 if (it != m_rateLimiters.end()) 143 if (it != m_rateLimiters.end())
143 it->second->stop(); 144 it->second->stop();
144 } 145 }
145 146
146 void LayerTreeHost::setSurfaceReady() 147 void LayerTreeHost::setSurfaceReady()
147 { 148 {
148 m_proxy->setSurfaceReady(); 149 m_proxy->setSurfaceReady();
149 } 150 }
150 151
151 void LayerTreeHost::initializeRenderer() 152 void LayerTreeHost::initializeRenderer()
152 { 153 {
153 TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer"); 154 TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer");
154 if (!m_proxy->initializeRenderer()) { 155 if (!m_proxy->initializeRenderer()) {
155 // Uh oh, better tell the client that we can't do anything with this con text. 156 // Uh oh, better tell the client that we can't do anything with this con text.
156 m_client->didRecreateOutputSurface(false); 157 m_client->didRecreateOutputSurface(false);
157 return; 158 return;
158 } 159 }
159 160
160 // Update m_settings based on capabilities that we got back from the rendere r. 161 // Update m_settings based on capabilities that we got back from the rendere r.
161 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler atedPainting; 162 m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceler atedPainting;
162 163
163 // Update m_settings based on partial update capability. 164 // Update m_settings based on partial update capability.
164 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate s, m_proxy->maxPartialTextureUpdates()); 165 m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdate s, m_proxy->maxPartialTextureUpdates());
165 166
166 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren dererCapabilities().maxTextureSize, Renderer::ContentPool, m_proxy.get()); 167 m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->ren dererCapabilities().maxTextureSize, Renderer::ContentPool);
167 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Si ze(), GL_RGBA); 168 m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Si ze(), GL_RGBA);
168 169
169 m_rendererInitialized = true; 170 m_rendererInitialized = true;
170 171
171 m_settings.defaultTileSize = gfx::Size(min(m_settings.defaultTileSize.width( ), m_proxy->rendererCapabilities().maxTextureSize), 172 m_settings.defaultTileSize = gfx::Size(min(m_settings.defaultTileSize.width( ), m_proxy->rendererCapabilities().maxTextureSize),
172 min(m_settings.defaultTileSize.height (), m_proxy->rendererCapabilities().maxTextureSize)); 173 min(m_settings.defaultTileSize.height (), m_proxy->rendererCapabilities().maxTextureSize));
173 m_settings.maxUntiledLayerSize = gfx::Size(min(m_settings.maxUntiledLayerSiz e.width(), m_proxy->rendererCapabilities().maxTextureSize), 174 m_settings.maxUntiledLayerSize = gfx::Size(min(m_settings.maxUntiledLayerSiz e.width(), m_proxy->rendererCapabilities().maxTextureSize),
174 min(m_settings.maxUntiledLayerSiz e.height(), m_proxy->rendererCapabilities().maxTextureSize)); 175 min(m_settings.maxUntiledLayerSiz e.height(), m_proxy->rendererCapabilities().maxTextureSize));
175 } 176 }
176 177
(...skipping 14 matching lines...) Expand all
191 return RecreateSucceeded; 192 return RecreateSucceeded;
192 } 193 }
193 194
194 // Tolerate a certain number of recreation failures to work around races 195 // Tolerate a certain number of recreation failures to work around races
195 // in the context-lost machinery. 196 // in the context-lost machinery.
196 m_numFailedRecreateAttempts++; 197 m_numFailedRecreateAttempts++;
197 if (m_numFailedRecreateAttempts < 5) { 198 if (m_numFailedRecreateAttempts < 5) {
198 // FIXME: The single thread does not self-schedule context 199 // FIXME: The single thread does not self-schedule context
199 // recreation. So force another recreation attempt to happen by requesti ng 200 // recreation. So force another recreation attempt to happen by requesti ng
200 // another commit. 201 // another commit.
201 if (!m_proxy->hasImplThread()) 202 if (!Proxy::hasImplThread())
202 setNeedsCommit(); 203 setNeedsCommit();
203 return RecreateFailedButTryAgain; 204 return RecreateFailedButTryAgain;
204 } 205 }
205 206
206 // We have tried too many times to recreate the context. Tell the host to fa ll 207 // We have tried too many times to recreate the context. Tell the host to fa ll
207 // back to software rendering. 208 // back to software rendering.
208 m_client->didRecreateOutputSurface(false); 209 m_client->didRecreateOutputSurface(false);
209 return RecreateFailedAndGaveUp; 210 return RecreateFailedAndGaveUp;
210 } 211 }
211 212
212 void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourc eProvider) 213 void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourc eProvider)
213 { 214 {
214 DCHECK(m_proxy->isImplThread()); 215 DCHECK(Proxy::isImplThread());
215 if (m_rendererInitialized) 216 if (m_rendererInitialized)
216 m_contentsTextureManager->clearAllMemory(resourceProvider); 217 m_contentsTextureManager->clearAllMemory(resourceProvider);
217 } 218 }
218 219
219 void LayerTreeHost::acquireLayerTextures() 220 void LayerTreeHost::acquireLayerTextures()
220 { 221 {
221 DCHECK(m_proxy->isMainThread()); 222 DCHECK(Proxy::isMainThread());
222 m_proxy->acquireLayerTextures(); 223 m_proxy->acquireLayerTextures();
223 } 224 }
224 225
225 void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime) 226 void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime)
226 { 227 {
227 m_animating = true; 228 m_animating = true;
228 m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF()); 229 m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF());
229 animateLayers(frameBeginTime); 230 animateLayers(frameBeginTime);
230 m_animating = false; 231 m_animating = false;
231 232
232 m_renderingStats.numAnimationFrames++; 233 m_renderingStats.numAnimationFrames++;
233 } 234 }
234 235
235 void LayerTreeHost::layout() 236 void LayerTreeHost::layout()
236 { 237 {
237 m_client->layout(); 238 m_client->layout();
238 } 239 }
239 240
240 void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) 241 void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl)
241 { 242 {
242 DCHECK(m_proxy->isImplThread()); 243 DCHECK(Proxy::isImplThread());
243 TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); 244 TRACE_EVENT0("cc", "LayerTreeHost::commitTo");
244 } 245 }
245 246
246 // This function commits the LayerTreeHost to an impl tree. When modifying 247 // This function commits the LayerTreeHost to an impl tree. When modifying
247 // this function, keep in mind that the function *runs* on the impl thread! Any 248 // this function, keep in mind that the function *runs* on the impl thread! Any
248 // code that is logically a main thread operation, e.g. deletion of a Layer, 249 // code that is logically a main thread operation, e.g. deletion of a Layer,
249 // should be delayed until the LayerTreeHost::commitComplete, which will run 250 // should be delayed until the LayerTreeHost::commitComplete, which will run
250 // after the commit, but on the main thread. 251 // after the commit, but on the main thread.
251 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) 252 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
252 { 253 {
253 DCHECK(m_proxy->isImplThread()); 254 DCHECK(Proxy::isImplThread());
254 255
255 m_contentsTextureManager->updateBackingsInDrawingImplTree(); 256 m_contentsTextureManager->updateBackingsInDrawingImplTree();
256 ResourceProvider::debugNotifyEnterZone(0xA000000); 257 ResourceProvider::debugNotifyEnterZone(0xA000000);
257 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); 258 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider());
258 ResourceProvider::debugNotifyLeaveZone(); 259 ResourceProvider::debugNotifyLeaveZone();
259 260
260 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI mpl->detachLayerTree(), hostImpl)); 261 hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostI mpl->detachLayerTree(), hostImpl));
261 262
262 if (m_rootLayer && m_hudLayer) 263 if (m_rootLayer && m_hudLayer)
263 hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHos tCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id()))); 264 hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHos tCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id())));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return m_client->createOutputSurface(); 311 return m_client->createOutputSurface();
311 } 312 }
312 313
313 scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() 314 scoped_ptr<InputHandler> LayerTreeHost::createInputHandler()
314 { 315 {
315 return m_client->createInputHandler(); 316 return m_client->createInputHandler();
316 } 317 }
317 318
318 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo stImplClient* client) 319 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHo stImplClient* client)
319 { 320 {
320 return LayerTreeHostImpl::create(m_settings, client, m_proxy.get()); 321 return LayerTreeHostImpl::create(m_settings, client);
321 } 322 }
322 323
323 void LayerTreeHost::didLoseContext() 324 void LayerTreeHost::didLoseContext()
324 { 325 {
325 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); 326 TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext");
326 DCHECK(m_proxy->isMainThread()); 327 DCHECK(Proxy::isMainThread());
327 m_contextLost = true; 328 m_contextLost = true;
328 m_numFailedRecreateAttempts = 0; 329 m_numFailedRecreateAttempts = 0;
329 setNeedsCommit(); 330 setNeedsCommit();
330 } 331 }
331 332
332 bool LayerTreeHost::compositeAndReadback(void *pixels, const gfx::Rect& rect) 333 bool LayerTreeHost::compositeAndReadback(void *pixels, const gfx::Rect& rect)
333 { 334 {
334 m_triggerIdleUpdates = false; 335 m_triggerIdleUpdates = false;
335 bool ret = m_proxy->compositeAndReadback(pixels, rect); 336 bool ret = m_proxy->compositeAndReadback(pixels, rect);
336 m_triggerIdleUpdates = true; 337 m_triggerIdleUpdates = true;
(...skipping 22 matching lines...) Expand all
359 m_proxy->renderingStats(stats); 360 m_proxy->renderingStats(stats);
360 } 361 }
361 362
362 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const 363 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const
363 { 364 {
364 return m_proxy->rendererCapabilities(); 365 return m_proxy->rendererCapabilities();
365 } 366 }
366 367
367 void LayerTreeHost::setNeedsAnimate() 368 void LayerTreeHost::setNeedsAnimate()
368 { 369 {
369 DCHECK(m_proxy->hasImplThread()); 370 DCHECK(Proxy::hasImplThread());
370 m_proxy->setNeedsAnimate(); 371 m_proxy->setNeedsAnimate();
371 } 372 }
372 373
373 void LayerTreeHost::setNeedsCommit() 374 void LayerTreeHost::setNeedsCommit()
374 { 375 {
375 if (!m_prepaintCallback.IsCancelled()) { 376 if (!m_prepaintCallback.IsCancelled()) {
376 TRACE_EVENT_INSTANT0("cc", "LayerTreeHost::setNeedsCommit::cancel prepai nt"); 377 TRACE_EVENT_INSTANT0("cc", "LayerTreeHost::setNeedsCommit::cancel prepai nt");
377 m_prepaintCallback.Cancel(); 378 m_prepaintCallback.Cancel();
378 } 379 }
379 m_proxy->setNeedsCommit(); 380 m_proxy->setNeedsCommit();
380 } 381 }
381 382
382 void LayerTreeHost::setNeedsRedraw() 383 void LayerTreeHost::setNeedsRedraw()
383 { 384 {
384 m_proxy->setNeedsRedraw(); 385 m_proxy->setNeedsRedraw();
385 if (!m_proxy->implThread()) 386 if (!ThreadProxy::implThread())
386 m_client->scheduleComposite(); 387 m_client->scheduleComposite();
387 } 388 }
388 389
389 bool LayerTreeHost::commitRequested() const 390 bool LayerTreeHost::commitRequested() const
390 { 391 {
391 return m_proxy->commitRequested(); 392 return m_proxy->commitRequested();
392 } 393 }
393 394
394 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime) 395 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime)
395 { 396 {
396 DCHECK(m_proxy->isMainThread()); 397 DCHECK(ThreadProxy::isMainThread());
397 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime) ; 398 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime) ;
398 } 399 }
399 400
400 void LayerTreeHost::didAddAnimation() 401 void LayerTreeHost::didAddAnimation()
401 { 402 {
402 m_needsAnimateLayers = true; 403 m_needsAnimateLayers = true;
403 m_proxy->didAddAnimation(); 404 m_proxy->didAddAnimation();
404 } 405 }
405 406
406 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) 407 void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 m_proxy->loseContext(); 463 m_proxy->loseContext();
463 } 464 }
464 465
465 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const 466 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const
466 { 467 {
467 return m_contentsTextureManager.get(); 468 return m_contentsTextureManager.get();
468 } 469 }
469 470
470 void LayerTreeHost::composite() 471 void LayerTreeHost::composite()
471 { 472 {
472 DCHECK(!m_proxy->implThread()); 473 DCHECK(!ThreadProxy::implThread());
473 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); 474 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately();
474 } 475 }
475 476
476 void LayerTreeHost::scheduleComposite() 477 void LayerTreeHost::scheduleComposite()
477 { 478 {
478 m_client->scheduleComposite(); 479 m_client->scheduleComposite();
479 } 480 }
480 481
481 bool LayerTreeHost::initializeRendererIfNeeded() 482 bool LayerTreeHost::initializeRendererIfNeeded()
482 { 483 {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) 738 void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context)
738 { 739 {
739 if (m_animating) 740 if (m_animating)
740 return; 741 return;
741 742
742 DCHECK(context); 743 DCHECK(context);
743 RateLimiterMap::iterator it = m_rateLimiters.find(context); 744 RateLimiterMap::iterator it = m_rateLimiters.find(context);
744 if (it != m_rateLimiters.end()) 745 if (it != m_rateLimiters.end())
745 it->second->start(); 746 it->second->start();
746 else { 747 else {
747 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th is, m_proxy->mainThread()); 748 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th is);
748 m_rateLimiters[context] = rateLimiter; 749 m_rateLimiters[context] = rateLimiter;
749 rateLimiter->start(); 750 rateLimiter->start();
750 } 751 }
751 } 752 }
752 753
753 void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) 754 void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context)
754 { 755 {
755 RateLimiterMap::iterator it = m_rateLimiters.find(context); 756 RateLimiterMap::iterator it = m_rateLimiters.find(context);
756 if (it != m_rateLimiters.end()) { 757 if (it != m_rateLimiters.end()) {
757 it->second->stop(); 758 it->second->stop();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 else 833 else
833 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 834 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
834 } 835 }
835 } 836 }
836 837
837 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 838 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
838 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 839 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
839 } 840 }
840 841
841 } // namespace cc 842 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698