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

Side by Side Diff: gpu/command_buffer/common/buffer.h

Issue 211703003: GPU: 'Pass' SharedMemory when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@GPU_ref_count_buffer
Patch Set: Rebase. Created 6 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/common/gpu/gpu_command_buffer_stub.cc ('k') | gpu/command_buffer/common/buffer.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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "gpu/command_buffer/common/types.h" 11 #include "gpu/command_buffer/common/types.h"
12 #include "gpu/gpu_export.h" 12 #include "gpu/gpu_export.h"
13 13
14 namespace base { 14 namespace base {
15 class SharedMemory; 15 class SharedMemory;
16 } 16 }
17 17
18 namespace gpu { 18 namespace gpu {
19 19
20 // Buffer/ThreadSafeBuffer own a piece of shared-memory of a certain size. 20 // Buffer owns a piece of shared-memory of a certain size.
21 class GPU_EXPORT Buffer : public base::RefCountedThreadSafe<Buffer> { 21 class GPU_EXPORT Buffer : public base::RefCountedThreadSafe<Buffer> {
22 public: 22 public:
23 Buffer(scoped_ptr<base::SharedMemory> shared_memory, size_t size); 23 Buffer(scoped_ptr<base::SharedMemory> shared_memory, size_t size);
24 24
25 base::SharedMemory* shared_memory() { return shared_memory_.get(); } 25 base::SharedMemory* shared_memory() { return shared_memory_.get(); }
26 void* memory() { return memory_; } 26 void* memory() { return memory_; }
27 size_t size() { return size_; } 27 size_t size() { return size_; }
28 28
29 private: 29 private:
30 friend class base::RefCountedThreadSafe<Buffer>; 30 friend class base::RefCountedThreadSafe<Buffer>;
31 ~Buffer(); 31 ~Buffer();
32 32
33 scoped_ptr<base::SharedMemory> shared_memory_; 33 scoped_ptr<base::SharedMemory> shared_memory_;
34 void* memory_; 34 void* memory_;
35 size_t size_; 35 size_t size_;
36 36
37 DISALLOW_COPY_AND_ASSIGN(Buffer); 37 DISALLOW_COPY_AND_ASSIGN(Buffer);
38 }; 38 };
39 39
40 } // namespace gpu 40 } // namespace gpu
41 41
42 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 42 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | gpu/command_buffer/common/buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698