| 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> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 // This runs on the window owner thread. | 151 // This runs on the window owner thread. |
| 152 void DestroyWindowsOnThread(HWND child_window, HWND hidden_popup_window) { | 152 void DestroyWindowsOnThread(HWND child_window, HWND hidden_popup_window) { |
| 153 DestroyWindow(child_window); | 153 DestroyWindow(child_window); |
| 154 HiddenPopupWindow::Destroy(hidden_popup_window); | 154 HiddenPopupWindow::Destroy(hidden_popup_window); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| 158 | 158 |
| 159 ChildWindowSurfaceWin::ChildWindowSurfaceWin(GpuChannelManager* manager, | 159 ChildWindowSurfaceWin::ChildWindowSurfaceWin( |
| 160 HWND parent_window) | 160 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
| 161 HWND parent_window) |
| 161 : gl::NativeViewGLSurfaceEGL(0), | 162 : gl::NativeViewGLSurfaceEGL(0), |
| 162 parent_window_(parent_window), | 163 parent_window_(parent_window), |
| 163 manager_(manager), | 164 delegate_(delegate), |
| 164 alpha_(true), | 165 alpha_(true), |
| 165 first_swap_(true) { | 166 first_swap_(true) { |
| 166 // Don't use EGL_ANGLE_window_fixed_size so that we can avoid recreating the | 167 // Don't use EGL_ANGLE_window_fixed_size so that we can avoid recreating the |
| 167 // window surface, which can cause flicker on DirectComposition. | 168 // window surface, which can cause flicker on DirectComposition. |
| 168 enable_fixed_size_angle_ = false; | 169 enable_fixed_size_angle_ = false; |
| 169 } | 170 } |
| 170 | 171 |
| 171 EGLConfig ChildWindowSurfaceWin::GetConfig() { | 172 EGLConfig ChildWindowSurfaceWin::GetConfig() { |
| 172 if (!config_) { | 173 if (!config_) { |
| 173 int alpha_size = alpha_ ? 8 : EGL_DONT_CARE; | 174 int alpha_size = alpha_ ? 8 : EGL_DONT_CARE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 213 |
| 213 RECT window_rect; | 214 RECT window_rect; |
| 214 GetClientRect(parent_window_, &window_rect); | 215 GetClientRect(parent_window_, &window_rect); |
| 215 | 216 |
| 216 shared_data_->thread.task_runner()->PostTask( | 217 shared_data_->thread.task_runner()->PostTask( |
| 217 FROM_HERE, | 218 FROM_HERE, |
| 218 base::Bind(&CreateWindowsOnThread, gfx::Rect(window_rect).size(), &event, | 219 base::Bind(&CreateWindowsOnThread, gfx::Rect(window_rect).size(), &event, |
| 219 shared_data_.get(), &window_, &initial_parent_window_)); | 220 shared_data_.get(), &window_, &initial_parent_window_)); |
| 220 event.Wait(); | 221 event.Wait(); |
| 221 | 222 |
| 222 manager_->delegate()->SendAcceleratedSurfaceCreatedChildWindow(parent_window_, | 223 delegate_->DidCreateAcceleratedSurfaceChildWindow(parent_window_, window_); |
| 223 window_); | |
| 224 return true; | 224 return true; |
| 225 } | 225 } |
| 226 | 226 |
| 227 bool ChildWindowSurfaceWin::Resize(const gfx::Size& size, | 227 bool ChildWindowSurfaceWin::Resize(const gfx::Size& size, |
| 228 float scale_factor, | 228 float scale_factor, |
| 229 bool has_alpha) { | 229 bool has_alpha) { |
| 230 if (!SupportsPostSubBuffer()) { | 230 if (!SupportsPostSubBuffer()) { |
| 231 if (!MoveWindow(window_, 0, 0, size.width(), size.height(), FALSE)) { | 231 if (!MoveWindow(window_, 0, 0, size.width(), size.height(), FALSE)) { |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 scoped_refptr<base::TaskRunner> task_runner = | 314 scoped_refptr<base::TaskRunner> task_runner = |
| 315 shared_data_->thread.task_runner(); | 315 shared_data_->thread.task_runner(); |
| 316 task_runner->PostTaskAndReply( | 316 task_runner->PostTaskAndReply( |
| 317 FROM_HERE, | 317 FROM_HERE, |
| 318 base::Bind(&DestroyWindowsOnThread, window_, initial_parent_window_), | 318 base::Bind(&DestroyWindowsOnThread, window_, initial_parent_window_), |
| 319 base::Bind(&DestroySharedData, base::Passed(std::move(shared_data_)))); | 319 base::Bind(&DestroySharedData, base::Passed(std::move(shared_data_)))); |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace gpu | 323 } // namespace gpu |
| OLD | NEW |