Chromium Code Reviews| Index: gpu/ipc/service/image_transport_surface_overlay_mac.h |
| diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h |
| index d5c34d4787eda03d0cfa6c7c739762bff9f6c599..819635988d62d7ebd5a3aefe4413bb885f560c22 100644 |
| --- a/gpu/ipc/service/image_transport_surface_overlay_mac.h |
| +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h |
| @@ -5,7 +5,7 @@ |
| #ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| -#include <list> |
| +#include <deque> |
| #include <memory> |
| #include <vector> |
| @@ -93,12 +93,27 @@ class ImageTransportSurfaceOverlayMac : public gl::GLSurface, |
| std::vector<ui::LatencyInfo> latency_info_; |
| bool use_remote_layer_api_; |
| - base::scoped_nsobject<CAContext> ca_context_; |
| - base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; |
| - std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| - gfx::Size pixel_size_; |
| - float scale_factor_; |
| + // This state depends on the size of the output surface, and is recreated |
| + // at resize. |
| + struct SizeDependentState { |
|
tapted
2016/06/17 00:23:38
optional since this is in private: (and deque/uniq
|
| + SizeDependentState(); |
| + ~SizeDependentState(); |
| + base::scoped_nsobject<CAContext> ca_context_; |
| + base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; |
| + std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| + gfx::Size pixel_size_; |
| + float scale_factor_ = 1; |
| + // This structure is kept around after a resize to avoid flashes. The |
| + // |swaps_since_discarded_| member counts the number of swaps. |
| + size_t swaps_since_discarded_ = 0; |
| + }; |
|
tapted
2016/06/17 00:23:38
nit: DISALLOW_COPY_AND_ASSIGN(..)
(the unique_ptr
|
| + std::unique_ptr<SizeDependentState> size_dependent_state_; |
| + // When a CAContext is released in the GPU process, it will flash to blank |
| + // immediately in the browser process. Avoid this flash by keeping around |
| + // old CAContexts for several frames. |
| + std::deque<std::unique_ptr<SizeDependentState>> |
| + discarded_size_dependent_state_; |
| struct IOSurfaceInUseQuery { |
| IOSurfaceInUseQuery(); |