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

Side by Side Diff: cc/output/output_surface_unittest.cc

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 287efe04 Rebase, oshima@ nits. Created 6 years, 10 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/output/output_surface.cc ('k') | chrome/browser/chromeos/display/display_preferences.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 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "cc/output/managed_memory_policy.h" 8 #include "cc/output/managed_memory_policy.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "cc/output/software_output_device.h" 10 #include "cc/output/software_output_device.h"
(...skipping 28 matching lines...) Expand all
39 override_retroactive_period_(false) {} 39 override_retroactive_period_(false) {}
40 40
41 bool InitializeNewContext3d( 41 bool InitializeNewContext3d(
42 scoped_refptr<ContextProvider> new_context_provider) { 42 scoped_refptr<ContextProvider> new_context_provider) {
43 return InitializeAndSetContext3d(new_context_provider, 43 return InitializeAndSetContext3d(new_context_provider,
44 scoped_refptr<ContextProvider>()); 44 scoped_refptr<ContextProvider>());
45 } 45 }
46 46
47 using OutputSurface::ReleaseGL; 47 using OutputSurface::ReleaseGL;
48 48
49 void OnVSyncParametersChangedForTesting(base::TimeTicks timebase, 49 void CommitVSyncParametersForTesting(base::TimeTicks timebase,
50 base::TimeDelta interval) { 50 base::TimeDelta interval) {
51 OnVSyncParametersChanged(timebase, interval); 51 CommitVSyncParameters(timebase, interval);
52 } 52 }
53 53
54 void BeginImplFrameForTesting() { 54 void BeginImplFrameForTesting() {
55 OutputSurface::BeginImplFrame(BeginFrameArgs::CreateExpiredForTesting()); 55 OutputSurface::BeginImplFrame(BeginFrameArgs::CreateExpiredForTesting());
56 } 56 }
57 57
58 void DidSwapBuffersForTesting() { 58 void DidSwapBuffersForTesting() {
59 DidSwapBuffers(); 59 DidSwapBuffers();
60 } 60 }
61 61
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 bool throttle_frame_production = true; 380 bool throttle_frame_production = true;
381 const base::TimeDelta display_refresh_interval = big_interval; 381 const base::TimeDelta display_refresh_interval = big_interval;
382 382
383 output_surface.InitializeBeginImplFrameEmulation( 383 output_surface.InitializeBeginImplFrameEmulation(
384 task_runner.get(), 384 task_runner.get(),
385 throttle_frame_production, 385 throttle_frame_production,
386 display_refresh_interval); 386 display_refresh_interval);
387 387
388 // We need to subtract an epsilon from Now() because some platforms have 388 // We need to subtract an epsilon from Now() because some platforms have
389 // a slow clock. 389 // a slow clock.
390 output_surface.OnVSyncParametersChangedForTesting( 390 output_surface.CommitVSyncParametersForTesting(
391 gfx::FrameTime::Now() - base::TimeDelta::FromSeconds(1), big_interval); 391 gfx::FrameTime::Now() - base::TimeDelta::FromSeconds(1), big_interval);
392 392
393 output_surface.SetMaxFramesPending(2); 393 output_surface.SetMaxFramesPending(2);
394 output_surface.EnableRetroactiveBeginImplFrameDeadline( 394 output_surface.EnableRetroactiveBeginImplFrameDeadline(
395 true, true, big_interval); 395 true, true, big_interval);
396 396
397 // We should start off with 0 BeginImplFrames 397 // We should start off with 0 BeginImplFrames
398 EXPECT_EQ(client.begin_impl_frame_count(), 0); 398 EXPECT_EQ(client.begin_impl_frame_count(), 0);
399 EXPECT_EQ(output_surface.pending_swap_buffers(), 0); 399 EXPECT_EQ(output_surface.pending_swap_buffers(), 0);
400 400
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); 465 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count());
466 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); 466 EXPECT_EQ(0, software_output_device->discard_backbuffer_count());
467 output_surface.DiscardBackbuffer(); 467 output_surface.DiscardBackbuffer();
468 468
469 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); 469 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count());
470 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); 470 EXPECT_EQ(1, software_output_device->discard_backbuffer_count());
471 } 471 }
472 472
473 } // namespace 473 } // namespace
474 } // namespace cc 474 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.cc ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698