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

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

Issue 7765013: Revert 98504 - 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,
99 share_group, 98 share_group,
100 allowed_extensions, 99 allowed_extensions,
101 attrib_list, 100 attrib_list,
102 active_url)) 101 active_url))
103 return NULL; 102 return NULL;
104 103
105 return context.release(); 104 return context.release();
106 #else 105 #else
107 return NULL; 106 return NULL;
108 #endif 107 #endif
(...skipping 15 matching lines...) Expand all
124 const char* allowed_extensions, 123 const char* allowed_extensions,
125 const int32* attrib_list, 124 const int32* attrib_list,
126 const GURL& active_url) { 125 const GURL& active_url) {
127 #if defined(ENABLE_GPU) 126 #if defined(ENABLE_GPU)
128 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); 127 scoped_ptr<RendererGLContext> context(new RendererGLContext(channel));
129 if (!context->Initialize( 128 if (!context->Initialize(
130 false, 129 false,
131 0, 130 0,
132 size, 131 size,
133 share_resources, 132 share_resources,
134 false,
135 share_group, 133 share_group,
136 allowed_extensions, 134 allowed_extensions,
137 attrib_list, 135 attrib_list,
138 active_url)) 136 active_url))
139 return NULL; 137 return NULL;
140 138
141 return context.release(); 139 return context.release();
142 #else 140 #else
143 return NULL; 141 return NULL;
144 #endif 142 #endif
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 gles2_implementation_(NULL), 301 gles2_implementation_(NULL),
304 last_error_(SUCCESS), 302 last_error_(SUCCESS),
305 frame_number_(0) { 303 frame_number_(0) {
306 DCHECK(channel); 304 DCHECK(channel);
307 } 305 }
308 306
309 bool RendererGLContext::Initialize(bool onscreen, 307 bool RendererGLContext::Initialize(bool onscreen,
310 int render_view_id, 308 int render_view_id,
311 const gfx::Size& size, 309 const gfx::Size& size,
312 bool share_resources, 310 bool share_resources,
313 bool bind_generates_resource,
314 RendererGLContext* share_group, 311 RendererGLContext* share_group,
315 const char* allowed_extensions, 312 const char* allowed_extensions,
316 const int32* attrib_list, 313 const int32* attrib_list,
317 const GURL& active_url) { 314 const GURL& active_url) {
318 DCHECK(size.width() >= 0 && size.height() >= 0); 315 DCHECK(size.width() >= 0 && size.height() >= 0);
319 TRACE_EVENT2("gpu", "RendererGLContext::Initialize", 316 TRACE_EVENT2("gpu", "RendererGLContext::Initialize",
320 "on_screen", onscreen, "num_pixels", size.GetArea()); 317 "on_screen", onscreen, "num_pixels", size.GetArea());
321 318
322 if (channel_->state() != GpuChannelHost::kConnected) 319 if (channel_->state() != GpuChannelHost::kConnected)
323 return false; 320 return false;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 Destroy(); 415 Destroy();
419 return false; 416 return false;
420 } 417 }
421 418
422 // Create the object exposing the OpenGL API. 419 // Create the object exposing the OpenGL API.
423 gles2_implementation_ = new gpu::gles2::GLES2Implementation( 420 gles2_implementation_ = new gpu::gles2::GLES2Implementation(
424 gles2_helper_, 421 gles2_helper_,
425 transfer_buffer.size, 422 transfer_buffer.size,
426 transfer_buffer.ptr, 423 transfer_buffer.ptr,
427 transfer_buffer_id_, 424 transfer_buffer_id_,
428 share_resources, 425 share_resources);
429 bind_generates_resource);
430 426
431 size_ = size; 427 size_ = size;
432 428
433 return true; 429 return true;
434 } 430 }
435 431
436 void RendererGLContext::Destroy() { 432 void RendererGLContext::Destroy() {
437 TRACE_EVENT0("gpu", "RendererGLContext::Destroy"); 433 TRACE_EVENT0("gpu", "RendererGLContext::Destroy");
438 SetParent(NULL); 434 SetParent(NULL);
439 435
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 void RendererGLContext::OnContextLost() { 469 void RendererGLContext::OnContextLost() {
474 if (context_lost_callback_.get()) { 470 if (context_lost_callback_.get()) {
475 RendererGLContext::ContextLostReason reason = kUnknown; 471 RendererGLContext::ContextLostReason reason = kUnknown;
476 if (command_buffer_) { 472 if (command_buffer_) {
477 reason = ConvertReason( 473 reason = ConvertReason(
478 command_buffer_->GetLastState().context_lost_reason); 474 command_buffer_->GetLastState().context_lost_reason);
479 } 475 }
480 context_lost_callback_->Run(reason); 476 context_lost_callback_->Run(reason);
481 } 477 }
482 } 478 }
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