| OLD | NEW |
| 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_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ | 6 #define CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 8 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 9 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/shared_impl/host_resource.h" | 13 #include "ppapi/shared_impl/host_resource.h" |
| 11 #include "ppapi/shared_impl/var.h" | 14 #include "ppapi/shared_impl/var.h" |
| 12 #include "third_party/WebKit/public/web/WebArrayBuffer.h" | 15 #include "third_party/WebKit/public/web/WebArrayBuffer.h" |
| 13 | 16 |
| 14 namespace content { | 17 namespace content { |
| 15 | 18 |
| 16 // Represents a host-side ArrayBufferVar. | 19 // Represents a host-side ArrayBufferVar. |
| 17 class HostArrayBufferVar : public ppapi::ArrayBufferVar { | 20 class HostArrayBufferVar : public ppapi::ArrayBufferVar { |
| 18 public: | 21 public: |
| 19 explicit HostArrayBufferVar(uint32 size_in_bytes); | 22 explicit HostArrayBufferVar(uint32_t size_in_bytes); |
| 20 explicit HostArrayBufferVar(const blink::WebArrayBuffer& buffer); | 23 explicit HostArrayBufferVar(const blink::WebArrayBuffer& buffer); |
| 21 explicit HostArrayBufferVar(uint32 size_in_bytes, | 24 explicit HostArrayBufferVar(uint32_t size_in_bytes, |
| 22 base::SharedMemoryHandle handle); | 25 base::SharedMemoryHandle handle); |
| 23 | 26 |
| 24 // ArrayBufferVar implementation. | 27 // ArrayBufferVar implementation. |
| 25 void* Map() override; | 28 void* Map() override; |
| 26 void Unmap() override; | 29 void Unmap() override; |
| 27 uint32 ByteLength() override; | 30 uint32_t ByteLength() override; |
| 28 bool CopyToNewShmem(PP_Instance instance, | 31 bool CopyToNewShmem(PP_Instance instance, |
| 29 int* host_shm_handle_id, | 32 int* host_shm_handle_id, |
| 30 base::SharedMemoryHandle* plugin_shm_handle) override; | 33 base::SharedMemoryHandle* plugin_shm_handle) override; |
| 31 | 34 |
| 32 blink::WebArrayBuffer& webkit_buffer() { return buffer_; } | 35 blink::WebArrayBuffer& webkit_buffer() { return buffer_; } |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 ~HostArrayBufferVar() override; | 38 ~HostArrayBufferVar() override; |
| 36 | 39 |
| 37 blink::WebArrayBuffer buffer_; | 40 blink::WebArrayBuffer buffer_; |
| 38 // Tracks whether the data in the buffer is valid. | 41 // Tracks whether the data in the buffer is valid. |
| 39 bool valid_; | 42 bool valid_; |
| 40 | 43 |
| 41 DISALLOW_COPY_AND_ASSIGN(HostArrayBufferVar); | 44 DISALLOW_COPY_AND_ASSIGN(HostArrayBufferVar); |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 } // namespace content | 47 } // namespace content |
| 45 | 48 |
| 46 #endif // CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ | 49 #endif // CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_ |
| OLD | NEW |