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

Side by Side Diff: cc/test/test_context_support.cc

Issue 619453002: gpu: Remove Echo and SwapCompletion GL interfacess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tits
Patch Set: rebase Created 6 years, 2 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
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/test/test_context_support.h" 5 #include "cc/test/test_context_support.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 TestContextSupport::TestContextSupport() 12 TestContextSupport::TestContextSupport()
13 : last_swap_type_(NO_SWAP), 13 : weak_ptr_factory_(this) {
14 weak_ptr_factory_(this) {
15 } 14 }
16 15
17 TestContextSupport::~TestContextSupport() {} 16 TestContextSupport::~TestContextSupport() {}
18 17
19 void TestContextSupport::SignalSyncPoint(uint32 sync_point, 18 void TestContextSupport::SignalSyncPoint(uint32 sync_point,
20 const base::Closure& callback) { 19 const base::Closure& callback) {
21 sync_point_callbacks_.push_back(callback); 20 sync_point_callbacks_.push_back(callback);
22 base::MessageLoop::current()->PostTask( 21 base::MessageLoop::current()->PostTask(
23 FROM_HERE, 22 FROM_HERE,
24 base::Bind(&TestContextSupport::CallAllSyncPointCallbacks, 23 base::Bind(&TestContextSupport::CallAllSyncPointCallbacks,
(...skipping 26 matching lines...) Expand all
51 void TestContextSupport::SetSurfaceVisibleCallback( 50 void TestContextSupport::SetSurfaceVisibleCallback(
52 const SurfaceVisibleCallback& set_visible_callback) { 51 const SurfaceVisibleCallback& set_visible_callback) {
53 set_visible_callback_ = set_visible_callback; 52 set_visible_callback_ = set_visible_callback;
54 } 53 }
55 54
56 void TestContextSupport::SetScheduleOverlayPlaneCallback( 55 void TestContextSupport::SetScheduleOverlayPlaneCallback(
57 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { 56 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) {
58 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; 57 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback;
59 } 58 }
60 59
61 void TestContextSupport::Swap() {
62 last_swap_type_ = SWAP;
63 base::MessageLoop::current()->PostTask(
64 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete,
65 weak_ptr_factory_.GetWeakPtr()));
66 }
67
68 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { 60 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() {
69 NOTIMPLEMENTED(); 61 NOTIMPLEMENTED();
70 return 0; 62 return 0;
71 } 63 }
72 64
73 void TestContextSupport::RetireSyncPointCHROMIUM(uint32 sync_point) { 65 void TestContextSupport::RetireSyncPointCHROMIUM(uint32 sync_point) {
74 NOTIMPLEMENTED(); 66 NOTIMPLEMENTED();
75 } 67 }
76 68
77 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
78 last_swap_type_ = PARTIAL_SWAP;
79 last_partial_swap_rect_ = sub_buffer;
80 base::MessageLoop::current()->PostTask(
81 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete,
82 weak_ptr_factory_.GetWeakPtr()));
83 }
84
85 void TestContextSupport::ScheduleOverlayPlane( 69 void TestContextSupport::ScheduleOverlayPlane(
86 int plane_z_order, 70 int plane_z_order,
87 gfx::OverlayTransform plane_transform, 71 gfx::OverlayTransform plane_transform,
88 unsigned overlay_texture_id, 72 unsigned overlay_texture_id,
89 const gfx::Rect& display_bounds, 73 const gfx::Rect& display_bounds,
90 const gfx::RectF& uv_rect) { 74 const gfx::RectF& uv_rect) {
91 if (!schedule_overlay_plane_callback_.is_null()) { 75 if (!schedule_overlay_plane_callback_.is_null()) {
92 schedule_overlay_plane_callback_.Run(plane_z_order, 76 schedule_overlay_plane_callback_.Run(plane_z_order,
93 plane_transform, 77 plane_transform,
94 overlay_texture_id, 78 overlay_texture_id,
95 display_bounds, 79 display_bounds,
96 uv_rect); 80 uv_rect);
97 } 81 }
98 } 82 }
99 83
100 void TestContextSupport::SetSwapBuffersCompleteCallback(
101 const base::Closure& callback) {
102 swap_buffers_complete_callback_ = callback;
103 }
104
105 void TestContextSupport::OnSwapBuffersComplete() {
106 if (!swap_buffers_complete_callback_.is_null())
107 swap_buffers_complete_callback_.Run();
108 }
109
110 } // namespace cc 84 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698