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

Side by Side Diff: services/ui/public/cpp/gpu_service.h

Issue 2257713002: services/ui: GpuService should only be used from a single thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gpu-service-cleanup
Patch Set: tot merge Created 4 years, 4 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 | « no previous file | services/ui/public/cpp/gpu_service.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_
6 #define SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_ 6 #define SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const gpu::GpuChannelEstablishedCallback& callback) override; 46 const gpu::GpuChannelEstablishedCallback& callback) override;
47 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override; 47 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override;
48 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; 48 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
49 49
50 private: 50 private:
51 friend struct base::DefaultSingletonTraits<GpuService>; 51 friend struct base::DefaultSingletonTraits<GpuService>;
52 52
53 GpuService(shell::Connector* connector, 53 GpuService(shell::Connector* connector,
54 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 54 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
55 55
56 scoped_refptr<gpu::GpuChannelHost> GetGpuChannelLocked(); 56 scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
57 void EstablishGpuChannelOnMainThread();
58 void EstablishGpuChannelOnMainThreadSyncLocked(); 57 void EstablishGpuChannelOnMainThreadSyncLocked();
59 void EstablishGpuChannelOnMainThreadDone( 58 void OnEstablishedGpuChannel(int client_id,
60 bool locked, 59 mojo::ScopedMessagePipeHandle channel_handle,
61 int client_id, 60 const gpu::GPUInfo& gpu_info);
62 mojo::ScopedMessagePipeHandle channel_handle,
63 const gpu::GPUInfo& gpu_info);
64 61
65 // gpu::GpuChannelHostFactory overrides: 62 // gpu::GpuChannelHostFactory overrides:
66 bool IsMainThread() override; 63 bool IsMainThread() override;
67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; 64 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( 65 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
69 size_t size) override; 66 size_t size) override;
70 67
71 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 68 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 69 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
73 shell::Connector* connector_; 70 shell::Connector* connector_;
74 base::WaitableEvent shutdown_event_; 71 base::WaitableEvent shutdown_event_;
75 std::unique_ptr<base::Thread> io_thread_; 72 std::unique_ptr<base::Thread> io_thread_;
76 std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_; 73 std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_;
77 74
78 // Lock for |gpu_channel_|, |establish_callbacks_| & |is_establishing_|.
79 base::Lock lock_;
80 bool is_establishing_;
81 ui::mojom::GpuServicePtr gpu_service_; 75 ui::mojom::GpuServicePtr gpu_service_;
82 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 76 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
83 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_; 77 std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_;
84 base::ConditionVariable establishing_condition_;
85 78
86 DISALLOW_COPY_AND_ASSIGN(GpuService); 79 DISALLOW_COPY_AND_ASSIGN(GpuService);
87 }; 80 };
88 81
89 } // namespace ui 82 } // namespace ui
90 83
91 #endif // SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_ 84 #endif // SERVICES_UI_PUBLIC_CPP_GPU_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/public/cpp/gpu_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698