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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <utility> |
8 #ifndef GL_GLEXT_PROTOTYPES | 9 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 10 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 11 #endif |
11 #include <GLES2/gl2ext.h> | 12 #include <GLES2/gl2ext.h> |
12 #include <GLES2/gl2extchromium.h> | 13 #include <GLES2/gl2extchromium.h> |
13 #include <stddef.h> | 14 #include <stddef.h> |
14 | 15 |
15 #include <string> | 16 #include <string> |
16 | 17 |
17 #include "base/atomicops.h" | 18 #include "base/atomicops.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 gfx::kNullAcceleratedWidget)); | 62 gfx::kNullAcceleratedWidget)); |
62 } | 63 } |
63 | 64 |
64 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 65 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
65 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 66 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
66 scoped_ptr< ::gpu::GLInProcessContext> context, | 67 scoped_ptr< ::gpu::GLInProcessContext> context, |
67 const blink::WebGraphicsContext3D::Attributes& attributes) { | 68 const blink::WebGraphicsContext3D::Attributes& attributes) { |
68 bool lose_context_when_out_of_memory = false; // Not used. | 69 bool lose_context_when_out_of_memory = false; // Not used. |
69 bool is_offscreen = true; // Not used. | 70 bool is_offscreen = true; // Not used. |
70 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 71 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
71 context.Pass(), | 72 std::move(context), attributes, lose_context_when_out_of_memory, |
72 attributes, | 73 is_offscreen, gfx::kNullAcceleratedWidget /* window. Not used. */)); |
73 lose_context_when_out_of_memory, | |
74 is_offscreen, | |
75 gfx::kNullAcceleratedWidget /* window. Not used. */)); | |
76 } | 74 } |
77 | 75 |
78 WebGraphicsContext3DInProcessCommandBufferImpl:: | 76 WebGraphicsContext3DInProcessCommandBufferImpl:: |
79 WebGraphicsContext3DInProcessCommandBufferImpl( | 77 WebGraphicsContext3DInProcessCommandBufferImpl( |
80 scoped_ptr< ::gpu::GLInProcessContext> context, | 78 scoped_ptr<::gpu::GLInProcessContext> context, |
81 const blink::WebGraphicsContext3D::Attributes& attributes, | 79 const blink::WebGraphicsContext3D::Attributes& attributes, |
82 bool lose_context_when_out_of_memory, | 80 bool lose_context_when_out_of_memory, |
83 bool is_offscreen, | 81 bool is_offscreen, |
84 gfx::AcceleratedWidget window) | 82 gfx::AcceleratedWidget window) |
85 : share_resources_(attributes.shareResources), | 83 : share_resources_(attributes.shareResources), |
86 is_offscreen_(is_offscreen), | 84 is_offscreen_(is_offscreen), |
87 window_(window), | 85 window_(window), |
88 context_(context.Pass()) { | 86 context_(std::move(context)) { |
89 ConvertAttributes(attributes, &attribs_); | 87 ConvertAttributes(attributes, &attribs_); |
90 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory; | 88 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory; |
91 } | 89 } |
92 | 90 |
93 WebGraphicsContext3DInProcessCommandBufferImpl:: | 91 WebGraphicsContext3DInProcessCommandBufferImpl:: |
94 ~WebGraphicsContext3DInProcessCommandBufferImpl() { | 92 ~WebGraphicsContext3DInProcessCommandBufferImpl() { |
95 } | 93 } |
96 | 94 |
97 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() { | 95 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() { |
98 return context_->GetMappedMemoryLimit(); | 96 return context_->GetMappedMemoryLimit(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return real_gl_; | 161 return real_gl_; |
164 } | 162 } |
165 | 163 |
166 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 164 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
167 if (context_lost_callback_) { | 165 if (context_lost_callback_) { |
168 context_lost_callback_->onContextLost(); | 166 context_lost_callback_->onContextLost(); |
169 } | 167 } |
170 } | 168 } |
171 | 169 |
172 } // namespace gpu_blink | 170 } // namespace gpu_blink |
OLD | NEW |