| 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_impl.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "cc/input/input_handler.h" | 10 #include "cc/input/input_handler.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 SynchronousInputEventFilter* synchronous_input_event_filter() { | 100 SynchronousInputEventFilter* synchronous_input_event_filter() { |
| 101 return &synchronous_input_event_filter_; | 101 return &synchronous_input_event_filter_; |
| 102 } | 102 } |
| 103 | 103 |
| 104 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 104 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 105 CreateOffscreenContext() { | 105 CreateOffscreenContext() { |
| 106 if (!gfx::GLSurface::InitializeOneOff()) | 106 if (!gfx::GLSurface::InitializeOneOff()) |
| 107 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 107 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 108 | 108 |
| 109 const char* allowed_extensions = "*"; | |
| 110 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 109 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 111 | 110 |
| 112 WebKit::WebGraphicsContext3D::Attributes attributes; | 111 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 113 attributes.antialias = false; | 112 attributes.antialias = false; |
| 114 attributes.shareResources = true; | 113 attributes.shareResources = true; |
| 115 attributes.noAutomaticFlushes = true; | 114 attributes.noAutomaticFlushes = true; |
| 116 | 115 |
| 117 gpu::GLInProcessContextAttribs in_process_attribs; | 116 gpu::GLInProcessContextAttribs in_process_attribs; |
| 118 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 117 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( |
| 119 attributes, &in_process_attribs); | 118 attributes, &in_process_attribs); |
| 120 scoped_ptr<gpu::GLInProcessContext> context( | 119 scoped_ptr<gpu::GLInProcessContext> context( |
| 121 gpu::GLInProcessContext::CreateContext(true, | 120 gpu::GLInProcessContext::CreateContext(true, |
| 122 NULL, | 121 NULL, |
| 123 gfx::Size(1, 1), | 122 gfx::Size(1, 1), |
| 124 attributes.shareResources, | 123 attributes.shareResources, |
| 125 allowed_extensions, | |
| 126 in_process_attribs, | 124 in_process_attribs, |
| 127 gpu_preference)); | 125 gpu_preference)); |
| 128 | 126 |
| 129 wrapped_gl_context_for_main_thread_ = context.get(); | 127 wrapped_gl_context_for_main_thread_ = context.get(); |
| 130 if (!context.get()) | 128 if (!context.get()) |
| 131 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 129 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 132 | 130 |
| 133 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 131 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 134 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 132 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 135 context.Pass(), attributes)); | 133 context.Pass(), attributes)); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 g_factory.Get(); // Ensure it's initialized. | 372 g_factory.Get(); // Ensure it's initialized. |
| 375 SynchronousCompositorImpl::CreateForWebContents(contents); | 373 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 376 } | 374 } |
| 377 if (SynchronousCompositorImpl* instance = | 375 if (SynchronousCompositorImpl* instance = |
| 378 SynchronousCompositorImpl::FromWebContents(contents)) { | 376 SynchronousCompositorImpl::FromWebContents(contents)) { |
| 379 instance->SetClient(client); | 377 instance->SetClient(client); |
| 380 } | 378 } |
| 381 } | 379 } |
| 382 | 380 |
| 383 } // namespace content | 381 } // namespace content |
| OLD | NEW |