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 #include "ppapi/shared_impl/test_globals.h" | 5 #include "ppapi/shared_impl/test_globals.h" |
6 | 6 |
7 namespace ppapi { | 7 namespace ppapi { |
8 | 8 |
9 TestGlobals::TestGlobals() | 9 TestGlobals::TestGlobals() |
10 : ppapi::PpapiGlobals(), | 10 : ppapi::PpapiGlobals(), |
11 resource_tracker_(ResourceTracker::THREAD_SAFE), | 11 resource_tracker_(ResourceTracker::THREAD_SAFE), |
12 callback_tracker_(new CallbackTracker) { | 12 callback_tracker_(new CallbackTracker) {} |
13 } | |
14 | 13 |
15 TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test) | 14 TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test) |
16 : ppapi::PpapiGlobals(per_thread_for_test), | 15 : ppapi::PpapiGlobals(per_thread_for_test), |
17 resource_tracker_(ResourceTracker::THREAD_SAFE), | 16 resource_tracker_(ResourceTracker::THREAD_SAFE), |
18 callback_tracker_(new CallbackTracker) { | 17 callback_tracker_(new CallbackTracker) {} |
19 } | |
20 | 18 |
21 TestGlobals::~TestGlobals() { | 19 TestGlobals::~TestGlobals() {} |
22 } | |
23 | 20 |
24 ResourceTracker* TestGlobals::GetResourceTracker() { | 21 ResourceTracker* TestGlobals::GetResourceTracker() { |
25 return &resource_tracker_; | 22 return &resource_tracker_; |
26 } | 23 } |
27 | 24 |
28 VarTracker* TestGlobals::GetVarTracker() { | 25 VarTracker* TestGlobals::GetVarTracker() { return &var_tracker_; } |
29 return &var_tracker_; | |
30 } | |
31 | 26 |
32 CallbackTracker* TestGlobals::GetCallbackTrackerForInstance( | 27 CallbackTracker* TestGlobals::GetCallbackTrackerForInstance( |
33 PP_Instance instance) { | 28 PP_Instance instance) { |
34 return callback_tracker_.get(); | 29 return callback_tracker_.get(); |
35 } | 30 } |
36 | 31 |
37 thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI( | 32 thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(PP_Instance instance) { |
38 PP_Instance instance) { | |
39 return NULL; | 33 return NULL; |
40 } | 34 } |
41 | 35 |
42 thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI( | 36 thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI( |
43 PP_Instance instance) { | 37 PP_Instance instance) { |
44 return NULL; | 38 return NULL; |
45 } | 39 } |
46 | 40 |
47 PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { | 41 PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { return 0; } |
48 return 0; | |
49 } | |
50 | 42 |
51 std::string TestGlobals::GetCmdLine() { | 43 std::string TestGlobals::GetCmdLine() { return std::string(); } |
52 return std::string(); | |
53 } | |
54 | 44 |
55 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) { | 45 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {} |
56 } | |
57 | 46 |
58 void TestGlobals::LogWithSource(PP_Instance instance, | 47 void TestGlobals::LogWithSource(PP_Instance instance, |
59 PP_LogLevel level, | 48 PP_LogLevel level, |
60 const std::string& source, | 49 const std::string& source, |
61 const std::string& value) { | 50 const std::string& value) {} |
62 } | |
63 | 51 |
64 void TestGlobals::BroadcastLogWithSource(PP_Module module, | 52 void TestGlobals::BroadcastLogWithSource(PP_Module module, |
65 PP_LogLevel level, | 53 PP_LogLevel level, |
66 const std::string& source, | 54 const std::string& source, |
67 const std::string& value) { | 55 const std::string& value) {} |
68 } | |
69 | 56 |
70 MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { | 57 MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { return NULL; } |
71 return NULL; | |
72 } | |
73 | 58 |
74 base::TaskRunner* TestGlobals::GetFileTaskRunner() { | 59 base::TaskRunner* TestGlobals::GetFileTaskRunner() { return NULL; } |
75 return NULL; | |
76 } | |
77 | 60 |
78 bool TestGlobals::IsHostGlobals() const { | 61 bool TestGlobals::IsHostGlobals() const { |
79 // Pretend to be the host-side, for code that expects one or the other. | 62 // Pretend to be the host-side, for code that expects one or the other. |
80 // TODO(dmichael): just make it settable which one we're pretending to be? | 63 // TODO(dmichael): just make it settable which one we're pretending to be? |
81 return true; | 64 return true; |
82 } | 65 } |
83 | 66 |
84 } // namespace ppapi | 67 } // namespace ppapi |
OLD | NEW |