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

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

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/common/gpu/client/gpu_channel_host.h" 12 #include "content/common/gpu/client/gpu_channel_host.h"
13 #include "ipc/message_filter.h" 13 #include "ipc/message_filter.h"
14 14
15 namespace content { 15 namespace content {
16 class BrowserGpuMemoryBufferManager; 16 class BrowserGpuMemoryBufferManager;
17 class GpuMemoryBufferFactoryHostImpl; 17 class GpuMemoryBufferFactoryHostImpl;
18 18
19 class CONTENT_EXPORT BrowserGpuChannelHostFactory 19 class CONTENT_EXPORT BrowserGpuChannelHostFactory
20 : public GpuChannelHostFactory { 20 : public GpuChannelHostFactory {
21 public: 21 public:
22 static void Initialize(bool establish_gpu_channel); 22 static void Initialize(bool establish_gpu_channel);
23 static void Terminate(); 23 static void Terminate();
24 static BrowserGpuChannelHostFactory* instance() { return instance_; } 24 static BrowserGpuChannelHostFactory* instance() { return instance_; }
25 25
26 // GpuChannelHostFactory implementation. 26 // GpuChannelHostFactory implementation.
27 virtual bool IsMainThread() override; 27 bool IsMainThread() override;
28 virtual base::MessageLoop* GetMainLoop() override; 28 base::MessageLoop* GetMainLoop() override;
29 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override; 29 scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override;
30 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( 30 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override;
31 size_t size) override; 31 CreateCommandBufferResult CreateViewCommandBuffer(
32 virtual CreateCommandBufferResult CreateViewCommandBuffer(
33 int32 surface_id, 32 int32 surface_id,
34 const GPUCreateCommandBufferConfig& init_params, 33 const GPUCreateCommandBufferConfig& init_params,
35 int32 route_id) override; 34 int32 route_id) override;
36 35
37 // Specify a task runner and callback to be used for a set of messages. The 36 // Specify a task runner and callback to be used for a set of messages. The
38 // callback will be set up on the current GpuProcessHost, identified by 37 // callback will be set up on the current GpuProcessHost, identified by
39 // GpuProcessHostId(). 38 // GpuProcessHostId().
40 virtual void SetHandlerForControlMessages( 39 virtual void SetHandlerForControlMessages(
41 const uint32* message_ids, 40 const uint32* message_ids,
42 size_t num_messages, 41 size_t num_messages,
43 const base::Callback<void(const IPC::Message&)>& handler, 42 const base::Callback<void(const IPC::Message&)>& handler,
44 base::TaskRunner* target_task_runner); 43 base::TaskRunner* target_task_runner);
45 int GpuProcessHostId() { return gpu_host_id_; } 44 int GpuProcessHostId() { return gpu_host_id_; }
46 GpuChannelHost* EstablishGpuChannelSync( 45 GpuChannelHost* EstablishGpuChannelSync(
47 CauseForGpuLaunch cause_for_gpu_launch); 46 CauseForGpuLaunch cause_for_gpu_launch);
48 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch, 47 void EstablishGpuChannel(CauseForGpuLaunch cause_for_gpu_launch,
49 const base::Closure& callback); 48 const base::Closure& callback);
50 GpuChannelHost* GetGpuChannel(); 49 GpuChannelHost* GetGpuChannel();
51 int GetGpuChannelId() { return gpu_client_id_; } 50 int GetGpuChannelId() { return gpu_client_id_; }
52 51
53 // Used to skip GpuChannelHost tests when there can be no GPU process. 52 // Used to skip GpuChannelHost tests when there can be no GPU process.
54 static bool CanUseForTesting(); 53 static bool CanUseForTesting();
55 54
56 private: 55 private:
57 struct CreateRequest; 56 struct CreateRequest;
58 class EstablishRequest; 57 class EstablishRequest;
59 58
60 BrowserGpuChannelHostFactory(); 59 BrowserGpuChannelHostFactory();
61 virtual ~BrowserGpuChannelHostFactory(); 60 ~BrowserGpuChannelHostFactory() override;
62 61
63 void GpuChannelEstablished(); 62 void GpuChannelEstablished();
64 void CreateViewCommandBufferOnIO( 63 void CreateViewCommandBufferOnIO(
65 CreateRequest* request, 64 CreateRequest* request,
66 int32 surface_id, 65 int32 surface_id,
67 const GPUCreateCommandBufferConfig& init_params); 66 const GPUCreateCommandBufferConfig& init_params);
68 static void CommandBufferCreatedOnIO(CreateRequest* request, 67 static void CommandBufferCreatedOnIO(CreateRequest* request,
69 CreateCommandBufferResult result); 68 CreateCommandBufferResult result);
70 static void AddFilterOnIO(int gpu_host_id, 69 static void AddFilterOnIO(int gpu_host_id,
71 scoped_refptr<IPC::MessageFilter> filter); 70 scoped_refptr<IPC::MessageFilter> filter);
72 71
73 const int gpu_client_id_; 72 const int gpu_client_id_;
74 scoped_ptr<base::WaitableEvent> shutdown_event_; 73 scoped_ptr<base::WaitableEvent> shutdown_event_;
75 scoped_refptr<GpuChannelHost> gpu_channel_; 74 scoped_refptr<GpuChannelHost> gpu_channel_;
76 scoped_ptr<GpuMemoryBufferFactoryHostImpl> gpu_memory_buffer_factory_host_; 75 scoped_ptr<GpuMemoryBufferFactoryHostImpl> gpu_memory_buffer_factory_host_;
77 scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; 76 scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_;
78 int gpu_host_id_; 77 int gpu_host_id_;
79 scoped_refptr<EstablishRequest> pending_request_; 78 scoped_refptr<EstablishRequest> pending_request_;
80 std::vector<base::Closure> established_callbacks_; 79 std::vector<base::Closure> established_callbacks_;
81 80
82 static BrowserGpuChannelHostFactory* instance_; 81 static BrowserGpuChannelHostFactory* instance_;
83 82
84 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); 83 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory);
85 }; 84 };
86 85
87 } // namespace content 86 } // namespace content
88 87
89 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ 88 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_
OLDNEW
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_mac.cc ('k') | content/browser/gpu/browser_gpu_memory_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698