| 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_CHILD_WINDOW_SURFACE_WIN_H_ | 5 #ifndef GPU_IPC_SERVICE_CHILD_WINDOW_SURFACE_WIN_H_ |
| 6 #define GPU_IPC_SERVICE_CHILD_WINDOW_SURFACE_WIN_H_ | 6 #define GPU_IPC_SERVICE_CHILD_WINDOW_SURFACE_WIN_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "gpu/ipc/service/image_transport_surface_delegate.h" |
| 8 #include "ui/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
| 9 | 11 |
| 10 #include <windows.h> | 12 #include <windows.h> |
| 11 | 13 |
| 12 namespace gpu { | 14 namespace gpu { |
| 13 | 15 |
| 14 class GpuChannelManager; | 16 class GpuChannelManager; |
| 15 struct SharedData; | 17 struct SharedData; |
| 16 | 18 |
| 17 class ChildWindowSurfaceWin : public gl::NativeViewGLSurfaceEGL { | 19 class ChildWindowSurfaceWin : public gl::NativeViewGLSurfaceEGL { |
| 18 public: | 20 public: |
| 19 ChildWindowSurfaceWin(GpuChannelManager* manager, HWND parent_window); | 21 ChildWindowSurfaceWin(base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
| 22 HWND parent_window); |
| 20 | 23 |
| 21 // GLSurface implementation. | 24 // GLSurface implementation. |
| 22 EGLConfig GetConfig() override; | 25 EGLConfig GetConfig() override; |
| 23 bool Resize(const gfx::Size& size, | 26 bool Resize(const gfx::Size& size, |
| 24 float scale_factor, | 27 float scale_factor, |
| 25 bool has_alpha) override; | 28 bool has_alpha) override; |
| 26 bool InitializeNativeWindow() override; | 29 bool InitializeNativeWindow() override; |
| 27 gfx::SwapResult SwapBuffers() override; | 30 gfx::SwapResult SwapBuffers() override; |
| 28 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 31 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| 29 | 32 |
| 30 protected: | 33 protected: |
| 31 ~ChildWindowSurfaceWin() override; | 34 ~ChildWindowSurfaceWin() override; |
| 32 | 35 |
| 33 private: | 36 private: |
| 34 void ClearInvalidContents(); | 37 void ClearInvalidContents(); |
| 35 | 38 |
| 36 // This member contains all the data that can be accessed from the main or | 39 // This member contains all the data that can be accessed from the main or |
| 37 // window owner threads. | 40 // window owner threads. |
| 38 std::unique_ptr<SharedData> shared_data_; | 41 std::unique_ptr<SharedData> shared_data_; |
| 39 // The eventual parent of the window living in the browser process. | 42 // The eventual parent of the window living in the browser process. |
| 40 HWND parent_window_; | 43 HWND parent_window_; |
| 41 // The window is initially created with this parent window. We need to keep it | 44 // The window is initially created with this parent window. We need to keep it |
| 42 // around so that we can destroy it at the end. | 45 // around so that we can destroy it at the end. |
| 43 HWND initial_parent_window_; | 46 HWND initial_parent_window_; |
| 44 GpuChannelManager* manager_; | 47 base::WeakPtr<ImageTransportSurfaceDelegate> delegate_; |
| 45 bool alpha_; | 48 bool alpha_; |
| 46 bool first_swap_; | 49 bool first_swap_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(ChildWindowSurfaceWin); | 51 DISALLOW_COPY_AND_ASSIGN(ChildWindowSurfaceWin); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace gpu | 54 } // namespace gpu |
| 52 | 55 |
| 53 #endif // GPU_IPC_SERVICE_CHILD_WINDOW_SURFACE_WIN_H_ | 56 #endif // GPU_IPC_SERVICE_CHILD_WINDOW_SURFACE_WIN_H_ |
| OLD | NEW |