Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ | |
| 6 #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "gpu/command_buffer/common/texture_in_use_response.h" | |
| 10 #include "ui/events/latency_info.h" | |
| 11 #include "ui/gfx/swap_result.h" | |
| 12 | |
| 13 #if defined(OS_MACOSX) | |
| 14 #include "ui/base/cocoa/remote_layer_api.h" | |
| 15 #include "ui/gfx/mac/io_surface.h" | |
| 16 #endif | |
| 17 | |
| 18 namespace gpu { | |
| 19 | |
| 20 namespace gles2 { | |
| 21 class FeatureInfo; | |
| 22 } | |
| 23 | |
| 24 struct SwapBuffersCompleteParams { | |
| 25 SwapBuffersCompleteParams(); | |
| 26 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.
| |
| 27 ~SwapBuffersCompleteParams(); | |
| 28 | |
| 29 #if defined(OS_MACOSX) | |
| 30 // Mac-specific parameters used to present CALayers hosted in the GPU process. | |
| 31 // TODO(ccameron): Remove these parameters once the CALayer tree is hosted in | |
| 32 // the browser process. | |
| 33 // https://crbug.com/604052 | |
| 34 // Only one of ca_context_id or io_surface may be non-0. | |
| 35 CAContextID ca_context_id; | |
| 36 bool fullscreen_low_power_ca_context_valid; | |
| 37 CAContextID fullscreen_low_power_ca_context_id; | |
| 38 gfx::ScopedRefCountedIOSurfaceMachPort io_surface; | |
| 39 gfx::Size pixel_size; | |
| 40 float scale_factor; | |
| 41 gpu::TextureInUseResponses in_use_responses; | |
| 42 #endif | |
| 43 std::vector<ui::LatencyInfo> latency_info; | |
| 44 gfx::SwapResult result; | |
| 45 }; | |
| 46 | |
| 47 class ImageTransportSurfaceDelegate { | |
| 48 public: | |
| 49 // Tells the delete that SwapBuffers returned and passes latency info. | |
| 50 virtual void DidSwapBuffersComplete(SwapBuffersCompleteParams params) = 0; | |
| 51 | |
| 52 // Returns the features available for the ContextGroup. | |
| 53 virtual const gles2::FeatureInfo* GetFeatureInfo() const = 0; | |
| 54 | |
| 55 using LatencyInfoCallback = | |
| 56 base::Callback<void(const std::vector<ui::LatencyInfo>&)>; | |
| 57 // |callback| is called when the delegate has updated LatencyInfo available. | |
| 58 virtual void SetLatencyInfoCallback(const LatencyInfoCallback& callback) = 0; | |
| 59 | |
| 60 // Informs the delegate about updated vsync parameters. | |
| 61 virtual void UpdateVSyncParameters(base::TimeTicks timebase, | |
| 62 base::TimeDelta interval) = 0; | |
| 63 | |
| 64 protected: | |
| 65 virtual ~ImageTransportSurfaceDelegate() {} | |
| 66 }; | |
| 67 | |
| 68 } // namespace gpu | |
| 69 | |
| 70 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_DELEGATE_H_ | |
| OLD | NEW |