OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |