Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 6462034: Refactor how surfaces are acquired for GPU compositing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix view views build. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 PaintCompositorHostWindow(hWnd); 1539 PaintCompositorHostWindow(hWnd);
1540 return 0; 1540 return 0;
1541 default: 1541 default:
1542 return DefWindowProc(hWnd, message, wParam, lParam); 1542 return DefWindowProc(hWnd, message, wParam, lParam);
1543 } 1543 }
1544 } 1544 }
1545 1545
1546 // Creates a HWND within the RenderWidgetHostView that will serve as a host 1546 // Creates a HWND within the RenderWidgetHostView that will serve as a host
1547 // for a HWND that the GPU process will create. The host window is used 1547 // for a HWND that the GPU process will create. The host window is used
1548 // to Z-position the GPU's window relative to other plugin windows. 1548 // to Z-position the GPU's window relative to other plugin windows.
1549 gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositorHostWindow() { 1549 gfx::PluginWindowHandle RenderWidgetHostViewWin::AcquireCompositingSurface() {
1550 // If the window has been created, don't recreate it a second time 1550 // If the window has been created, don't recreate it a second time
1551 if (compositor_host_window_) 1551 if (compositor_host_window_)
1552 return compositor_host_window_; 1552 return compositor_host_window_;
1553 1553
1554 static ATOM window_class = 0; 1554 static ATOM window_class = 0;
1555 if (!window_class) { 1555 if (!window_class) {
1556 WNDCLASSEX wcex; 1556 WNDCLASSEX wcex;
1557 wcex.cbSize = sizeof(WNDCLASSEX); 1557 wcex.cbSize = sizeof(WNDCLASSEX);
1558 wcex.style = 0; 1558 wcex.style = 0;
1559 wcex.lpfnWndProc = CompositorHostWindowProc; 1559 wcex.lpfnWndProc = CompositorHostWindowProc;
(...skipping 18 matching lines...) Expand all
1578 compositor_host_window_ = CreateWindowEx( 1578 compositor_host_window_ = CreateWindowEx(
1579 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, 1579 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
1580 MAKEINTATOM(window_class), 0, 1580 MAKEINTATOM(window_class), 0,
1581 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, 1581 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED,
1582 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); 1582 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0);
1583 DCHECK(compositor_host_window_); 1583 DCHECK(compositor_host_window_);
1584 1584
1585 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_); 1585 return static_cast<gfx::PluginWindowHandle>(compositor_host_window_);
1586 } 1586 }
1587 1587
1588 void RenderWidgetHostViewWin::ReleaseCompositingSurface(
1589 gfx::PluginWindowHandle surface) {
1590 ShowCompositorHostWindow(false);
1591 }
1592
1588 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { 1593 void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) {
1589 // When we first create the compositor, we will get a show request from 1594 // When we first create the compositor, we will get a show request from
1590 // the renderer before we have gotten the create request from the GPU. In this 1595 // the renderer before we have gotten the create request from the GPU. In this
1591 // case, simply ignore the show request. 1596 // case, simply ignore the show request.
1592 if (compositor_host_window_ == NULL) 1597 if (compositor_host_window_ == NULL)
1593 return; 1598 return;
1594 1599
1595 if (show) { 1600 if (show) {
1596 UINT flags = SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | 1601 UINT flags = SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
1597 SWP_NOACTIVATE | SWP_DEFERERASE | SWP_SHOWWINDOW; 1602 SWP_NOACTIVATE | SWP_DEFERERASE | SWP_SHOWWINDOW;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 } 1815 }
1811 1816
1812 // static 1817 // static
1813 RenderWidgetHostView* 1818 RenderWidgetHostView*
1814 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1819 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1815 gfx::NativeView native_view) { 1820 gfx::NativeView native_view) {
1816 return ::IsWindow(native_view) ? 1821 return ::IsWindow(native_view) ?
1817 reinterpret_cast<RenderWidgetHostView*>( 1822 reinterpret_cast<RenderWidgetHostView*>(
1818 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; 1823 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL;
1819 } 1824 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698