| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" | |
| 6 | |
| 7 #include <stdint.h> | |
| 8 | |
| 9 #include <utility> | |
| 10 | |
| 11 #include "base/command_line.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ptr_util.h" | |
| 14 #include "base/thread_task_runner_handle.h" | |
| 15 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | |
| 16 #include "content/browser/android/in_process/synchronous_compositor_registry_in_
proc.h" | |
| 17 #include "content/public/browser/browser_thread.h" | |
| 18 #include "content/public/common/content_switches.h" | |
| 19 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s
ource.h" | |
| 20 #include "content/renderer/android/synchronous_compositor_output_surface.h" | |
| 21 #include "content/renderer/gpu/frame_swap_message_queue.h" | |
| 22 #include "content/renderer/render_thread_impl.h" | |
| 23 #include "gpu/command_buffer/client/gles2_interface.h" | |
| 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | |
| 25 #include "gpu/ipc/client/gpu_channel_host.h" | |
| 26 | |
| 27 namespace content { | |
| 28 | |
| 29 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() { | |
| 30 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 31 switches::kSingleProcess)) { | |
| 32 // TODO(boliu): Figure out how to deal with this more nicely. | |
| 33 SynchronousCompositorFactory::SetInstance(this); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 SynchronousCompositorFactoryImpl::~SynchronousCompositorFactoryImpl() {} | |
| 38 | |
| 39 scoped_refptr<base::SingleThreadTaskRunner> | |
| 40 SynchronousCompositorFactoryImpl::GetCompositorTaskRunner() { | |
| 41 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); | |
| 42 } | |
| 43 | |
| 44 std::unique_ptr<cc::OutputSurface> | |
| 45 SynchronousCompositorFactoryImpl::CreateOutputSurface( | |
| 46 int routing_id, | |
| 47 uint32_t output_surface_id, | |
| 48 const scoped_refptr<FrameSwapMessageQueue>& frame_swap_message_queue, | |
| 49 const scoped_refptr<cc::ContextProvider>& onscreen_context, | |
| 50 const scoped_refptr<cc::ContextProvider>& worker_context) { | |
| 51 return base::WrapUnique(new SynchronousCompositorOutputSurface( | |
| 52 onscreen_context, worker_context, routing_id, output_surface_id, | |
| 53 SynchronousCompositorRegistryInProc::GetInstance(), | |
| 54 frame_swap_message_queue)); | |
| 55 } | |
| 56 | |
| 57 InputHandlerManagerClient* | |
| 58 SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { | |
| 59 return synchronous_input_event_filter(); | |
| 60 } | |
| 61 | |
| 62 SynchronousInputHandlerProxyClient* | |
| 63 SynchronousCompositorFactoryImpl::GetSynchronousInputHandlerProxyClient() { | |
| 64 return synchronous_input_event_filter(); | |
| 65 } | |
| 66 | |
| 67 std::unique_ptr<cc::BeginFrameSource> | |
| 68 SynchronousCompositorFactoryImpl::CreateExternalBeginFrameSource( | |
| 69 int routing_id) { | |
| 70 return base::WrapUnique(new SynchronousCompositorExternalBeginFrameSource( | |
| 71 routing_id, SynchronousCompositorRegistryInProc::GetInstance())); | |
| 72 } | |
| 73 | |
| 74 } // namespace content | |
| OLD | NEW |