OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/thunk/enter.h" | 5 #include "ppapi/thunk/enter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } else { | 97 } else { |
98 message = base::StringPrintf( | 98 message = base::StringPrintf( |
99 "0x%X is not a valid resource ID.", | 99 "0x%X is not a valid resource ID.", |
100 pp_resource); | 100 pp_resource); |
101 } | 101 } |
102 PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR, | 102 PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR, |
103 std::string(), message); | 103 std::string(), message); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
| 107 void EnterBase::SetStateForFunctionError(PP_Instance pp_instance, |
| 108 void* object, |
| 109 bool report_error) { |
| 110 if (object) |
| 111 return; // Everything worked. |
| 112 |
| 113 retval_ = PP_ERROR_BADARGUMENT; |
| 114 |
| 115 // We choose to silently ignore the error when the pp_instance is null as |
| 116 // for PP_Resources above. |
| 117 if (report_error && pp_instance) { |
| 118 std::string message; |
| 119 message = base::StringPrintf( |
| 120 "0x%X is not a valid instance ID.", |
| 121 pp_instance); |
| 122 PpapiGlobals::Get()->BroadcastLogWithSource(0, PP_LOGLEVEL_ERROR, |
| 123 std::string(), message); |
| 124 } |
| 125 } |
| 126 |
107 } // namespace subtle | 127 } // namespace subtle |
108 | 128 |
109 EnterResourceCreation::EnterResourceCreation(PP_Instance instance) | 129 EnterResourceCreation::EnterResourceCreation(PP_Instance instance) |
110 : EnterFunctionNoLock<ResourceCreationAPI>(instance, true) { | 130 : EnterFunctionNoLock<ResourceCreationAPI>(instance, true) { |
111 } | 131 } |
112 | 132 |
113 EnterResourceCreation::~EnterResourceCreation() { | 133 EnterResourceCreation::~EnterResourceCreation() { |
114 } | 134 } |
115 | 135 |
116 EnterInstance::EnterInstance(PP_Instance instance) | 136 EnterInstance::EnterInstance(PP_Instance instance) |
117 : EnterFunctionNoLock<PPB_Instance_FunctionAPI>(instance, true) { | 137 : EnterFunction<PPB_Instance_FunctionAPI>(instance, true) { |
| 138 } |
| 139 |
| 140 EnterInstance::EnterInstance(PP_Instance instance, |
| 141 const PP_CompletionCallback& callback) |
| 142 : EnterFunction<PPB_Instance_FunctionAPI>(instance, callback, true) { |
118 } | 143 } |
119 | 144 |
120 EnterInstance::~EnterInstance() { | 145 EnterInstance::~EnterInstance() { |
121 } | 146 } |
122 | 147 |
123 } // namespace thunk | 148 } // namespace thunk |
124 } // namespace ppapi | 149 } // namespace ppapi |
OLD | NEW |