| 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_SHARED_IMPL_TEST_GLOBALS_H_ | 5 #ifndef PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ |
| 6 #define PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ | 6 #define PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" |
| 9 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 10 #include "ppapi/shared_impl/callback_tracker.h" | 13 #include "ppapi/shared_impl/callback_tracker.h" |
| 11 #include "ppapi/shared_impl/ppapi_globals.h" | 14 #include "ppapi/shared_impl/ppapi_globals.h" |
| 12 #include "ppapi/shared_impl/resource_tracker.h" | 15 #include "ppapi/shared_impl/resource_tracker.h" |
| 13 #include "ppapi/shared_impl/var_tracker.h" | 16 #include "ppapi/shared_impl/var_tracker.h" |
| 14 | 17 |
| 15 namespace ppapi { | 18 namespace ppapi { |
| 16 | 19 |
| 17 class TestVarTracker : public VarTracker { | 20 class TestVarTracker : public VarTracker { |
| 18 public: | 21 public: |
| 19 TestVarTracker() : VarTracker(THREAD_SAFE) {} | 22 TestVarTracker() : VarTracker(THREAD_SAFE) {} |
| 20 ~TestVarTracker() override {} | 23 ~TestVarTracker() override {} |
| 21 PP_Var MakeResourcePPVarFromMessage( | 24 PP_Var MakeResourcePPVarFromMessage( |
| 22 PP_Instance instance, | 25 PP_Instance instance, |
| 23 const IPC::Message& creation_message, | 26 const IPC::Message& creation_message, |
| 24 int pending_renderer_id, | 27 int pending_renderer_id, |
| 25 int pending_browser_id) override { | 28 int pending_browser_id) override { |
| 26 return PP_MakeNull(); | 29 return PP_MakeNull(); |
| 27 } | 30 } |
| 28 ResourceVar* MakeResourceVar(PP_Resource pp_resource) override { | 31 ResourceVar* MakeResourceVar(PP_Resource pp_resource) override { |
| 29 return NULL; | 32 return NULL; |
| 30 } | 33 } |
| 31 ArrayBufferVar* CreateArrayBuffer(uint32 size_in_bytes) override { | 34 ArrayBufferVar* CreateArrayBuffer(uint32_t size_in_bytes) override { |
| 32 return NULL; | 35 return NULL; |
| 33 } | 36 } |
| 34 ArrayBufferVar* CreateShmArrayBuffer( | 37 ArrayBufferVar* CreateShmArrayBuffer( |
| 35 uint32 size_in_bytes, | 38 uint32_t size_in_bytes, |
| 36 base::SharedMemoryHandle handle) override { | 39 base::SharedMemoryHandle handle) override { |
| 37 return NULL; | 40 return NULL; |
| 38 } | 41 } |
| 39 void DidDeleteInstance(PP_Instance instance) override {} | 42 void DidDeleteInstance(PP_Instance instance) override {} |
| 40 int TrackSharedMemoryHandle(PP_Instance instance, | 43 int TrackSharedMemoryHandle(PP_Instance instance, |
| 41 base::SharedMemoryHandle handle, | 44 base::SharedMemoryHandle handle, |
| 42 uint32 size_in_bytes) override { | 45 uint32_t size_in_bytes) override { |
| 43 return -1; | 46 return -1; |
| 44 } | 47 } |
| 45 bool StopTrackingSharedMemoryHandle(int id, | 48 bool StopTrackingSharedMemoryHandle(int id, |
| 46 PP_Instance instance, | 49 PP_Instance instance, |
| 47 base::SharedMemoryHandle* handle, | 50 base::SharedMemoryHandle* handle, |
| 48 uint32* size_in_bytes) override { | 51 uint32_t* size_in_bytes) override { |
| 49 return false; | 52 return false; |
| 50 } | 53 } |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 // Implementation of PpapiGlobals for tests that don't need either the host- or | 56 // Implementation of PpapiGlobals for tests that don't need either the host- or |
| 54 // plugin-specific implementations. | 57 // plugin-specific implementations. |
| 55 class TestGlobals : public PpapiGlobals { | 58 class TestGlobals : public PpapiGlobals { |
| 56 public: | 59 public: |
| 57 TestGlobals(); | 60 TestGlobals(); |
| 58 explicit TestGlobals(PpapiGlobals::PerThreadForTest); | 61 explicit TestGlobals(PpapiGlobals::PerThreadForTest); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 ResourceTracker resource_tracker_; | 89 ResourceTracker resource_tracker_; |
| 87 TestVarTracker var_tracker_; | 90 TestVarTracker var_tracker_; |
| 88 scoped_refptr<CallbackTracker> callback_tracker_; | 91 scoped_refptr<CallbackTracker> callback_tracker_; |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(TestGlobals); | 93 DISALLOW_COPY_AND_ASSIGN(TestGlobals); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace ppapi | 96 } // namespace ppapi |
| 94 | 97 |
| 95 #endif // PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ | 98 #endif // PPAPI_SHARED_IMPL_TEST_GLOBALS_H_ |
| OLD | NEW |