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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 12674030: cc: Hook vsync time source to output surface (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review tweaks. Created 7 years, 9 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "cc/animation/timing_function.h" 8 #include "cc/animation/timing_function.h"
9 #include "cc/layers/content_layer.h" 9 #include "cc/layers/content_layer.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
(...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 break; 2342 break;
2343 } 2343 }
2344 } 2344 }
2345 2345
2346 private: 2346 private:
2347 NotificationClient client_; 2347 NotificationClient client_;
2348 }; 2348 };
2349 2349
2350 SINGLE_THREAD_TEST_F(LayerTreeHostTestLCDNotification) 2350 SINGLE_THREAD_TEST_F(LayerTreeHostTestLCDNotification)
2351 2351
2352 // Verify that the vsync notification is used to initiate rendering.
2353 class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest {
2354 public:
2355 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2356 settings->render_vsync_notification_enabled = true;
2357 }
2358
2359 virtual void BeginTest() OVERRIDE {
2360 PostSetNeedsCommitToMainThread();
2361 }
2362
2363 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
2364 FakeOutputSurface* fake_output_surface =
2365 reinterpret_cast<FakeOutputSurface*>(host_impl->output_surface());
2366
2367 // The vsync notification is turned off now but will get enabled once we
2368 // return, so post a task to trigger it.
2369 ASSERT_FALSE(fake_output_surface->vsync_notification_enabled());
2370 PostVSyncOnImplThread(fake_output_surface);
2371 }
2372
2373 void PostVSyncOnImplThread(FakeOutputSurface* fake_output_surface) {
2374 DCHECK(ImplThread());
2375 ImplThread()->PostTask(
2376 base::Bind(&LayerTreeHostTestVSyncNotification::DidVSync,
2377 base::Unretained(this),
2378 base::Unretained(fake_output_surface)));
2379 }
2380
2381 void DidVSync(FakeOutputSurface* fake_output_surface) {
2382 ASSERT_TRUE(fake_output_surface->vsync_notification_enabled());
2383 fake_output_surface->DidVSync(frame_time_);
2384 }
2385
2386 virtual bool PrepareToDrawOnThread(
2387 LayerTreeHostImpl* host_impl,
2388 LayerTreeHostImpl::FrameData* frame,
2389 bool result) OVERRIDE {
2390 EndTest();
2391 return true;
2392 }
2393
2394 virtual void AfterTest() OVERRIDE {
2395 }
2396
2397 private:
2398 base::TimeTicks frame_time_;
2399 };
2400
2401 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification);
2402
2352 } // namespace 2403 } // namespace
2353 } // namespace cc 2404 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698