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