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

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

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ~GLES2Initializer() { 45 ~GLES2Initializer() {
46 gles2::Terminate(); 46 gles2::Terminate();
47 } 47 }
48 48
49 private: 49 private:
50 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer); 50 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer);
51 }; 51 };
52 52
53 //////////////////////////////////////////////////////////////////////////////// 53 ////////////////////////////////////////////////////////////////////////////////
54 54
55 static base::LazyInstance<GLES2Initializer> g_gles2_initializer( 55 static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
56 base::LINKER_INITIALIZED); 56 LAZY_INSTANCE_INITIALIZER;
57 57
58 //////////////////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////////////////
59 59
60 #if defined(ENABLE_GPU) 60 #if defined(ENABLE_GPU)
61 RendererGLContext::ContextLostReason ConvertReason( 61 RendererGLContext::ContextLostReason ConvertReason(
62 gpu::error::ContextLostReason reason) { 62 gpu::error::ContextLostReason reason) {
63 switch (reason) { 63 switch (reason) {
64 case gpu::error::kGuilty: 64 case gpu::error::kGuilty:
65 return RendererGLContext::kGuilty; 65 return RendererGLContext::kGuilty;
66 case gpu::error::kInnocent: 66 case gpu::error::kInnocent:
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 void RendererGLContext::OnContextLost() { 464 void RendererGLContext::OnContextLost() {
465 if (!context_lost_callback_.is_null()) { 465 if (!context_lost_callback_.is_null()) {
466 RendererGLContext::ContextLostReason reason = kUnknown; 466 RendererGLContext::ContextLostReason reason = kUnknown;
467 if (command_buffer_) { 467 if (command_buffer_) {
468 reason = ConvertReason( 468 reason = ConvertReason(
469 command_buffer_->GetLastState().context_lost_reason); 469 command_buffer_->GetLastState().context_lost_reason);
470 } 470 }
471 context_lost_callback_.Run(reason); 471 context_lost_callback_.Run(reason);
472 } 472 }
473 } 473 }
OLDNEW
« no previous file with comments | « content/renderer/devtools_agent.cc ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698