| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_factory_impl
.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" | 9 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" |
| 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 VideoContextProvider( | 120 VideoContextProvider( |
| 121 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) | 121 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) |
| 122 : gl_in_process_context_(gl_in_process_context.get()) { | 122 : gl_in_process_context_(gl_in_process_context.get()) { |
| 123 | 123 |
| 124 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( | 124 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( |
| 125 WrapContext(gl_in_process_context.Pass()), | 125 WrapContext(gl_in_process_context.Pass()), |
| 126 "Video-Offscreen-main-thread"); | 126 "Video-Offscreen-main-thread"); |
| 127 context_provider_->BindToCurrentThread(); | 127 context_provider_->BindToCurrentThread(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 130 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
| 131 uint32 stream_id) override { | 131 uint32 stream_id) override { |
| 132 return gl_in_process_context_->GetSurfaceTexture(stream_id); | 132 return gl_in_process_context_->GetSurfaceTexture(stream_id); |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual gpu::gles2::GLES2Interface* ContextGL() override { | 135 gpu::gles2::GLES2Interface* ContextGL() override { |
| 136 return context_provider_->ContextGL(); | 136 return context_provider_->ContextGL(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) override { | 139 void AddObserver(StreamTextureFactoryContextObserver* obs) override { |
| 140 observer_list_.AddObserver(obs); | 140 observer_list_.AddObserver(obs); |
| 141 } | 141 } |
| 142 | 142 |
| 143 virtual void RemoveObserver( | 143 void RemoveObserver(StreamTextureFactoryContextObserver* obs) override { |
| 144 StreamTextureFactoryContextObserver* obs) override { | |
| 145 observer_list_.RemoveObserver(obs); | 144 observer_list_.RemoveObserver(obs); |
| 146 } | 145 } |
| 147 | 146 |
| 148 void RestoreContext() { | 147 void RestoreContext() { |
| 149 FOR_EACH_OBSERVER(StreamTextureFactoryContextObserver, | 148 FOR_EACH_OBSERVER(StreamTextureFactoryContextObserver, |
| 150 observer_list_, | 149 observer_list_, |
| 151 ResetStreamTextureProxy()); | 150 ResetStreamTextureProxy()); |
| 152 } | 151 } |
| 153 | 152 |
| 154 private: | 153 private: |
| 155 friend class base::RefCountedThreadSafe<VideoContextProvider>; | 154 friend class base::RefCountedThreadSafe<VideoContextProvider>; |
| 156 virtual ~VideoContextProvider() {} | 155 ~VideoContextProvider() override {} |
| 157 | 156 |
| 158 scoped_refptr<cc::ContextProvider> context_provider_; | 157 scoped_refptr<cc::ContextProvider> context_provider_; |
| 159 gpu::GLInProcessContext* gl_in_process_context_; | 158 gpu::GLInProcessContext* gl_in_process_context_; |
| 160 ObserverList<StreamTextureFactoryContextObserver> observer_list_; | 159 ObserverList<StreamTextureFactoryContextObserver> observer_list_; |
| 161 | 160 |
| 162 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); | 161 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); |
| 163 }; | 162 }; |
| 164 | 163 |
| 165 | 164 |
| 166 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() | 165 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 DCHECK(!service_.get()); | 303 DCHECK(!service_.get()); |
| 305 service_ = service; | 304 service_ = service; |
| 306 } | 305 } |
| 307 | 306 |
| 308 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 307 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
| 309 bool record_full_document) { | 308 bool record_full_document) { |
| 310 record_full_layer_ = record_full_document; | 309 record_full_layer_ = record_full_document; |
| 311 } | 310 } |
| 312 | 311 |
| 313 } // namespace content | 312 } // namespace content |
| OLD | NEW |