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

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

Issue 540443002: Enable sync allocation of GpuMemoryBuffers from the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | content/browser/gpu/browser_gpu_channel_host_factory.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 (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 "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
14 #include "ipc/message_filter.h" 13 #include "ipc/message_filter.h"
15 14
16 namespace content { 15 namespace content {
16 class GpuMemoryBufferImpl;
17 class GpuMemoryBufferFactoryHostImpl;
17 18
18 class CONTENT_EXPORT BrowserGpuChannelHostFactory 19 class CONTENT_EXPORT BrowserGpuChannelHostFactory
19 : public GpuChannelHostFactory, 20 : public GpuChannelHostFactory {
20 public GpuMemoryBufferFactoryHost {
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 virtual bool IsMainThread() OVERRIDE;
28 virtual base::MessageLoop* GetMainLoop() OVERRIDE; 28 virtual base::MessageLoop* GetMainLoop() OVERRIDE;
29 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE; 29 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE;
30 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory( 30 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(
31 size_t size) OVERRIDE; 31 size_t size) OVERRIDE;
32 virtual CreateCommandBufferResult CreateViewCommandBuffer( 32 virtual CreateCommandBufferResult CreateViewCommandBuffer(
33 int32 surface_id, 33 int32 surface_id,
34 const GPUCreateCommandBufferConfig& init_params, 34 const GPUCreateCommandBufferConfig& init_params,
35 int32 route_id) OVERRIDE; 35 int32 route_id) OVERRIDE;
36 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( 36 virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
37 size_t width, 37 size_t width,
38 size_t height, 38 size_t height,
39 unsigned internalformat, 39 unsigned internalformat,
40 unsigned usage) OVERRIDE; 40 unsigned usage) OVERRIDE;
41 virtual void DeleteGpuMemoryBuffer( 41 virtual void DeleteGpuMemoryBuffer(
42 scoped_ptr<gfx::GpuMemoryBuffer> buffer) OVERRIDE; 42 scoped_ptr<gfx::GpuMemoryBuffer> buffer) OVERRIDE;
43 43
44 // GpuMemoryBufferFactoryHost implementation.
45 virtual void CreateGpuMemoryBuffer(
46 const gfx::GpuMemoryBufferHandle& handle,
47 const gfx::Size& size,
48 unsigned internalformat,
49 unsigned usage,
50 const CreateGpuMemoryBufferCallback& callback) OVERRIDE;
51 virtual void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
52 int32 sync_point) OVERRIDE;
53
54 // Specify a task runner and callback to be used for a set of messages. The 44 // Specify a task runner and callback to be used for a set of messages. The
55 // callback will be set up on the current GpuProcessHost, identified by 45 // callback will be set up on the current GpuProcessHost, identified by
56 // GpuProcessHostId(). 46 // GpuProcessHostId().
57 virtual void SetHandlerForControlMessages( 47 virtual void SetHandlerForControlMessages(
58 const uint32* message_ids, 48 const uint32* message_ids,
59 size_t num_messages, 49 size_t num_messages,
60 const base::Callback<void(const IPC::Message&)>& handler, 50 const base::Callback<void(const IPC::Message&)>& handler,
61 base::TaskRunner* target_task_runner); 51 base::TaskRunner* target_task_runner);
62 int GpuProcessHostId() { return gpu_host_id_; } 52 int GpuProcessHostId() { return gpu_host_id_; }
63 GpuChannelHost* EstablishGpuChannelSync( 53 GpuChannelHost* EstablishGpuChannelSync(
(...skipping 20 matching lines...) Expand all
84 int32 surface_id, 74 int32 surface_id,
85 const GPUCreateCommandBufferConfig& init_params); 75 const GPUCreateCommandBufferConfig& init_params);
86 static void CommandBufferCreatedOnIO(CreateRequest* request, 76 static void CommandBufferCreatedOnIO(CreateRequest* request,
87 CreateCommandBufferResult result); 77 CreateCommandBufferResult result);
88 static void AddFilterOnIO(int gpu_host_id, 78 static void AddFilterOnIO(int gpu_host_id,
89 scoped_refptr<IPC::MessageFilter> filter); 79 scoped_refptr<IPC::MessageFilter> filter);
90 static void AllocateGpuMemoryBufferOnIO( 80 static void AllocateGpuMemoryBufferOnIO(
91 AllocateGpuMemoryBufferRequest* request); 81 AllocateGpuMemoryBufferRequest* request);
92 static void DeleteGpuMemoryBufferOnIO( 82 static void DeleteGpuMemoryBufferOnIO(
93 scoped_ptr<gfx::GpuMemoryBuffer> buffer); 83 scoped_ptr<gfx::GpuMemoryBuffer> buffer);
94 void OnGpuMemoryBufferCreated(uint32 request_id, 84 static void OnGpuMemoryBufferCreated(AllocateGpuMemoryBufferRequest* request,
95 const gfx::GpuMemoryBufferHandle& handle); 85 scoped_ptr<GpuMemoryBufferImpl> buffer);
96 86
97 const int gpu_client_id_; 87 const int gpu_client_id_;
98 scoped_ptr<base::WaitableEvent> shutdown_event_; 88 scoped_ptr<base::WaitableEvent> shutdown_event_;
99 scoped_refptr<GpuChannelHost> gpu_channel_; 89 scoped_refptr<GpuChannelHost> gpu_channel_;
90 scoped_ptr<GpuMemoryBufferFactoryHostImpl> gpu_memory_buffer_factory_host_;
100 int gpu_host_id_; 91 int gpu_host_id_;
101 scoped_refptr<EstablishRequest> pending_request_; 92 scoped_refptr<EstablishRequest> pending_request_;
102 std::vector<base::Closure> established_callbacks_; 93 std::vector<base::Closure> established_callbacks_;
103 uint32 next_create_gpu_memory_buffer_request_id_;
104 typedef std::map<uint32, CreateGpuMemoryBufferCallback>
105 CreateGpuMemoryBufferCallbackMap;
106 CreateGpuMemoryBufferCallbackMap create_gpu_memory_buffer_requests_;
107 94
108 static BrowserGpuChannelHostFactory* instance_; 95 static BrowserGpuChannelHostFactory* instance_;
109 96
110 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); 97 DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory);
111 }; 98 };
112 99
113 } // namespace content 100 } // namespace content
114 101
115 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_ 102 #endif // CONTENT_BROWSER_GPU_BROWSER_GPU_CHANNEL_HOST_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/browser_gpu_channel_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698