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

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: Add more comments Created 7 years, 4 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | cc/test/fake_content_layer.h » ('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 "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());
385 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginFrameToMainThread", client); 390 EXPECT_ACTION("ScheduledActionSendBeginFrameToMainThread", client, 0, 2);
386 client.Reset(); 391 EXPECT_ACTION("SetNeedsBeginFrameOnImplThread", client, 1, 2);
387 } 392 }
388 393
389 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient { 394 class SchedulerClientThatsetNeedsDrawInsideDraw : public FakeSchedulerClient {
390 public: 395 public:
391 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {} 396 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE {}
392 virtual ScheduledActionDrawAndSwapResult 397 virtual ScheduledActionDrawAndSwapResult
393 ScheduledActionDrawAndSwapIfPossible() OVERRIDE { 398 ScheduledActionDrawAndSwapIfPossible() OVERRIDE {
394 // Only SetNeedsRedraw the first time this is called 399 // Only SetNeedsRedraw the first time this is called
395 if (!num_draws_) 400 if (!num_draws_)
396 scheduler_->SetNeedsRedraw(); 401 scheduler_->SetNeedsRedraw();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 618
614 // Get the compositor to do a ScheduledActionDrawAndSwapForced. 619 // Get the compositor to do a ScheduledActionDrawAndSwapForced.
615 scheduler->SetCanDraw(true); 620 scheduler->SetCanDraw(true);
616 scheduler->SetNeedsRedraw(); 621 scheduler->SetNeedsRedraw();
617 scheduler->SetNeedsForcedRedraw(); 622 scheduler->SetNeedsForcedRedraw();
618 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced")); 623 EXPECT_TRUE(client.HasAction("ScheduledActionDrawAndSwapForced"));
619 } 624 }
620 625
621 } // namespace 626 } // namespace
622 } // namespace cc 627 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | cc/test/fake_content_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698