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

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 9609008: Implemented Browser Plugin (NOT FOR REVIEW) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merged with Tip-of-Tree Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
6 6
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 active_url_(active_url), 57 active_url_(active_url),
58 swap_client_(swap_client), 58 swap_client_(swap_client),
59 memory_allocation_changed_callback_(0), 59 memory_allocation_changed_callback_(0),
60 context_lost_callback_(0), 60 context_lost_callback_(0),
61 context_lost_reason_(GL_NO_ERROR), 61 context_lost_reason_(GL_NO_ERROR),
62 error_message_callback_(0), 62 error_message_callback_(0),
63 swapbuffers_complete_callback_(0), 63 swapbuffers_complete_callback_(0),
64 gpu_preference_(gfx::PreferIntegratedGpu), 64 gpu_preference_(gfx::PreferIntegratedGpu),
65 cached_width_(0), 65 cached_width_(0),
66 cached_height_(0), 66 cached_height_(0),
67 dead_(false),
67 bound_fbo_(0), 68 bound_fbo_(0),
68 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 69 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
69 } 70 }
70 71
71 WebGraphicsContext3DCommandBufferImpl:: 72 WebGraphicsContext3DCommandBufferImpl::
72 ~WebGraphicsContext3DCommandBufferImpl() { 73 ~WebGraphicsContext3DCommandBufferImpl() {
73 if (host_) { 74 if (host_) {
74 if (host_->WillGpuSwitchOccur(false, gpu_preference_)) { 75 if (host_->WillGpuSwitchOccur(false, gpu_preference_)) {
75 host_->ForciblyCloseChannel(); 76 host_->ForciblyCloseChannel();
76 ClearSharedContexts(); 77 ClearSharedContexts();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 257 }
257 258
258 int WebGraphicsContext3DCommandBufferImpl::width() { 259 int WebGraphicsContext3DCommandBufferImpl::width() {
259 return cached_width_; 260 return cached_width_;
260 } 261 }
261 262
262 int WebGraphicsContext3DCommandBufferImpl::height() { 263 int WebGraphicsContext3DCommandBufferImpl::height() {
263 return cached_height_; 264 return cached_height_;
264 } 265 }
265 266
267 void WebGraphicsContext3DCommandBufferImpl::playDead() {
268 dead_ = true;
269 OnContextLost(ContentGLContext::kInnocent);
270 }
271
266 bool WebGraphicsContext3DCommandBufferImpl::isGLES2Compliant() { 272 bool WebGraphicsContext3DCommandBufferImpl::isGLES2Compliant() {
267 return true; 273 return true;
268 } 274 }
269 275
270 bool WebGraphicsContext3DCommandBufferImpl::setParentContext( 276 bool WebGraphicsContext3DCommandBufferImpl::setParentContext(
271 WebGraphicsContext3D* parent_context) { 277 WebGraphicsContext3D* parent_context) {
272 WebGraphicsContext3DCommandBufferImpl* parent_context_impl = 278 WebGraphicsContext3DCommandBufferImpl* parent_context_impl =
273 static_cast<WebGraphicsContext3DCommandBufferImpl*>(parent_context); 279 static_cast<WebGraphicsContext3DCommandBufferImpl*>(parent_context);
274 return context_->SetParent( 280 return context_->SetParent(
275 parent_context_impl ? parent_context_impl->context() : NULL); 281 parent_context_impl ? parent_context_impl->context() : NULL);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin(); 756 std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin();
751 WGC3Denum err = *iter; 757 WGC3Denum err = *iter;
752 synthetic_errors_.erase(iter); 758 synthetic_errors_.erase(iter);
753 return err; 759 return err;
754 } 760 }
755 761
756 return gl_->GetError(); 762 return gl_->GetError();
757 } 763 }
758 764
759 bool WebGraphicsContext3DCommandBufferImpl::isContextLost() { 765 bool WebGraphicsContext3DCommandBufferImpl::isContextLost() {
760 return initialize_failed_ || 766 return dead_ || initialize_failed_ ||
761 (context_ && context_->IsCommandBufferContextLost()) || 767 (context_ && context_->IsCommandBufferContextLost()) ||
762 context_lost_reason_ != GL_NO_ERROR; 768 context_lost_reason_ != GL_NO_ERROR;
763 } 769 }
764 770
765 DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*) 771 DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*)
766 772
767 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, 773 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv,
768 GetFramebufferAttachmentParameteriv, 774 GetFramebufferAttachmentParameteriv,
769 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*) 775 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*)
770 776
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) { 1149 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) {
1144 error_message_callback_ = cb; 1150 error_message_callback_ = cb;
1145 } 1151 }
1146 1152
1147 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback( 1153 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback(
1148 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { 1154 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) {
1149 context_lost_callback_ = cb; 1155 context_lost_callback_ = cb;
1150 } 1156 }
1151 1157
1152 WGC3Denum WebGraphicsContext3DCommandBufferImpl::getGraphicsResetStatusARB() { 1158 WGC3Denum WebGraphicsContext3DCommandBufferImpl::getGraphicsResetStatusARB() {
1153 if (context_->IsCommandBufferContextLost() && 1159 if (dead_ || (context_->IsCommandBufferContextLost() &&
1154 context_lost_reason_ == GL_NO_ERROR) { 1160 context_lost_reason_ == GL_NO_ERROR)) {
1155 return GL_UNKNOWN_CONTEXT_RESET_ARB; 1161 return GL_UNKNOWN_CONTEXT_RESET_ARB;
1156 } 1162 }
1157 1163
1158 return context_lost_reason_; 1164 return context_lost_reason_;
1159 } 1165 }
1160 1166
1161 void WebGraphicsContext3DCommandBufferImpl:: 1167 void WebGraphicsContext3DCommandBufferImpl::
1162 setSwapBuffersCompleteCallbackCHROMIUM( 1168 setSwapBuffersCompleteCallbackCHROMIUM(
1163 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* cb) { 1169 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* cb) {
1164 swapbuffers_complete_callback_ = cb; 1170 swapbuffers_complete_callback_ = cb;
(...skipping 24 matching lines...) Expand all
1189 } 1195 }
1190 1196
1191 NOTREACHED(); 1197 NOTREACHED();
1192 return GL_UNKNOWN_CONTEXT_RESET_ARB; 1198 return GL_UNKNOWN_CONTEXT_RESET_ARB;
1193 } 1199 }
1194 1200
1195 } // anonymous namespace 1201 } // anonymous namespace
1196 1202
1197 void WebGraphicsContext3DCommandBufferImpl::OnContextLost( 1203 void WebGraphicsContext3DCommandBufferImpl::OnContextLost(
1198 ContentGLContext::ContextLostReason reason) { 1204 ContentGLContext::ContextLostReason reason) {
1205
1199 context_lost_reason_ = convertReason(reason); 1206 context_lost_reason_ = convertReason(reason);
1200 if (context_lost_callback_) { 1207 if (context_lost_callback_) {
1201 context_lost_callback_->onContextLost(); 1208 context_lost_callback_->onContextLost();
1202 } 1209 }
1203 if (attributes_.shareResources) 1210 if (attributes_.shareResources)
1204 ClearSharedContexts(); 1211 ClearSharedContexts();
1205 if (ShouldUseSwapClient()) 1212 if (ShouldUseSwapClient())
1206 swap_client_->OnViewContextSwapBuffersAborted(); 1213 swap_client_->OnViewContextSwapBuffersAborted();
1207 } 1214 }
1208 1215
1209 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( 1216 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage(
1210 const std::string& message, int id) { 1217 const std::string& message, int id) {
1211 if (error_message_callback_) { 1218 if (error_message_callback_) {
1212 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); 1219 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str());
1213 error_message_callback_->onErrorMessage(str, id); 1220 error_message_callback_->onErrorMessage(str, id);
1214 } 1221 }
1215 } 1222 }
1216 1223
OLDNEW
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698