OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 weak_ptr_factory_(this) {} | 58 weak_ptr_factory_(this) {} |
59 | 59 |
60 ~DirectOutputSurface() override {} | 60 ~DirectOutputSurface() override {} |
61 | 61 |
62 // cc::OutputSurface implementation. | 62 // cc::OutputSurface implementation. |
63 bool BindToClient(cc::OutputSurfaceClient* client) override { | 63 bool BindToClient(cc::OutputSurfaceClient* client) override { |
64 if (!OutputSurface::BindToClient(client)) | 64 if (!OutputSurface::BindToClient(client)) |
65 return false; | 65 return false; |
66 return true; | 66 return true; |
67 } | 67 } |
68 void SwapBuffers(cc::CompositorFrame* frame) override { | 68 void SwapBuffers(cc::CompositorFrame frame) override { |
69 DCHECK(context_provider_.get()); | 69 DCHECK(context_provider_.get()); |
70 DCHECK(frame->gl_frame_data); | 70 DCHECK(frame.gl_frame_data); |
71 if (frame->gl_frame_data->sub_buffer_rect == | 71 if (frame.gl_frame_data->sub_buffer_rect == |
72 gfx::Rect(frame->gl_frame_data->size)) { | 72 gfx::Rect(frame.gl_frame_data->size)) { |
73 context_provider_->ContextSupport()->Swap(); | 73 context_provider_->ContextSupport()->Swap(); |
74 } else { | 74 } else { |
75 context_provider_->ContextSupport()->PartialSwapBuffers( | 75 context_provider_->ContextSupport()->PartialSwapBuffers( |
76 frame->gl_frame_data->sub_buffer_rect); | 76 frame.gl_frame_data->sub_buffer_rect); |
77 } | 77 } |
78 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 78 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
79 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | 79 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
80 gl->ShallowFlushCHROMIUM(); | 80 gl->ShallowFlushCHROMIUM(); |
81 | 81 |
82 gpu::SyncToken sync_token; | 82 gpu::SyncToken sync_token; |
83 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 83 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
84 | 84 |
85 context_provider_->ContextSupport()->SignalSyncToken( | 85 context_provider_->ContextSupport()->SignalSyncToken( |
86 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, | 86 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { | 272 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { |
273 observer_list_.AddObserver(observer); | 273 observer_list_.AddObserver(observer); |
274 } | 274 } |
275 | 275 |
276 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { | 276 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { |
277 observer_list_.RemoveObserver(observer); | 277 observer_list_.RemoveObserver(observer); |
278 } | 278 } |
279 | 279 |
280 } // namespace ui | 280 } // namespace ui |
OLD | NEW |