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