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

Side by Side Diff: webkit/plugins/ppapi/ppb_buffer_impl.h

Issue 12702011: Pepper: Unify Buffer and BufferTrusted APIs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comment nits. Created 7 years, 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "ppapi/thunk/ppb_buffer_api.h" 12 #include "ppapi/thunk/ppb_buffer_api.h"
13 #include "ppapi/thunk/ppb_buffer_trusted_api.h" 13 #include "ppapi/thunk/ppb_buffer_trusted_api.h"
yzshen1 2013/03/20 17:08:38 This is not needed. Right?
teravest 2013/03/20 17:12:42 Done.
14 #include "ppapi/shared_impl/resource.h" 14 #include "ppapi/shared_impl/resource.h"
15 #include "webkit/plugins/webkit_plugins_export.h" 15 #include "webkit/plugins/webkit_plugins_export.h"
16 16
17 namespace webkit { 17 namespace webkit {
18 namespace ppapi { 18 namespace ppapi {
19 19
20 class WEBKIT_PLUGINS_EXPORT PPB_Buffer_Impl : 20 class WEBKIT_PLUGINS_EXPORT PPB_Buffer_Impl :
21 public ::ppapi::Resource, 21 public ::ppapi::Resource,
22 public ::ppapi::thunk::PPB_Buffer_API, 22 public ::ppapi::thunk::PPB_Buffer_API {
23 public ::ppapi::thunk::PPB_BufferTrusted_API {
24 public: 23 public:
25 virtual ~PPB_Buffer_Impl(); 24 virtual ~PPB_Buffer_Impl();
26 25
27 static PP_Resource Create(PP_Instance instance, uint32_t size); 26 static PP_Resource Create(PP_Instance instance, uint32_t size);
28 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance, 27 static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance,
29 uint32_t size); 28 uint32_t size);
30 29
31 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl(); 30 virtual PPB_Buffer_Impl* AsPPB_Buffer_Impl();
32 31
33 base::SharedMemory* shared_memory() const { return shared_memory_.get(); } 32 base::SharedMemory* shared_memory() const { return shared_memory_.get(); }
34 uint32_t size() const { return size_; } 33 uint32_t size() const { return size_; }
35 34
36 // Resource overrides. 35 // Resource overrides.
37 virtual ::ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE; 36 virtual ::ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE;
38 virtual ::ppapi::thunk::PPB_BufferTrusted_API* AsPPB_BufferTrusted_API();
39 37
40 // PPB_Buffer_API implementation. 38 // PPB_Buffer_API implementation.
41 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE; 39 virtual PP_Bool Describe(uint32_t* size_in_bytes) OVERRIDE;
42 virtual PP_Bool IsMapped() OVERRIDE; 40 virtual PP_Bool IsMapped() OVERRIDE;
43 virtual void* Map() OVERRIDE; 41 virtual void* Map() OVERRIDE;
44 virtual void Unmap() OVERRIDE; 42 virtual void Unmap() OVERRIDE;
45 43
46 // PPB_BufferTrusted_API implementation. 44 // Trusted.
47 virtual int32_t GetSharedMemory(int* handle) OVERRIDE; 45 virtual int32_t GetSharedMemory(int* handle) OVERRIDE;
48 46
49 private: 47 private:
50 explicit PPB_Buffer_Impl(PP_Instance instance); 48 explicit PPB_Buffer_Impl(PP_Instance instance);
51 bool Init(uint32_t size); 49 bool Init(uint32_t size);
52 50
53 scoped_ptr<base::SharedMemory> shared_memory_; 51 scoped_ptr<base::SharedMemory> shared_memory_;
54 uint32_t size_; 52 uint32_t size_;
55 int map_count_; 53 int map_count_;
56 54
(...skipping 19 matching lines...) Expand all
76 void* data_; 74 void* data_;
77 uint32_t size_; 75 uint32_t size_;
78 76
79 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper); 77 DISALLOW_COPY_AND_ASSIGN(BufferAutoMapper);
80 }; 78 };
81 79
82 } // namespace ppapi 80 } // namespace ppapi
83 } // namespace webkit 81 } // namespace webkit
84 82
85 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_ 83 #endif // WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698