OLD | NEW |
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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "chrome/renderer/webgles2context_impl.h" | 7 #include "chrome/renderer/webgles2context_impl.h" |
8 | 8 |
9 #include "chrome/renderer/gpu_channel_host.h" | 9 #include "chrome/renderer/gpu_channel_host.h" |
10 #include "chrome/renderer/render_thread.h" | 10 #include "chrome/renderer/render_thread.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 return false; | 38 return false; |
39 DCHECK(host->state() == GpuChannelHost::CONNECTED); | 39 DCHECK(host->state() == GpuChannelHost::CONNECTED); |
40 | 40 |
41 // If a WebView is passed then create a context rendering directly | 41 // If a WebView is passed then create a context rendering directly |
42 // into the window used by the WebView, otherwise create an offscreen | 42 // into the window used by the WebView, otherwise create an offscreen |
43 // context. | 43 // context. |
44 if (web_view) { | 44 if (web_view) { |
45 RenderView* renderview = RenderView::FromWebView(web_view); | 45 RenderView* renderview = RenderView::FromWebView(web_view); |
46 if (!renderview) | 46 if (!renderview) |
47 return false; | 47 return false; |
48 gfx::NativeViewId view_id = renderview->host_window(); | 48 gfx::NativeViewId view_id; |
49 context_ = ggl::CreateViewContext(host, view_id); | 49 #if !defined(OS_MACOSX) |
| 50 view_id = renderview->host_window(); |
| 51 #else |
| 52 view_id = static_cast<gfx::NativeViewId>( |
| 53 renderview->AllocateFakePluginWindowHandle(true, true)); |
| 54 #endif |
| 55 context_ = ggl::CreateViewContext( |
| 56 host, view_id, |
| 57 renderview->routing_id()); |
50 } else { | 58 } else { |
51 ggl::Context* parent_context = NULL; | 59 ggl::Context* parent_context = NULL; |
52 | 60 |
53 if (parent) { | 61 if (parent) { |
54 WebGLES2ContextImpl* parent_context_impl = | 62 WebGLES2ContextImpl* parent_context_impl = |
55 static_cast<WebGLES2ContextImpl*>(parent); | 63 static_cast<WebGLES2ContextImpl*>(parent); |
56 parent_context = parent_context_impl->context(); | 64 parent_context = parent_context_impl->context(); |
57 DCHECK(parent_context); | 65 DCHECK(parent_context); |
58 } | 66 } |
59 context_ = ggl::CreateOffscreenContext(host, parent_context, | 67 context_ = ggl::CreateOffscreenContext(host, parent_context, |
(...skipping 16 matching lines...) Expand all Loading... |
76 } | 84 } |
77 | 85 |
78 void WebGLES2ContextImpl::resizeOffscreenContent(const WebKit::WebSize& size) { | 86 void WebGLES2ContextImpl::resizeOffscreenContent(const WebKit::WebSize& size) { |
79 ggl::ResizeOffscreenContext(context_, size); | 87 ggl::ResizeOffscreenContext(context_, size); |
80 } | 88 } |
81 | 89 |
82 unsigned WebGLES2ContextImpl::getOffscreenContentParentTextureId() { | 90 unsigned WebGLES2ContextImpl::getOffscreenContentParentTextureId() { |
83 return ggl::GetParentTextureId(context_); | 91 return ggl::GetParentTextureId(context_); |
84 } | 92 } |
85 | 93 |
| 94 #if defined(OS_MACOSX) |
| 95 void WebGLES2ContextImpl::resizeOnscreenContent(const WebKit::WebSize& size) { |
| 96 ggl::ResizeOnscreenContext(context_, size); |
| 97 } |
| 98 #endif |
| 99 |
86 #endif // defined(ENABLE_GPU) | 100 #endif // defined(ENABLE_GPU) |
87 | 101 |
OLD | NEW |