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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.h

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_
6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ 6 #define CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/gpu/client/gpu_channel_host.h" 18 #include "content/common/content_export.h"
19 #include "content/common/gpu_process_launch_causes.h" 19 #include "content/common/gpu_process_launch_causes.h"
20 #include "gpu/ipc/client/gpu_channel_host.h"
20 #include "ipc/message_filter.h" 21 #include "ipc/message_filter.h"
21 22
22 namespace content { 23 namespace content {
23 class BrowserGpuMemoryBufferManager; 24 class BrowserGpuMemoryBufferManager;
24 25
25 class CONTENT_EXPORT BrowserGpuChannelHostFactory 26 class CONTENT_EXPORT BrowserGpuChannelHostFactory
26 : public GpuChannelHostFactory { 27 : public gpu::GpuChannelHostFactory {
27 public: 28 public:
28 static void Initialize(bool establish_gpu_channel); 29 static void Initialize(bool establish_gpu_channel);
29 static void Terminate(); 30 static void Terminate();
30 static BrowserGpuChannelHostFactory* instance() { return instance_; } 31 static BrowserGpuChannelHostFactory* instance() { return instance_; }
31 32
32 // Overridden from GpuChannelHostFactory: 33 // Overridden from gpu::GpuChannelHostFactory:
33 bool IsMainThread() override; 34 bool IsMainThread() override;
34 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; 35 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
35 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override; 36 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override;
36 37
37 int GpuProcessHostId() { return gpu_host_id_; } 38 int GpuProcessHostId() { return gpu_host_id_; }
38 #if !defined(OS_ANDROID) 39 #if !defined(OS_ANDROID)
39 GpuChannelHost* EstablishGpuChannelSync( 40 gpu::GpuChannelHost* EstablishGpuChannelSync(
40 CauseForGpuLaunch cause_for_gpu_launch); 41 CauseForGpuLaunch cause_for_gpu_launch);
41 #endif 42 #endif
42 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch, 43 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch,
43 const base::Closure& callback); 44 const base::Closure& callback);
44 GpuChannelHost* GetGpuChannel(); 45 gpu::GpuChannelHost* GetGpuChannel();
45 int GetGpuChannelId() { return gpu_client_id_; } 46 int GetGpuChannelId() { return gpu_client_id_; }
46 47
47 // Used to skip GpuChannelHost tests when there can be no GPU process. 48 // Used to skip GpuChannelHost tests when there can be no GPU process.
48 static bool CanUseForTesting(); 49 static bool CanUseForTesting();
49 50
50 private: 51 private:
51 struct CreateRequest; 52 struct CreateRequest;
52 class EstablishRequest; 53 class EstablishRequest;
53 54
54 BrowserGpuChannelHostFactory(); 55 BrowserGpuChannelHostFactory();
55 ~BrowserGpuChannelHostFactory() override; 56 ~BrowserGpuChannelHostFactory() override;
56 57
57 void GpuChannelEstablished(); 58 void GpuChannelEstablished();
58 59
59 static void AddFilterOnIO(int gpu_host_id, 60 static void AddFilterOnIO(int gpu_host_id,
60 scoped_refptr<IPC::MessageFilter> filter); 61 scoped_refptr<IPC::MessageFilter> filter);
61 static void InitializeShaderDiskCacheOnIO(int gpu_client_id, 62 static void InitializeShaderDiskCacheOnIO(int gpu_client_id,
62 const base::FilePath& cache_dir); 63 const base::FilePath& cache_dir);
63 64
64 const int gpu_client_id_; 65 const int gpu_client_id_;
65 const uint64_t gpu_client_tracing_id_; 66 const uint64_t gpu_client_tracing_id_;
66 scoped_ptr<base::WaitableEvent> shutdown_event_; 67 scoped_ptr<base::WaitableEvent> shutdown_event_;
67 scoped_refptr<GpuChannelHost> gpu_channel_; 68 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
68 scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; 69 scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_;
69 int gpu_host_id_; 70 int gpu_host_id_;
70 scoped_refptr<EstablishRequest> pending_request_; 71 scoped_refptr<EstablishRequest> pending_request_;
71 std::vector<base::Closure> established_callbacks_; 72 std::vector<base::Closure> established_callbacks_;
72 73
73 static BrowserGpuChannelHostFactory* instance_; 74 static BrowserGpuChannelHostFactory* instance_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); 76 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory);
76 }; 77 };
77 78
78 } // namespace content 79 } // namespace content
79 80
80 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ 81 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | content/browser/gpu/browser_gpu_channel_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698