| 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 #include "gpu/ipc/service/child_window_surface_win.h" | 5 #include "gpu/ipc/service/child_window_surface_win.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 8 #include "base/win/scoped_hdc.h" | 10 #include "base/win/scoped_hdc.h" |
| 9 #include "base/win/wrapped_window_proc.h" | 11 #include "base/win/wrapped_window_proc.h" |
| 10 #include "gpu/ipc/common/gpu_messages.h" | 12 #include "gpu/ipc/common/gpu_messages.h" |
| 11 #include "gpu/ipc/service/gpu_channel_manager.h" | 13 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 12 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 14 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 13 #include "ui/base/win/hidden_window.h" | 15 #include "ui/base/win/hidden_window.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/win/hwnd_util.h" | 17 #include "ui/gfx/win/hwnd_util.h" |
| 16 #include "ui/gl/egl_util.h" | 18 #include "ui/gl/egl_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 155 } |
| 154 size_ = size; | 156 size_ = size; |
| 155 if (has_alpha == alpha_) { | 157 if (has_alpha == alpha_) { |
| 156 // A 0-size PostSubBuffer doesn't swap but forces the swap chain to resize | 158 // A 0-size PostSubBuffer doesn't swap but forces the swap chain to resize |
| 157 // to match the window. | 159 // to match the window. |
| 158 PostSubBuffer(0, 0, 0, 0); | 160 PostSubBuffer(0, 0, 0, 0); |
| 159 } else { | 161 } else { |
| 160 alpha_ = has_alpha; | 162 alpha_ = has_alpha; |
| 161 config_ = nullptr; | 163 config_ = nullptr; |
| 162 | 164 |
| 163 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 165 std::unique_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
| 164 gfx::GLContext* current_context = gfx::GLContext::GetCurrent(); | 166 gfx::GLContext* current_context = gfx::GLContext::GetCurrent(); |
| 165 bool was_current = current_context && current_context->IsCurrent(this); | 167 bool was_current = current_context && current_context->IsCurrent(this); |
| 166 if (was_current) { | 168 if (was_current) { |
| 167 scoped_make_current.reset( | 169 scoped_make_current.reset( |
| 168 new ui::ScopedMakeCurrent(current_context, this)); | 170 new ui::ScopedMakeCurrent(current_context, this)); |
| 169 current_context->ReleaseCurrent(this); | 171 current_context->ReleaseCurrent(this); |
| 170 } | 172 } |
| 171 | 173 |
| 172 Destroy(); | 174 Destroy(); |
| 173 | 175 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 rect_to_clear_ = gfx::Rect(); | 221 rect_to_clear_ = gfx::Rect(); |
| 220 } | 222 } |
| 221 } | 223 } |
| 222 | 224 |
| 223 ChildWindowSurfaceWin::~ChildWindowSurfaceWin() { | 225 ChildWindowSurfaceWin::~ChildWindowSurfaceWin() { |
| 224 gfx::SetWindowUserData(window_, nullptr); | 226 gfx::SetWindowUserData(window_, nullptr); |
| 225 DestroyWindow(window_); | 227 DestroyWindow(window_); |
| 226 } | 228 } |
| 227 | 229 |
| 228 } // namespace gpu | 230 } // namespace gpu |
| OLD | NEW |