Chromium Code Reviews| Index: gpu/ipc/service/image_transport_surface_delegate.h |
| diff --git a/gpu/ipc/service/image_transport_surface_delegate.h b/gpu/ipc/service/image_transport_surface_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..014a800bd761b816f9fcd02fd641518de998e311 |
| --- /dev/null |
| +++ b/gpu/ipc/service/image_transport_surface_delegate.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ |
| +#define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ |
| + |
| +#include "base/callback.h" |
| +#include "gpu/command_buffer/common/texture_in_use_response.h" |
| +#include "ui/events/latency_info.h" |
| +#include "ui/gfx/swap_result.h" |
| + |
| +#if defined(OS_MACOSX) |
| +#include "ui/base/cocoa/remote_layer_api.h" |
| +#include "ui/gfx/mac/io_surface.h" |
| +#endif |
| + |
| +namespace gpu { |
| + |
| +namespace gles2 { |
| +class FeatureInfo; |
| +} |
| + |
| +struct SwapBuffersCompleteParams { |
| + SwapBuffersCompleteParams(); |
| + SwapBuffersCompleteParams(SwapBuffersCompleteParams&& other); |
|
piman
2016/11/09 22:49:36
nit: rule-of-3, add a move-assign operator?
Fady Samuel
2016/11/09 23:28:10
Done.
|
| + ~SwapBuffersCompleteParams(); |
| + |
| +#if defined(OS_MACOSX) |
| + // Mac-specific parameters used to present CALayers hosted in the GPU process. |
| + // TODO(ccameron): Remove these parameters once the CALayer tree is hosted in |
| + // the browser process. |
| + // https://crbug.com/604052 |
| + // Only one of ca_context_id or io_surface may be non-0. |
| + CAContextID ca_context_id; |
| + bool fullscreen_low_power_ca_context_valid; |
| + CAContextID fullscreen_low_power_ca_context_id; |
| + gfx::ScopedRefCountedIOSurfaceMachPort io_surface; |
| + gfx::Size pixel_size; |
| + float scale_factor; |
| + gpu::TextureInUseResponses in_use_responses; |
| +#endif |
| + std::vector<ui::LatencyInfo> latency_info; |
| + gfx::SwapResult result; |
| +}; |
| + |
| +class ImageTransportSurfaceDelegate { |
| + public: |
| + // Tells the delete that SwapBuffers returned and passes latency info. |
| + virtual void DidSwapBuffersComplete(SwapBuffersCompleteParams params) = 0; |
| + |
| + // Returns the features available for the ContextGroup. |
| + virtual const gles2::FeatureInfo* GetFeatureInfo() const = 0; |
| + |
| + using LatencyInfoCallback = |
| + base::Callback<void(const std::vector<ui::LatencyInfo>&)>; |
| + // |callback| is called when the delegate has updated LatencyInfo available. |
| + virtual void SetLatencyInfoCallback(const LatencyInfoCallback& callback) = 0; |
| + |
| + // Informs the delegate about updated vsync parameters. |
| + virtual void UpdateVSyncParameters(base::TimeTicks timebase, |
| + base::TimeDelta interval) = 0; |
| + |
| + protected: |
| + virtual ~ImageTransportSurfaceDelegate() {} |
| +}; |
| + |
| +} // namespace gpu |
| + |
| +#endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ |