OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
11 #define GL_GLEXT_PROTOTYPES 1 | 11 #define GL_GLEXT_PROTOTYPES 1 |
12 #endif | 12 #endif |
13 #include <GLES2/gl2ext.h> | 13 #include <GLES2/gl2ext.h> |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "base/string_tokenizer.h" | 17 #include "base/string_tokenizer.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/debug/trace_event.h" | 19 #include "base/debug/trace_event.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
22 #include "content/common/content_switches.h" | 22 #include "content/common/content_switches.h" |
23 #include "content/renderer/gpu/gpu_channel_host.h" | 23 #include "content/renderer/gpu/gpu_channel_host.h" |
24 #include "content/renderer/render_thread.h" | 24 #include "content/renderer/render_thread.h" |
25 #include "content/renderer/render_view.h" | 25 #include "content/renderer/render_view.h" |
26 #include "gpu/command_buffer/client/gles2_implementation.h" | 26 #include "gpu/command_buffer/client/gles2_implementation.h" |
27 #include "gpu/command_buffer/common/constants.h" | 27 #include "gpu/command_buffer/common/constants.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
30 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" | 31 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" |
31 | 32 |
32 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl() | 33 WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl() |
33 : context_(NULL), | 34 : context_(NULL), |
34 gl_(NULL), | 35 gl_(NULL), |
35 web_view_(NULL), | 36 web_view_(NULL), |
36 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
37 plugin_handle_(NULL), | 38 plugin_handle_(NULL), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 "GPU.WebGraphicsContext3D_Init_CanLoseContext", | 96 "GPU.WebGraphicsContext3D_Init_CanLoseContext", |
96 attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context, | 97 attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context, |
97 4); | 98 4); |
98 if (attributes.canRecoverFromContextLoss == false) { | 99 if (attributes.canRecoverFromContextLoss == false) { |
99 if (gpu_info.can_lose_context) | 100 if (gpu_info.can_lose_context) |
100 return false; | 101 return false; |
101 } | 102 } |
102 | 103 |
103 GURL active_url; | 104 GURL active_url; |
104 if (web_view && web_view->mainFrame()) | 105 if (web_view && web_view->mainFrame()) |
105 active_url = GURL(web_view->mainFrame()->url()); | 106 active_url = GURL(web_view->mainFrame()->document().url()); |
106 | 107 |
107 RendererGLContext* parent_context = NULL; | 108 RendererGLContext* parent_context = NULL; |
108 if (render_directly_to_web_view) { | 109 if (render_directly_to_web_view) { |
109 RenderView* renderview = RenderView::FromWebView(web_view); | 110 RenderView* renderview = RenderView::FromWebView(web_view); |
110 if (!renderview) | 111 if (!renderview) |
111 return false; | 112 return false; |
112 | 113 |
113 web_view_ = web_view; | 114 web_view_ = web_view; |
114 context_ = RendererGLContext::CreateViewContext( | 115 context_ = RendererGLContext::CreateViewContext( |
115 host, | 116 host, |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 context_lost_callback_->onContextLost(); | 1034 context_lost_callback_->onContextLost(); |
1034 } | 1035 } |
1035 | 1036 |
1036 RenderView* renderview = | 1037 RenderView* renderview = |
1037 web_view_ ? RenderView::FromWebView(web_view_) : NULL; | 1038 web_view_ ? RenderView::FromWebView(web_view_) : NULL; |
1038 if (renderview) | 1039 if (renderview) |
1039 renderview->OnViewContextSwapBuffersAborted(); | 1040 renderview->OnViewContextSwapBuffersAborted(); |
1040 } | 1041 } |
1041 | 1042 |
1042 #endif // defined(ENABLE_GPU) | 1043 #endif // defined(ENABLE_GPU) |
OLD | NEW |