OLD | NEW |
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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ~GLES2Initializer() { | 43 ~GLES2Initializer() { |
44 gles2::Terminate(); | 44 gles2::Terminate(); |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer); | 48 DISALLOW_COPY_AND_ASSIGN(GLES2Initializer); |
49 }; | 49 }; |
50 | 50 |
51 //////////////////////////////////////////////////////////////////////////////// | 51 //////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
53 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = | 53 base::LazyInstance<GLES2Initializer> g_gles2_initializer = |
54 LAZY_INSTANCE_INITIALIZER; | 54 LAZY_INSTANCE_INITIALIZER; |
55 | 55 |
56 //////////////////////////////////////////////////////////////////////////////// | 56 //////////////////////////////////////////////////////////////////////////////// |
57 | 57 |
58 #if defined(ENABLE_GPU) | 58 #if defined(ENABLE_GPU) |
59 RendererGLContext::ContextLostReason ConvertReason( | 59 RendererGLContext::ContextLostReason ConvertReason( |
60 gpu::error::ContextLostReason reason) { | 60 gpu::error::ContextLostReason reason) { |
61 switch (reason) { | 61 switch (reason) { |
62 case gpu::error::kGuilty: | 62 case gpu::error::kGuilty: |
63 return RendererGLContext::kGuilty; | 63 return RendererGLContext::kGuilty; |
64 case gpu::error::kInnocent: | 64 case gpu::error::kInnocent: |
65 return RendererGLContext::kInnocent; | 65 return RendererGLContext::kInnocent; |
66 case gpu::error::kUnknown: | 66 case gpu::error::kUnknown: |
67 return RendererGLContext::kUnknown; | 67 return RendererGLContext::kUnknown; |
68 } | 68 } |
69 NOTREACHED(); | 69 NOTREACHED(); |
70 return RendererGLContext::kUnknown; | 70 return RendererGLContext::kUnknown; |
71 } | 71 } |
72 #endif | 72 #endif |
73 | 73 |
74 } // namespace anonymous | 74 } // namespace |
75 | 75 |
76 RendererGLContext::~RendererGLContext() { | 76 RendererGLContext::~RendererGLContext() { |
77 Destroy(); | 77 Destroy(); |
78 } | 78 } |
79 | 79 |
80 RendererGLContext* RendererGLContext::CreateViewContext( | 80 RendererGLContext* RendererGLContext::CreateViewContext( |
81 GpuChannelHost* channel, | 81 GpuChannelHost* channel, |
82 int32 surface_id, | 82 int32 surface_id, |
83 RendererGLContext* share_group, | 83 RendererGLContext* share_group, |
84 const char* allowed_extensions, | 84 const char* allowed_extensions, |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 void RendererGLContext::OnContextLost() { | 456 void RendererGLContext::OnContextLost() { |
457 if (!context_lost_callback_.is_null()) { | 457 if (!context_lost_callback_.is_null()) { |
458 RendererGLContext::ContextLostReason reason = kUnknown; | 458 RendererGLContext::ContextLostReason reason = kUnknown; |
459 if (command_buffer_) { | 459 if (command_buffer_) { |
460 reason = ConvertReason( | 460 reason = ConvertReason( |
461 command_buffer_->GetLastState().context_lost_reason); | 461 command_buffer_->GetLastState().context_lost_reason); |
462 } | 462 } |
463 context_lost_callback_.Run(reason); | 463 context_lost_callback_.Run(reason); |
464 } | 464 } |
465 } | 465 } |
OLD | NEW |