Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: content/gpu/in_process_gpu_thread.cc

Issue 2781293003: gpu: Have GpuService create and own GpuMemoryBufferFactory. (Closed)
Patch Set: tot merge. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/gpu/in_process_gpu_thread.h ('k') | gpu/ipc/service/gpu_memory_buffer_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/time/time.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/gpu/gpu_child_thread.h" 9 #include "content/gpu/gpu_child_thread.h"
10 #include "content/gpu/gpu_process.h" 10 #include "content/gpu/gpu_process.h"
11 #include "gpu/config/gpu_info_collector.h" 11 #include "gpu/config/gpu_info_collector.h"
12 #include "gpu/config/gpu_util.h" 12 #include "gpu/config/gpu_util.h"
13 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
14 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
15 #include "ui/gl/init/gl_factory.h" 13 #include "ui/gl/init/gl_factory.h"
16 14
17 #if defined(OS_ANDROID) 15 #if defined(OS_ANDROID)
18 #include "base/android/jni_android.h" 16 #include "base/android/jni_android.h"
19 #endif 17 #endif
20 18
21 #if defined(USE_OZONE) 19 #if defined(USE_OZONE)
22 #include "ui/ozone/public/ozone_platform.h" 20 #include "ui/ozone/public/ozone_platform.h"
23 #endif 21 #endif
24 22
25 namespace content { 23 namespace content {
26 24
27 InProcessGpuThread::InProcessGpuThread( 25 InProcessGpuThread::InProcessGpuThread(const InProcessChildThreadParams& params)
28 const InProcessChildThreadParams& params,
29 const gpu::GpuPreferences& gpu_preferences)
30 : base::Thread("Chrome_InProcGpuThread"), 26 : base::Thread("Chrome_InProcGpuThread"),
31 params_(params), 27 params_(params),
32 gpu_process_(NULL), 28 gpu_process_(NULL) {}
33 gpu_preferences_(gpu_preferences),
34 gpu_memory_buffer_factory_(
35 gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER
36 ? gpu::GpuMemoryBufferFactory::CreateNativeType()
37 : nullptr) {}
38 29
39 InProcessGpuThread::~InProcessGpuThread() { 30 InProcessGpuThread::~InProcessGpuThread() {
40 Stop(); 31 Stop();
41 } 32 }
42 33
43 void InProcessGpuThread::Init() { 34 void InProcessGpuThread::Init() {
44 base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; 35 base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL;
45 36
46 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
47 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread() 38 // Call AttachCurrentThreadWithName, before any other AttachCurrentThread()
(...skipping 17 matching lines...) Expand all
65 if (!gl::init::InitializeGLOneOff()) 56 if (!gl::init::InitializeGLOneOff())
66 VLOG(1) << "gl::init::InitializeGLOneOff failed"; 57 VLOG(1) << "gl::init::InitializeGLOneOff failed";
67 else 58 else
68 gpu::CollectContextGraphicsInfo(&gpu_info); 59 gpu::CollectContextGraphicsInfo(&gpu_info);
69 60
70 gpu::GpuFeatureInfo gpu_feature_info = 61 gpu::GpuFeatureInfo gpu_feature_info =
71 gpu::GetGpuFeatureInfo(gpu_info, *base::CommandLine::ForCurrentProcess()); 62 gpu::GetGpuFeatureInfo(gpu_info, *base::CommandLine::ForCurrentProcess());
72 63
73 // The process object takes ownership of the thread object, so do not 64 // The process object takes ownership of the thread object, so do not
74 // save and delete the pointer. 65 // save and delete the pointer.
75 GpuChildThread* child_thread = new GpuChildThread( 66 GpuChildThread* child_thread =
76 params_, gpu_info, gpu_feature_info, gpu_memory_buffer_factory_.get()); 67 new GpuChildThread(params_, gpu_info, gpu_feature_info);
77 68
78 // Since we are in the browser process, use the thread start time as the 69 // Since we are in the browser process, use the thread start time as the
79 // process start time. 70 // process start time.
80 child_thread->Init(base::Time::Now()); 71 child_thread->Init(base::Time::Now());
81 72
82 gpu_process_->set_main_thread(child_thread); 73 gpu_process_->set_main_thread(child_thread);
83 } 74 }
84 75
85 void InProcessGpuThread::CleanUp() { 76 void InProcessGpuThread::CleanUp() {
86 SetThreadWasQuitProperly(true); 77 SetThreadWasQuitProperly(true);
87 delete gpu_process_; 78 delete gpu_process_;
88 } 79 }
89 80
90 base::Thread* CreateInProcessGpuThread( 81 base::Thread* CreateInProcessGpuThread(
91 const InProcessChildThreadParams& params, 82 const InProcessChildThreadParams& params) {
92 const gpu::GpuPreferences& gpu_preferences) { 83 return new InProcessGpuThread(params);
93 return new InProcessGpuThread(params, gpu_preferences);
94 } 84 }
95 85
96 } // namespace content 86 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/in_process_gpu_thread.h ('k') | gpu/ipc/service/gpu_memory_buffer_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698