| 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 "components/mus/surfaces/direct_output_surface.h" | 5 #include "components/mus/surfaces/direct_output_surface.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "cc/output/compositor_frame.h" | 11 #include "cc/output/compositor_frame.h" |
| 11 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 12 #include "cc/output/output_surface_client.h" | 13 #include "cc/output/output_surface_client.h" |
| 14 #include "cc/scheduler/delay_based_time_source.h" |
| 13 #include "gpu/command_buffer/client/context_support.h" | 15 #include "gpu/command_buffer/client/context_support.h" |
| 14 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
| 15 | 17 |
| 16 namespace mus { | 18 namespace mus { |
| 17 | 19 |
| 18 DirectOutputSurface::DirectOutputSurface( | 20 DirectOutputSurface::DirectOutputSurface( |
| 19 scoped_refptr<SurfacesContextProvider> context_provider, | 21 scoped_refptr<SurfacesContextProvider> context_provider, |
| 20 base::SingleThreadTaskRunner* task_runner) | 22 base::SingleThreadTaskRunner* task_runner) |
| 21 : cc::OutputSurface(context_provider, nullptr, nullptr), | 23 : cc::OutputSurface(context_provider, nullptr, nullptr), |
| 22 synthetic_begin_frame_source_(new cc::SyntheticBeginFrameSource( | 24 synthetic_begin_frame_source_(new cc::DelayBasedBeginFrameSource( |
| 23 task_runner, | 25 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner))), |
| 24 cc::BeginFrameArgs::DefaultInterval())), | |
| 25 weak_ptr_factory_(this) { | 26 weak_ptr_factory_(this) { |
| 26 context_provider->SetDelegate(this); | 27 context_provider->SetDelegate(this); |
| 27 } | 28 } |
| 28 | 29 |
| 29 DirectOutputSurface::~DirectOutputSurface() {} | 30 DirectOutputSurface::~DirectOutputSurface() {} |
| 30 | 31 |
| 31 bool DirectOutputSurface::BindToClient(cc::OutputSurfaceClient* client) { | 32 bool DirectOutputSurface::BindToClient(cc::OutputSurfaceClient* client) { |
| 32 if (!cc::OutputSurface::BindToClient(client)) | 33 if (!cc::OutputSurface::BindToClient(client)) |
| 33 return false; | 34 return false; |
| 34 | 35 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 gpu::SyncToken sync_token; | 69 gpu::SyncToken sync_token; |
| 69 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 70 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 70 | 71 |
| 71 context_provider_->ContextSupport()->SignalSyncToken( | 72 context_provider_->ContextSupport()->SignalSyncToken( |
| 72 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, | 73 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, |
| 73 weak_ptr_factory_.GetWeakPtr())); | 74 weak_ptr_factory_.GetWeakPtr())); |
| 74 client_->DidSwapBuffers(); | 75 client_->DidSwapBuffers(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 } // namespace mus | 78 } // namespace mus |
| OLD | NEW |