| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/android/in_process/synchronous_compositor_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/output/begin_frame_args.h" | 9 #include "cc/output/begin_frame_args.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> | 31 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 32 CreateWebGraphicsContext3D(scoped_refptr<gfx::GLSurface> surface) { | 32 CreateWebGraphicsContext3D(scoped_refptr<gfx::GLSurface> surface) { |
| 33 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 33 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 34 if (!gfx::GLSurface::InitializeOneOff()) | 34 if (!gfx::GLSurface::InitializeOneOff()) |
| 35 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 35 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 36 | 36 |
| 37 const char* allowed_extensions = "*"; | |
| 38 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 37 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 39 | 38 |
| 40 WebKit::WebGraphicsContext3D::Attributes attributes; | 39 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 41 attributes.antialias = false; | 40 attributes.antialias = false; |
| 42 attributes.shareResources = true; | 41 attributes.shareResources = true; |
| 43 attributes.noAutomaticFlushes = true; | 42 attributes.noAutomaticFlushes = true; |
| 44 | 43 |
| 45 gpu::GLInProcessContextAttribs in_process_attribs; | 44 gpu::GLInProcessContextAttribs in_process_attribs; |
| 46 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 45 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( |
| 47 attributes, &in_process_attribs); | 46 attributes, &in_process_attribs); |
| 48 scoped_ptr<gpu::GLInProcessContext> context( | 47 scoped_ptr<gpu::GLInProcessContext> context( |
| 49 gpu::GLInProcessContext::CreateWithSurface(surface, | 48 gpu::GLInProcessContext::CreateWithSurface(surface, |
| 50 attributes.shareResources, | 49 attributes.shareResources, |
| 51 allowed_extensions, | |
| 52 in_process_attribs, | 50 in_process_attribs, |
| 53 gpu_preference)); | 51 gpu_preference)); |
| 54 | 52 |
| 55 if (!context.get()) | 53 if (!context.get()) |
| 56 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 54 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 57 | 55 |
| 58 return WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 56 return WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 59 context.Pass(), attributes).Pass(); | 57 context.Pass(), attributes).Pass(); |
| 60 } | 58 } |
| 61 | 59 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 277 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 280 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 278 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 281 } | 279 } |
| 282 | 280 |
| 283 SynchronousCompositorOutputSurfaceDelegate* | 281 SynchronousCompositorOutputSurfaceDelegate* |
| 284 SynchronousCompositorOutputSurface::GetDelegate() { | 282 SynchronousCompositorOutputSurface::GetDelegate() { |
| 285 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 283 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
| 286 } | 284 } |
| 287 | 285 |
| 288 } // namespace content | 286 } // namespace content |
| OLD | NEW |