summaryrefslogtreecommitdiffstats
path: root/content/gpu/in_process_gpu_thread.cc
blob: dfd9d358e5fe7575dc60b8079dcd66e54d5113eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/gpu/in_process_gpu_thread.h"

#include "content/gpu/gpu_child_thread.h"
#include "content/gpu/gpu_process.h"

namespace content {

InProcessGpuThread::InProcessGpuThread(const InProcessChildThreadParams& params)
    : base::Thread("Chrome_InProcGpuThread"),
      params_(params),
      gpu_process_(NULL) {
}

InProcessGpuThread::~InProcessGpuThread() {
  Stop();
}

void InProcessGpuThread::Init() {
  gpu_process_ = new GpuProcess();
  // The process object takes ownership of the thread object, so do not
  // save and delete the pointer.
  gpu_process_->set_main_thread(new GpuChildThread(params_));
}

void InProcessGpuThread::CleanUp() {
  SetThreadWasQuitProperly(true);
  delete gpu_process_;
}

base::Thread* CreateInProcessGpuThread(
    const InProcessChildThreadParams& params) {
  return new InProcessGpuThread(params);
}

}  // namespace content