OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 LIBRARIES_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ | 5 #ifndef TESTS_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ |
6 #define LIBRARIES_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ | 6 #define TESTS_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | 7 |
11 #include <ppapi/c/pp_var.h> | 8 #include <ppapi/c/pp_var.h> |
12 | 9 |
13 #include "nacl_io/pepper_interface.h" | 10 #include "nacl_io/pepper_interface.h" |
14 #include "sdk_util/macros.h" | 11 #include "sdk_util/macros.h" |
15 | 12 |
13 class FakeVarManager; | |
14 | |
16 class FakeVarInterface : public nacl_io::VarInterface { | 15 class FakeVarInterface : public nacl_io::VarInterface { |
17 public: | 16 public: |
18 FakeVarInterface(); | 17 FakeVarInterface(FakeVarManager* manager); |
binji
2014/01/17 01:31:14
explicit
Sam Clegg
2014/01/17 22:40:11
Done.
| |
19 ~FakeVarInterface(); | |
20 | 18 |
21 virtual void AddRef(PP_Var var); | 19 virtual void AddRef(PP_Var var); |
22 virtual void Release(PP_Var var); | 20 virtual void Release(PP_Var var); |
23 virtual PP_Var VarFromUtf8(const char* data, uint32_t len); | 21 virtual PP_Var VarFromUtf8(const char* data, uint32_t len); |
24 virtual const char* VarToUtf8(PP_Var var, uint32_t* out_len); | 22 virtual const char* VarToUtf8(PP_Var var, uint32_t* out_len); |
25 | 23 |
26 private: | 24 private: |
27 typedef uint64_t Id; | 25 FakeVarManager* manager_; |
binji
2014/01/17 01:31:14
DISALLOW_COPY_AND_ASSIGN?
Sam Clegg
2014/01/17 22:40:11
Done.
| |
28 | |
29 struct FakeStringVar { | |
30 std::string value; | |
31 int32_t ref_count; | |
32 }; | |
33 | |
34 typedef std::map<Id, FakeStringVar> VarMap; | |
35 Id next_id_; | |
36 VarMap var_map_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(FakeVarInterface); | |
39 }; | 26 }; |
40 | 27 |
41 #endif // LIBRARIES_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ | 28 #endif // TESTS_NACL_IO_TEST_FAKE_VAR_INTERFACE_H_ |
OLD | NEW |