Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 5 #ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 6 #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 6 #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "gpu/ipc/service/gpu_command_buffer_stub.h" | 14 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
| 15 #include "gpu/ipc/service/image_transport_surface.h" | 15 #include "gpu/ipc/service/image_transport_surface.h" |
| 16 #include "ui/base/cocoa/remote_layer_api.h" | 16 #include "ui/base/cocoa/remote_layer_api.h" |
| 17 #include "ui/events/latency_info.h" | 17 #include "ui/events/latency_info.h" |
| 18 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 const gfx::Size& size, | 86 const gfx::Size& size, |
| 87 float scale_factor, | 87 float scale_factor, |
| 88 std::vector<ui::LatencyInfo> latency_info); | 88 std::vector<ui::LatencyInfo> latency_info); |
| 89 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 89 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 90 | 90 |
| 91 base::WeakPtr<GpuCommandBufferStub> stub_; | 91 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 92 SurfaceHandle handle_; | 92 SurfaceHandle handle_; |
| 93 std::vector<ui::LatencyInfo> latency_info_; | 93 std::vector<ui::LatencyInfo> latency_info_; |
| 94 | 94 |
| 95 bool use_remote_layer_api_; | 95 bool use_remote_layer_api_; |
| 96 base::scoped_nsobject<CAContext> ca_context_; | |
| 97 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; | |
| 98 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; | |
| 99 | 96 |
| 100 gfx::Size pixel_size_; | 97 // This state depends on the size of the output surface, and is recreated |
| 101 float scale_factor_; | 98 // at resize. |
| 99 struct SizeDependentState { | |
|
tapted
2016/06/17 00:23:38
optional since this is in private: (and deque/uniq
| |
| 100 SizeDependentState(); | |
| 101 ~SizeDependentState(); | |
| 102 base::scoped_nsobject<CAContext> ca_context_; | |
| 103 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; | |
| 104 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; | |
| 105 gfx::Size pixel_size_; | |
| 106 float scale_factor_ = 1; | |
| 107 // This structure is kept around after a resize to avoid flashes. The | |
| 108 // |swaps_since_discarded_| member counts the number of swaps. | |
| 109 size_t swaps_since_discarded_ = 0; | |
| 110 }; | |
|
tapted
2016/06/17 00:23:38
nit: DISALLOW_COPY_AND_ASSIGN(..)
(the unique_ptr
| |
| 111 std::unique_ptr<SizeDependentState> size_dependent_state_; | |
| 112 // When a CAContext is released in the GPU process, it will flash to blank | |
| 113 // immediately in the browser process. Avoid this flash by keeping around | |
| 114 // old CAContexts for several frames. | |
| 115 std::deque<std::unique_ptr<SizeDependentState>> | |
| 116 discarded_size_dependent_state_; | |
| 102 | 117 |
| 103 struct IOSurfaceInUseQuery { | 118 struct IOSurfaceInUseQuery { |
| 104 IOSurfaceInUseQuery(); | 119 IOSurfaceInUseQuery(); |
| 105 explicit IOSurfaceInUseQuery(const IOSurfaceInUseQuery&); | 120 explicit IOSurfaceInUseQuery(const IOSurfaceInUseQuery&); |
| 106 explicit IOSurfaceInUseQuery(IOSurfaceInUseQuery&&); | 121 explicit IOSurfaceInUseQuery(IOSurfaceInUseQuery&&); |
| 107 ~IOSurfaceInUseQuery(); | 122 ~IOSurfaceInUseQuery(); |
| 108 | 123 |
| 109 // It's possible that the client will have destroyed the texture before | 124 // It's possible that the client will have destroyed the texture before |
| 110 // SwapBuffersInternal is called. It's important that |texture| is only used | 125 // SwapBuffersInternal is called. It's important that |texture| is only used |
| 111 // as an opaque identifier, since it may no longer point to the same | 126 // as an opaque identifier, since it may no longer point to the same |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 122 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; | 137 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; |
| 123 | 138 |
| 124 // The renderer ID that all contexts made current to this surface should be | 139 // The renderer ID that all contexts made current to this surface should be |
| 125 // targeting. | 140 // targeting. |
| 126 GLint gl_renderer_id_; | 141 GLint gl_renderer_id_; |
| 127 }; | 142 }; |
| 128 | 143 |
| 129 } // namespace gpu | 144 } // namespace gpu |
| 130 | 145 |
| 131 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 146 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |