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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const scoped_refptr<cc::ContextProvider>& context_provider, | 52 const scoped_refptr<cc::ContextProvider>& context_provider, |
53 gpu::GLInProcessContext* gl_in_process_context) | 53 gpu::GLInProcessContext* gl_in_process_context) |
54 : context_provider_(context_provider), | 54 : context_provider_(context_provider), |
55 gl_in_process_context_(gl_in_process_context) {} | 55 gl_in_process_context_(gl_in_process_context) {} |
56 | 56 |
57 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 57 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
58 uint32 stream_id) OVERRIDE { | 58 uint32 stream_id) OVERRIDE { |
59 return gl_in_process_context_->GetSurfaceTexture(stream_id); | 59 return gl_in_process_context_->GetSurfaceTexture(stream_id); |
60 } | 60 } |
61 | 61 |
62 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE { | 62 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE { |
63 return context_provider_->Context3d(); | 63 return context_provider_->Context3d(); |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 friend class base::RefCountedThreadSafe<VideoContextProvider>; | 67 friend class base::RefCountedThreadSafe<VideoContextProvider>; |
68 virtual ~VideoContextProvider() {} | 68 virtual ~VideoContextProvider() {} |
69 | 69 |
70 scoped_refptr<cc::ContextProvider> context_provider_; | 70 scoped_refptr<cc::ContextProvider> context_provider_; |
71 gpu::GLInProcessContext* gl_in_process_context_; | 71 gpu::GLInProcessContext* gl_in_process_context_; |
72 | 72 |
(...skipping 29 matching lines...) Expand all Loading... |
102 return &synchronous_input_event_filter_; | 102 return &synchronous_input_event_filter_; |
103 } | 103 } |
104 | 104 |
105 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 105 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
106 CreateOffscreenContext() { | 106 CreateOffscreenContext() { |
107 if (!gfx::GLSurface::InitializeOneOff()) | 107 if (!gfx::GLSurface::InitializeOneOff()) |
108 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 108 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
109 | 109 |
110 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 110 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
111 | 111 |
112 WebKit::WebGraphicsContext3D::Attributes attributes; | 112 blink::WebGraphicsContext3D::Attributes attributes; |
113 attributes.antialias = false; | 113 attributes.antialias = false; |
114 attributes.shareResources = true; | 114 attributes.shareResources = true; |
115 attributes.noAutomaticFlushes = true; | 115 attributes.noAutomaticFlushes = true; |
116 | 116 |
117 gpu::GLInProcessContextAttribs in_process_attribs; | 117 gpu::GLInProcessContextAttribs in_process_attribs; |
118 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 118 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( |
119 attributes, &in_process_attribs); | 119 attributes, &in_process_attribs); |
120 scoped_ptr<gpu::GLInProcessContext> context( | 120 scoped_ptr<gpu::GLInProcessContext> context( |
121 gpu::GLInProcessContext::CreateContext(true, | 121 gpu::GLInProcessContext::CreateContext(true, |
122 NULL, | 122 NULL, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) { | 405 void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) { |
406 DCHECK(CalledOnValidThread()); | 406 DCHECK(CalledOnValidThread()); |
407 if (compositor_client_) | 407 if (compositor_client_) |
408 compositor_client_->SetContinuousInvalidate(enable); | 408 compositor_client_->SetContinuousInvalidate(enable); |
409 } | 409 } |
410 | 410 |
411 InputEventAckState SynchronousCompositorImpl::HandleInputEvent( | 411 InputEventAckState SynchronousCompositorImpl::HandleInputEvent( |
412 const WebKit::WebInputEvent& input_event) { | 412 const blink::WebInputEvent& input_event) { |
413 DCHECK(CalledOnValidThread()); | 413 DCHECK(CalledOnValidThread()); |
414 return g_factory.Get().synchronous_input_event_filter()->HandleInputEvent( | 414 return g_factory.Get().synchronous_input_event_filter()->HandleInputEvent( |
415 contents_->GetRoutingID(), input_event); | 415 contents_->GetRoutingID(), input_event); |
416 } | 416 } |
417 | 417 |
418 void SynchronousCompositorImpl::UpdateFrameMetaData( | 418 void SynchronousCompositorImpl::UpdateFrameMetaData( |
419 const cc::CompositorFrameMetadata& frame_metadata) { | 419 const cc::CompositorFrameMetadata& frame_metadata) { |
420 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( | 420 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( |
421 contents_->GetRenderWidgetHostView()); | 421 contents_->GetRenderWidgetHostView()); |
422 if (rwhv) | 422 if (rwhv) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 g_factory.Get(); // Ensure it's initialized. | 483 g_factory.Get(); // Ensure it's initialized. |
484 SynchronousCompositorImpl::CreateForWebContents(contents); | 484 SynchronousCompositorImpl::CreateForWebContents(contents); |
485 } | 485 } |
486 if (SynchronousCompositorImpl* instance = | 486 if (SynchronousCompositorImpl* instance = |
487 SynchronousCompositorImpl::FromWebContents(contents)) { | 487 SynchronousCompositorImpl::FromWebContents(contents)) { |
488 instance->SetClient(client); | 488 instance->SetClient(client); |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 } // namespace content | 492 } // namespace content |
OLD | NEW |