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/gpu/in_process_gpu_thread.h" | 5 #include "content/gpu/in_process_gpu_thread.h" |
6 | 6 |
| 7 #include "base/time/time.h" |
7 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 8 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
8 #include "content/gpu/gpu_child_thread.h" | 9 #include "content/gpu/gpu_child_thread.h" |
9 #include "content/gpu/gpu_process.h" | 10 #include "content/gpu/gpu_process.h" |
10 #include "gpu/command_buffer/service/sync_point_manager.h" | 11 #include "gpu/command_buffer/service/sync_point_manager.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 InProcessGpuThread::InProcessGpuThread( | 15 InProcessGpuThread::InProcessGpuThread( |
15 const InProcessChildThreadParams& params, | 16 const InProcessChildThreadParams& params, |
16 gpu::SyncPointManager* sync_point_manager_override) | 17 gpu::SyncPointManager* sync_point_manager_override) |
(...skipping 10 matching lines...) Expand all Loading... |
27 sync_point_manager_override_ = sync_point_manager_.get(); | 28 sync_point_manager_override_ = sync_point_manager_.get(); |
28 } | 29 } |
29 } | 30 } |
30 | 31 |
31 InProcessGpuThread::~InProcessGpuThread() { | 32 InProcessGpuThread::~InProcessGpuThread() { |
32 Stop(); | 33 Stop(); |
33 } | 34 } |
34 | 35 |
35 void InProcessGpuThread::Init() { | 36 void InProcessGpuThread::Init() { |
36 gpu_process_ = new GpuProcess(); | 37 gpu_process_ = new GpuProcess(); |
| 38 |
37 // The process object takes ownership of the thread object, so do not | 39 // The process object takes ownership of the thread object, so do not |
38 // save and delete the pointer. | 40 // save and delete the pointer. |
39 gpu_process_->set_main_thread(new GpuChildThread( | 41 GpuChildThread* child_thread = new GpuChildThread( |
40 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_)); | 42 params_, gpu_memory_buffer_factory_.get(), sync_point_manager_override_); |
| 43 |
| 44 // Since we are in the browser process, use the thread start time as the |
| 45 // process start time. |
| 46 child_thread->Init(base::Time::Now()); |
| 47 |
| 48 gpu_process_->set_main_thread(child_thread); |
41 } | 49 } |
42 | 50 |
43 void InProcessGpuThread::CleanUp() { | 51 void InProcessGpuThread::CleanUp() { |
44 SetThreadWasQuitProperly(true); | 52 SetThreadWasQuitProperly(true); |
45 delete gpu_process_; | 53 delete gpu_process_; |
46 } | 54 } |
47 | 55 |
48 base::Thread* CreateInProcessGpuThread( | 56 base::Thread* CreateInProcessGpuThread( |
49 const InProcessChildThreadParams& params) { | 57 const InProcessChildThreadParams& params) { |
50 return new InProcessGpuThread(params, nullptr); | 58 return new InProcessGpuThread(params, nullptr); |
51 } | 59 } |
52 | 60 |
53 } // namespace content | 61 } // namespace content |
OLD | NEW |