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

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

Issue 7762009: Manually merging trunk revs 95836 and 96904 to 835 branch (second attempt) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 3 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) 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 #include "content/renderer/gpu/renderer_gl_context.h" 5 #include "content/renderer/gpu/renderer_gl_context.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const char* allowed_extensions, 88 const char* allowed_extensions,
89 const int32* attrib_list, 89 const int32* attrib_list,
90 const GURL& active_url) { 90 const GURL& active_url) {
91 #if defined(ENABLE_GPU) 91 #if defined(ENABLE_GPU)
92 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); 92 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel));
93 if (!context->Initialize( 93 if (!context->Initialize(
94 true, 94 true,
95 render_view_id, 95 render_view_id,
96 gfx::Size(), 96 gfx::Size(),
97 share_resources, 97 share_resources,
98 false,
98 share_group, 99 share_group,
99 allowed_extensions, 100 allowed_extensions,
100 attrib_list, 101 attrib_list,
101 active_url)) 102 active_url))
102 return NULL; 103 return NULL;
103 104
104 return context.release(); 105 return context.release();
105 #else 106 #else
106 return NULL; 107 return NULL;
107 #endif 108 #endif
(...skipping 15 matching lines...) Expand all
123 const char* allowed_extensions, 124 const char* allowed_extensions,
124 const int32* attrib_list, 125 const int32* attrib_list,
125 const GURL& active_url) { 126 const GURL& active_url) {
126 #if defined(ENABLE_GPU) 127 #if defined(ENABLE_GPU)
127 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); 128 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel));
128 if (!context->Initialize( 129 if (!context->Initialize(
129 false, 130 false,
130 0, 131 0,
131 size, 132 size,
132 share_resources, 133 share_resources,
134 false,
133 share_group, 135 share_group,
134 allowed_extensions, 136 allowed_extensions,
135 attrib_list, 137 attrib_list,
136 active_url)) 138 active_url))
137 return NULL; 139 return NULL;
138 140
139 return context.release(); 141 return context.release();
140 #else 142 #else
141 return NULL; 143 return NULL;
142 #endif 144 #endif
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 gles2_implementation_(NULL), 303 gles2_implementation_(NULL),
302 last_error_(SUCCESS), 304 last_error_(SUCCESS),
303 frame_number_(0) { 305 frame_number_(0) {
304 DCHECK(channel); 306 DCHECK(channel);
305 } 307 }
306 308
307 bool RendererGLContext::Initialize(bool onscreen, 309 bool RendererGLContext::Initialize(bool onscreen,
308 int render_view_id, 310 int render_view_id,
309 const gfx::Size& size, 311 const gfx::Size& size,
310 bool share_resources, 312 bool share_resources,
313 bool bind_generates_resource,
311 RendererGLContext* share_group, 314 RendererGLContext* share_group,
312 const char* allowed_extensions, 315 const char* allowed_extensions,
313 const int32* attrib_list, 316 const int32* attrib_list,
314 const GURL& active_url) { 317 const GURL& active_url) {
315 DCHECK(size.width() >= 0 && size.height() >= 0); 318 DCHECK(size.width() >= 0 && size.height() >= 0);
316 TRACE_EVENT2("gpu", "RendererGLContext::Initialize", 319 TRACE_EVENT2("gpu", "RendererGLContext::Initialize",
317 "on_screen", onscreen, "num_pixels", size.GetArea()); 320 "on_screen", onscreen, "num_pixels", size.GetArea());
318 321
319 if (channel_->state() != GpuChannelHost::kConnected) 322 if (channel_->state() != GpuChannelHost::kConnected)
320 return false; 323 return false;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 Destroy(); 418 Destroy();
416 return false; 419 return false;
417 } 420 }
418 421
419 // Create the object exposing the OpenGL API. 422 // Create the object exposing the OpenGL API.
420 gles2_implementation_ = new gpu::gles2::GLES2Implementation( 423 gles2_implementation_ = new gpu::gles2::GLES2Implementation(
421 gles2_helper_, 424 gles2_helper_,
422 transfer_buffer.size, 425 transfer_buffer.size,
423 transfer_buffer.ptr, 426 transfer_buffer.ptr,
424 transfer_buffer_id_, 427 transfer_buffer_id_,
425 share_resources); 428 share_resources,
429 bind_generates_resource);
426 430
427 size_ = size; 431 size_ = size;
428 432
429 return true; 433 return true;
430 } 434 }
431 435
432 void RendererGLContext::Destroy() { 436 void RendererGLContext::Destroy() {
433 TRACE_EVENT0("gpu", "RendererGLContext::Destroy"); 437 TRACE_EVENT0("gpu", "RendererGLContext::Destroy");
434 SetParent(NULL); 438 SetParent(NULL);
435 439
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 void RendererGLContext::OnContextLost() { 473 void RendererGLContext::OnContextLost() {
470 if (context_lost_callback_.get()) { 474 if (context_lost_callback_.get()) {
471 RendererGLContext::ContextLostReason reason = kUnknown; 475 RendererGLContext::ContextLostReason reason = kUnknown;
472 if (command_buffer_) { 476 if (command_buffer_) {
473 reason = ConvertReason( 477 reason = ConvertReason(
474 command_buffer_->GetLastState().context_lost_reason); 478 command_buffer_->GetLastState().context_lost_reason);
475 } 479 }
476 context_lost_callback_->Run(reason); 480 context_lost_callback_->Run(reason);
477 } 481 }
478 } 482 }
OLDNEW
« no previous file with comments | « content/renderer/gpu/renderer_gl_context.h ('k') | gpu/command_buffer/build_gles2_cmd_buffer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698