| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/pepper/pepper_try_catch.h" | 5 #include "content/renderer/pepper/pepper_try_catch.h" |
| 6 | 6 |
| 7 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 7 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 8 #include "gin/converter.h" | 8 #include "gin/converter.h" |
| 9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
| 10 #include "ppapi/shared_impl/var_tracker.h" | 10 #include "ppapi/shared_impl/var_tracker.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 exception_ = PP_MakeUndefined(); | 102 exception_ = PP_MakeUndefined(); |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void PepperTryCatchV8::ThrowException(const char* message) { | 106 void PepperTryCatchV8::ThrowException(const char* message) { |
| 107 SetException(message); | 107 SetException(message); |
| 108 ThrowException(); | 108 ThrowException(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void PepperTryCatchV8::SetException(const char* message) { | 111 void PepperTryCatchV8::SetException(const char* message) { |
| 112 if (HasException()) { | 112 if (HasException()) |
| 113 NOTREACHED(); | |
| 114 return; | 113 return; |
| 115 } | 114 |
| 116 exception_ = ppapi::StringVar::StringToPPVar(message); | 115 exception_ = ppapi::StringVar::StringToPPVar(message); |
| 117 } | 116 } |
| 118 | 117 |
| 119 PepperTryCatchVar::PepperTryCatchVar(PepperPluginInstanceImpl* instance, | 118 PepperTryCatchVar::PepperTryCatchVar(PepperPluginInstanceImpl* instance, |
| 120 PP_Var* exception) | 119 PP_Var* exception) |
| 121 : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), | 120 : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), |
| 122 handle_scope_(instance_->GetIsolate()), | 121 handle_scope_(instance_->GetIsolate()), |
| 123 exception_(exception), | 122 exception_(exception), |
| 124 exception_is_set_(false) { | 123 exception_is_set_(false) { |
| 125 // We switch to the plugin context. | 124 // We switch to the plugin context. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 149 if (!exception_message.empty()) { | 148 if (!exception_message.empty()) { |
| 150 exception_is_set_ = true; | 149 exception_is_set_ = true; |
| 151 if (exception_) | 150 if (exception_) |
| 152 *exception_ = ppapi::StringVar::StringToPPVar(exception_message); | 151 *exception_ = ppapi::StringVar::StringToPPVar(exception_message); |
| 153 } | 152 } |
| 154 | 153 |
| 155 return exception_is_set_; | 154 return exception_is_set_; |
| 156 } | 155 } |
| 157 | 156 |
| 158 void PepperTryCatchVar::SetException(const char* message) { | 157 void PepperTryCatchVar::SetException(const char* message) { |
| 159 if (exception_is_set_) { | 158 if (exception_is_set_) |
| 160 NOTREACHED(); | |
| 161 return; | 159 return; |
| 162 } | 160 |
| 163 if (exception_) | 161 if (exception_) |
| 164 *exception_ = ppapi::StringVar::StringToPPVar(message, strlen(message)); | 162 *exception_ = ppapi::StringVar::StringToPPVar(message, strlen(message)); |
| 165 exception_is_set_ = true; | 163 exception_is_set_ = true; |
| 166 } | 164 } |
| 167 | 165 |
| 168 } // namespace content | 166 } // namespace content |
| OLD | NEW |