OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ | 5 #ifndef PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ |
6 #define PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ | 6 #define PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "ppapi/shared_impl/ppapi_shared_export.h" | 11 #include "ppapi/shared_impl/ppapi_shared_export.h" |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 | 14 |
15 class PPAPI_SHARED_EXPORT VpnProviderSharedBuffer { | 15 class PPAPI_SHARED_EXPORT VpnProviderSharedBuffer { |
16 public: | 16 public: |
17 VpnProviderSharedBuffer(uint32_t capacity, | 17 VpnProviderSharedBuffer(uint32_t capacity, |
18 uint32_t packet_size, | 18 uint32_t packet_size, |
19 std::unique_ptr<base::SharedMemory> shm); | 19 std::unique_ptr<base::SharedMemory> shm); |
20 ~VpnProviderSharedBuffer(); | 20 ~VpnProviderSharedBuffer(); |
21 | 21 |
22 bool GetAvailable(uint32_t* id); | 22 bool GetAvailable(uint32_t* id); |
23 void SetAvailable(uint32_t id, bool value); | 23 void SetAvailable(uint32_t id, bool value); |
24 void* GetBuffer(uint32_t id); | 24 void* GetBuffer(uint32_t id); |
25 base::SharedMemoryHandle GetHandle(); | 25 base::SharedMemoryHandle GetHandle(); |
26 uint32_t max_packet_size() { return max_packet_size_; } | |
27 | 26 |
28 private: | 27 private: |
29 uint32_t capacity_; | 28 uint32_t capacity_; |
30 uint32_t max_packet_size_; | 29 uint32_t packet_size_; |
31 std::unique_ptr<base::SharedMemory> shm_; | 30 std::unique_ptr<base::SharedMemory> shm_; |
32 std::vector<bool> available_; | 31 std::vector<bool> available_; |
33 | |
34 DISALLOW_COPY_AND_ASSIGN(VpnProviderSharedBuffer); | |
35 }; | 32 }; |
36 | 33 |
37 } // namespace ppapi | 34 } // namespace ppapi |
38 | 35 |
39 #endif // PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ | 36 #endif // PPAPI_SHAERD_IMPL_VPN_PROVIDER_UTIL_H_ |
OLD | NEW |