Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef TESTS_NACL_IO_TEST_FAKE_VAR_MANAGER_H_ | |
| 6 #define TESTS_NACL_IO_TEST_FAKE_VAR_MANAGER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <ppapi/c/pp_var.h> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "sdk_util/macros.h" | |
| 14 | |
| 15 struct FakeVarData { | |
| 16 uint64_t id; | |
| 17 uint64_t type; | |
| 18 int32_t ref_count; | |
| 19 std::string string_value; | |
| 20 std::vector<PP_Var> array_value; | |
| 21 struct { | |
| 22 void* ptr; | |
| 23 uint32_t length; | |
| 24 } buffer_value; | |
| 25 }; | |
| 26 | |
| 27 class FakeVarManager { | |
| 28 public: | |
| 29 FakeVarManager(); | |
| 30 ~FakeVarManager(); | |
| 31 | |
| 32 void AddRef(PP_Var var); | |
| 33 void Release(PP_Var var); | |
| 34 FakeVarData* CreateVarData(); | |
| 35 FakeVarData* GetVarData(PP_Var var); | |
| 36 std::string Describe(const FakeVarData& resource); | |
| 37 | |
| 38 bool debug; | |
| 39 private: | |
| 40 void Destroy(PP_Var var); | |
| 41 typedef uint64_t Id; | |
| 42 | |
| 43 typedef std::map<Id, FakeVarData> VarMap; | |
|
binji
2014/01/17 01:31:14
nit: group typedefs together
Sam Clegg
2014/01/17 22:40:11
Done.
| |
| 44 Id next_id_; | |
| 45 VarMap var_map_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(FakeVarManager); | |
| 48 }; | |
| 49 | |
| 50 #endif // TESTS_NACL_IO_TEST_FAKE_VAR_MANAGER_H_ | |
| OLD | NEW |