[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / content / gpu / in_process_gpu_thread.cc
blobe4149db9e126a2e132fdfc0058f5c451c3b6826d
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
3 // found in the LICENSE file.
5 #include "content/gpu/in_process_gpu_thread.h"
7 #include "content/common/gpu/gpu_memory_buffer_factory.h"
8 #include "content/gpu/gpu_child_thread.h"
9 #include "content/gpu/gpu_process.h"
10 #include "gpu/command_buffer/service/sync_point_manager.h"
12 namespace content {
14 InProcessGpuThread::InProcessGpuThread(
15 const InProcessChildThreadParams& params,
16 gpu::SyncPointManager* sync_point_manager_override)
17 : base::Thread("Chrome_InProcGpuThread"),
18 params_(params),
19 gpu_process_(NULL),
20 sync_point_manager_override_(sync_point_manager_override),
21 gpu_memory_buffer_factory_(GpuMemoryBufferFactory::Create(
22 GpuChildThread::GetGpuMemoryBufferFactoryType())) {
23 if (!sync_point_manager_override_) {
24 sync_point_manager_.reset(new gpu::SyncPointManager(false));
25 sync_point_manager_override_ = sync_point_manager_.get();
29 InProcessGpuThread::~InProcessGpuThread() {
30 Stop();
33 void InProcessGpuThread::Init() {
34 gpu_process_ = new GpuProcess();
35 // The process object takes ownership of the thread object, so do not
36 // save and delete the pointer.
37 gpu_process_->set_main_thread(new GpuChildThread(
38 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_));
41 void InProcessGpuThread::CleanUp() {
42 SetThreadWasQuitProperly(true);
43 delete gpu_process_;
46 base::Thread* CreateInProcessGpuThread(
47 const InProcessChildThreadParams& params) {
48 return new InProcessGpuThread(params, nullptr);
51 } // namespace content