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

Side by Side Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc

Issue 8220006: Rename RenderView to RenderViewImpl. Update Chrome's DEPS so that it can't include the RenderView... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « content/renderer/geolocation_dispatcher.cc ('k') | content/renderer/indexed_db_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/GLES2/gl2.h" 9 #include "gpu/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 "gpu/GLES2/gl2ext.h" 13 #include "gpu/GLES2/gl2ext.h"
14 14
15 #include <algorithm> 15 #include <algorithm>
16 #include <set> 16 #include <set>
17 17
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/lazy_instance.h" 19 #include "base/lazy_instance.h"
20 #include "base/string_tokenizer.h" 20 #include "base/string_tokenizer.h"
21 #include "base/command_line.h" 21 #include "base/command_line.h"
22 #include "base/debug/trace_event.h" 22 #include "base/debug/trace_event.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/metrics/histogram.h" 24 #include "base/metrics/histogram.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "content/common/content_switches.h" 26 #include "content/common/content_switches.h"
27 #include "content/renderer/gpu/gpu_channel_host.h" 27 #include "content/renderer/gpu/gpu_channel_host.h"
28 #include "content/renderer/render_thread_impl.h" 28 #include "content/renderer/render_thread_impl.h"
29 #include "content/renderer/render_view.h" 29 #include "content/renderer/render_view_impl.h"
30 #include "gpu/command_buffer/client/gles2_implementation.h" 30 #include "gpu/command_buffer/client/gles2_implementation.h"
31 #include "gpu/command_buffer/common/constants.h" 31 #include "gpu/command_buffer/common/constants.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
35 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" 35 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
36 36
37 static base::LazyInstance<base::Lock> 37 static base::LazyInstance<base::Lock>
38 g_all_shared_contexts_lock(base::LINKER_INITIALIZED); 38 g_all_shared_contexts_lock(base::LINKER_INITIALIZED);
39 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > 39 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> >
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (gpu_info.can_lose_context) 90 if (gpu_info.can_lose_context)
91 return false; 91 return false;
92 } 92 }
93 93
94 if (web_view && web_view->mainFrame()) 94 if (web_view && web_view->mainFrame())
95 active_url_ = GURL(web_view->mainFrame()->document().url()); 95 active_url_ = GURL(web_view->mainFrame()->document().url());
96 96
97 attributes_ = attributes; 97 attributes_ = attributes;
98 render_directly_to_web_view_ = render_directly_to_web_view; 98 render_directly_to_web_view_ = render_directly_to_web_view;
99 if (render_directly_to_web_view_) { 99 if (render_directly_to_web_view_) {
100 RenderView* render_view = RenderView::FromWebView(web_view); 100 RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_view);
101 if (!render_view) 101 if (!render_view)
102 return false; 102 return false;
103 render_view_routing_id_ = render_view->routing_id(); 103 render_view_routing_id_ = render_view->routing_id();
104 web_view_ = web_view; 104 web_view_ = web_view;
105 } 105 }
106 return true; 106 return true;
107 } 107 }
108 108
109 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { 109 bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
110 if (context_) 110 if (context_)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 parent_context_impl ? parent_context_impl->context() : NULL); 234 parent_context_impl ? parent_context_impl->context() : NULL);
235 } 235 }
236 236
237 WebGLId WebGraphicsContext3DCommandBufferImpl::getPlatformTextureId() { 237 WebGLId WebGraphicsContext3DCommandBufferImpl::getPlatformTextureId() {
238 return context_->GetParentTextureId(); 238 return context_->GetParentTextureId();
239 } 239 }
240 240
241 void WebGraphicsContext3DCommandBufferImpl::prepareTexture() { 241 void WebGraphicsContext3DCommandBufferImpl::prepareTexture() {
242 // Copies the contents of the off-screen render target into the texture 242 // Copies the contents of the off-screen render target into the texture
243 // used by the compositor. 243 // used by the compositor.
244 RenderView* renderview = 244 RenderViewImpl* renderview =
245 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 245 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL;
246 if (renderview) 246 if (renderview)
247 renderview->OnViewContextSwapBuffersPosted(); 247 renderview->OnViewContextSwapBuffersPosted();
248 context_->SwapBuffers(); 248 context_->SwapBuffers();
249 context_->Echo(base::Bind( 249 context_->Echo(base::Bind(
250 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete, 250 &WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete,
251 weak_ptr_factory_.GetWeakPtr())); 251 weak_ptr_factory_.GetWeakPtr()));
252 #if defined(OS_MACOSX) 252 #if defined(OS_MACOSX)
253 // It appears that making the compositor's on-screen context current on 253 // It appears that making the compositor's on-screen context current on
254 // other platforms implies this flush. TODO(kbr): this means that the 254 // other platforms implies this flush. TODO(kbr): this means that the
255 // TOUCH build and, in the future, other platforms might need this. 255 // TOUCH build and, in the future, other platforms might need this.
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 void WebGraphicsContext3DCommandBufferImpl::deleteShader(WebGLId shader) { 1017 void WebGraphicsContext3DCommandBufferImpl::deleteShader(WebGLId shader) {
1018 gl_->DeleteShader(shader); 1018 gl_->DeleteShader(shader);
1019 } 1019 }
1020 1020
1021 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) { 1021 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) {
1022 gl_->DeleteTextures(1, &texture); 1022 gl_->DeleteTextures(1, &texture);
1023 } 1023 }
1024 1024
1025 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() { 1025 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() {
1026 // This may be called after tear-down of the RenderView. 1026 // This may be called after tear-down of the RenderView.
1027 RenderView* renderview = 1027 RenderViewImpl* renderview =
1028 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 1028 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL;
1029 if (renderview) 1029 if (renderview)
1030 renderview->OnViewContextSwapBuffersComplete(); 1030 renderview->OnViewContextSwapBuffersComplete();
1031 1031
1032 if (swapbuffers_complete_callback_) 1032 if (swapbuffers_complete_callback_)
1033 swapbuffers_complete_callback_->onSwapBuffersComplete(); 1033 swapbuffers_complete_callback_->onSwapBuffersComplete();
1034 } 1034 }
1035 1035
1036 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback( 1036 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback(
1037 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { 1037 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) {
1038 context_lost_callback_ = cb; 1038 context_lost_callback_ = cb;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1076 }
1077 1077
1078 } // anonymous namespace 1078 } // anonymous namespace
1079 1079
1080 void WebGraphicsContext3DCommandBufferImpl::OnContextLost( 1080 void WebGraphicsContext3DCommandBufferImpl::OnContextLost(
1081 RendererGLContext::ContextLostReason reason) { 1081 RendererGLContext::ContextLostReason reason) {
1082 context_lost_reason_ = convertReason(reason); 1082 context_lost_reason_ = convertReason(reason);
1083 if (context_lost_callback_) { 1083 if (context_lost_callback_) {
1084 context_lost_callback_->onContextLost(); 1084 context_lost_callback_->onContextLost();
1085 } 1085 }
1086 RenderView* renderview = 1086 RenderViewImpl* renderview =
1087 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 1087 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL;
1088 if (renderview) 1088 if (renderview)
1089 renderview->OnViewContextSwapBuffersAborted(); 1089 renderview->OnViewContextSwapBuffersAborted();
1090 } 1090 }
1091 1091
1092 #endif // defined(ENABLE_GPU) 1092 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/renderer/geolocation_dispatcher.cc ('k') | content/renderer/indexed_db_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698