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/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 GLHelperHolder* holder = new GLHelperHolder; | 128 GLHelperHolder* holder = new GLHelperHolder; |
129 holder->Initialize(); | 129 holder->Initialize(); |
130 | 130 |
131 return holder; | 131 return holder; |
132 } | 132 } |
133 | 133 |
134 GLHelperHolder::GLHelperHolder() { | 134 GLHelperHolder::GLHelperHolder() { |
135 } | 135 } |
136 | 136 |
137 GLHelperHolder::~GLHelperHolder() { | 137 GLHelperHolder::~GLHelperHolder() { |
138 if (context_) { | |
139 context_->traceEndCHROMIUM(); | |
David Yen
2014/12/18 21:26:00
Should this one be removed as well?
vmiura
2014/12/18 21:49:39
Yeah, let's remove this one as well.
David Yen
2014/12/18 21:54:27
Done.
| |
140 } | |
138 } | 141 } |
139 | 142 |
140 void GLHelperHolder::Initialize() { | 143 void GLHelperHolder::Initialize() { |
141 context_ = CreateContext3D(); | 144 context_ = CreateContext3D(); |
142 if (context_) { | 145 if (context_) { |
143 context_->setContextLostCallback(this); | 146 context_->setContextLostCallback(this); |
144 gl_helper_.reset(new GLHelper(context_->GetImplementation(), | 147 gl_helper_.reset(new GLHelper(context_->GetImplementation(), |
145 context_->GetContextSupport())); | 148 context_->GetContextSupport())); |
146 } | 149 } |
147 } | 150 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 187 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); |
185 limits.mapped_memory_reclaim_limit = | 188 limits.mapped_memory_reclaim_limit = |
186 WebGraphicsContext3DCommandBufferImpl::kNoLimit; | 189 WebGraphicsContext3DCommandBufferImpl::kNoLimit; |
187 bool lose_context_when_out_of_memory = false; | 190 bool lose_context_when_out_of_memory = false; |
188 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 191 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
189 new WebGraphicsContext3DCommandBufferImpl( | 192 new WebGraphicsContext3DCommandBufferImpl( |
190 0, // offscreen | 193 0, // offscreen |
191 url, gpu_channel_host.get(), attrs, lose_context_when_out_of_memory, | 194 url, gpu_channel_host.get(), attrs, lose_context_when_out_of_memory, |
192 limits, nullptr)); | 195 limits, nullptr)); |
193 if (context->InitializeOnCurrentThread()) { | 196 if (context->InitializeOnCurrentThread()) { |
194 context->pushGroupMarkerEXT( | 197 context->traceBeginCHROMIUM( |
198 "gpu_toplevel", | |
195 base::StringPrintf("CmdBufferImageTransportFactory-%p", | 199 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
196 context.get()).c_str()); | 200 context.get()).c_str()); |
197 } else { | 201 } else { |
198 context.reset(); | 202 context.reset(); |
199 } | 203 } |
200 | 204 |
201 return context.Pass(); | 205 return context.Pass(); |
202 } | 206 } |
203 | 207 |
204 // This can only be used for readback postprocessing. It may return null if the | 208 // This can only be used for readback postprocessing. It may return null if the |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1901 results->orientationAngle = display.RotationAsDegree(); | 1905 results->orientationAngle = display.RotationAsDegree(); |
1902 results->orientationType = | 1906 results->orientationType = |
1903 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1907 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1904 gfx::DeviceDisplayInfo info; | 1908 gfx::DeviceDisplayInfo info; |
1905 results->depth = info.GetBitsPerPixel(); | 1909 results->depth = info.GetBitsPerPixel(); |
1906 results->depthPerComponent = info.GetBitsPerComponent(); | 1910 results->depthPerComponent = info.GetBitsPerComponent(); |
1907 results->isMonochrome = (results->depthPerComponent == 0); | 1911 results->isMonochrome = (results->depthPerComponent == 0); |
1908 } | 1912 } |
1909 | 1913 |
1910 } // namespace content | 1914 } // namespace content |
OLD | NEW |