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

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 19106007: cc: Allow the main thread to cancel commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix scheduler tests Created 7 years, 5 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 | Annotate | Revision Log
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 "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 scheduler->SetMainThreadNeedsLayerTextures(); 371 scheduler->SetMainThreadNeedsLayerTextures();
372 scheduler->SetNeedsCommit(); 372 scheduler->SetNeedsCommit();
373 client.Reset(); 373 client.Reset();
374 // Verify that pending texture acquisition fires when visibility 374 // Verify that pending texture acquisition fires when visibility
375 // is lost in order to avoid a deadlock. 375 // is lost in order to avoid a deadlock.
376 scheduler->SetVisible(false); 376 scheduler->SetVisible(false);
377 EXPECT_SINGLE_ACTION("ScheduledActionAcquireLayerTexturesForMainThread", 377 EXPECT_SINGLE_ACTION("ScheduledActionAcquireLayerTexturesForMainThread",
378 client); 378 client);
379 client.Reset(); 379 client.Reset();
380 380
381 // Already sent a begin frame on this current frame, so wait.
382 scheduler->SetVisible(true);
383 EXPECT_EQ(0, client.num_actions_());
384 client.Reset();
385
381 // Regaining visibility with textures acquired by main thread while 386 // Regaining visibility with textures acquired by main thread while
382 // compositor is waiting for first draw should result in a request 387 // compositor is waiting for first draw should result in a request
383 // for a new frame in order to escape a deadlock. 388 // for a new frame in order to escape a deadlock.
384 scheduler->SetVisible(true); 389 scheduler->BeginFrame(BeginFrameArgs::CreateForTesting());
danakj 2013/07/17 20:53:24 I'm having trouble convincing myself that we will
enne (OOO) 2013/07/18 17:36:37 Different begin frames. SetNeedsBeginFrameOnImplT
385 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginFrameToMainThread", client); 390 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2);
391 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
386 client.Reset(); 392 client.Reset();
387 } 393 }
388 394
389 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { 395 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
390 public: 396 public:
391 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {} 397 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {}
392 virtual ScheduledActionDrawAndSwapResult 398 virtual ScheduledActionDrawAndSwapResult
393 ScheduledActionDrawAndSwapIfPossible() OVERRIDE { 399 ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
394 // Only SetNeedsRedraw the first time this is called 400 // Only SetNeedsRedraw the first time this is called
395 if (!num_draws_) 401 if (!num_draws_)
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 619
614 // Get the compositor to do a ScheduledActionDrawAndSwapForced. 620 // Get the compositor to do a ScheduledActionDrawAndSwapForced.
615 scheduler->SetCanDraw(true); 621 scheduler->SetCanDraw(true);
616 scheduler->SetNeedsRedraw(); 622 scheduler->SetNeedsRedraw();
617 scheduler->SetNeedsForcedRedraw(); 623 scheduler->SetNeedsForcedRedraw();
618 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced")); 624 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced"));
619 } 625 }
620 626
621 } // namespace 627 } // namespace
622 } // namespace cc 628 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698