Chromium Code Reviews| 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 "services/ui/surfaces/direct_output_surface.h" | 5 #include "services/ui/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 "base/memory/ptr_util.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/output/output_surface_client.h" | 12 #include "cc/output/output_surface_client.h" |
| 13 #include "cc/output/output_surface_frame.h" | 13 #include "cc/output/output_surface_frame.h" |
| 14 #include "cc/scheduler/begin_frame_source.h" | 14 #include "cc/scheduler/begin_frame_source.h" |
| 15 #include "gpu/command_buffer/client/context_support.h" | 15 #include "gpu/command_buffer/client/context_support.h" |
| 16 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 DirectOutputSurface::DirectOutputSurface( | 20 DirectOutputSurface::DirectOutputSurface( |
| 21 scoped_refptr<SurfacesContextProvider> context_provider, | 21 scoped_refptr<cc::InProcessContextProvider> context_provider, |
| 22 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source) | 22 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source) |
| 23 : cc::OutputSurface(context_provider), | 23 : cc::OutputSurface(context_provider), |
| 24 synthetic_begin_frame_source_(synthetic_begin_frame_source), | 24 synthetic_begin_frame_source_(synthetic_begin_frame_source), |
| 25 weak_ptr_factory_(this) { | 25 weak_ptr_factory_(this) { |
| 26 capabilities_.flipped_output_surface = | 26 capabilities_.flipped_output_surface = |
| 27 context_provider->ContextCapabilities().flips_vertically; | 27 context_provider->ContextCapabilities().flips_vertically; |
| 28 context_provider->SetDelegate(this); | |
| 29 } | 28 } |
| 30 | 29 |
| 31 DirectOutputSurface::~DirectOutputSurface() {} | 30 DirectOutputSurface::~DirectOutputSurface() {} |
| 32 | 31 |
| 33 void DirectOutputSurface::BindToClient(cc::OutputSurfaceClient* client) { | 32 void DirectOutputSurface::BindToClient(cc::OutputSurfaceClient* client) { |
| 34 DCHECK(client); | 33 DCHECK(client); |
| 35 DCHECK(!client_); | 34 DCHECK(!client_); |
| 36 client_ = client; | 35 client_ = client; |
| 37 } | 36 } |
| 38 | 37 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 gpu::SyncToken sync_token; | 69 gpu::SyncToken sync_token; |
| 71 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 70 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 72 | 71 |
| 73 context_provider_->ContextSupport()->SignalSyncToken( | 72 context_provider_->ContextSupport()->SignalSyncToken( |
| 74 sync_token, base::Bind(&DirectOutputSurface::OnSwapBuffersComplete, | 73 sync_token, base::Bind(&DirectOutputSurface::OnSwapBuffersComplete, |
| 75 weak_ptr_factory_.GetWeakPtr())); | 74 weak_ptr_factory_.GetWeakPtr())); |
| 76 } | 75 } |
| 77 | 76 |
| 78 uint32_t DirectOutputSurface::GetFramebufferCopyTextureFormat() { | 77 uint32_t DirectOutputSurface::GetFramebufferCopyTextureFormat() { |
| 79 // TODO(danakj): What attributes are used for the default framebuffer here? | 78 // TODO(danakj): What attributes are used for the default framebuffer here? |
| 80 // Can it have alpha? SurfacesContextProvider doesn't take any attributes. | 79 // Can it have alpha? cc::InProcessContextProvider doesn't take any |
|
rjkroege
2016/11/22 18:26:26
Purely informational comment: As danakj points out
| |
| 80 // attributes. | |
| 81 return GL_RGB; | 81 return GL_RGB; |
| 82 } | 82 } |
| 83 | 83 |
| 84 cc::OverlayCandidateValidator* | 84 cc::OverlayCandidateValidator* |
| 85 DirectOutputSurface::GetOverlayCandidateValidator() const { | 85 DirectOutputSurface::GetOverlayCandidateValidator() const { |
| 86 return nullptr; | 86 return nullptr; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool DirectOutputSurface::IsDisplayedAsOverlayPlane() const { | 89 bool DirectOutputSurface::IsDisplayedAsOverlayPlane() const { |
| 90 return false; | 90 return false; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 111 synthetic_begin_frame_source_->OnUpdateVSyncParameters( | 111 synthetic_begin_frame_source_->OnUpdateVSyncParameters( |
| 112 timebase, | 112 timebase, |
| 113 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); | 113 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void DirectOutputSurface::OnSwapBuffersComplete() { | 116 void DirectOutputSurface::OnSwapBuffersComplete() { |
| 117 client_->DidReceiveSwapBuffersAck(); | 117 client_->DidReceiveSwapBuffersAck(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace ui | 120 } // namespace ui |
| OLD | NEW |