| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 clearResolver(); | 144 clearResolver(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) | 147 void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) |
| 148 { | 148 { |
| 149 if (m_resolver) { | 149 if (m_resolver) { |
| 150 ScriptPromiseResolver* resolver = m_resolver; | 150 ScriptPromiseResolver* resolver = m_resolver; |
| 151 ScriptState* scriptState = resolver->scriptState(); | 151 ScriptState* scriptState = resolver->scriptState(); |
| 152 ScriptState::Scope scope(scriptState); | 152 ScriptState::Scope scope(scriptState); |
| 153 | 153 |
| 154 v8::Handle<v8::String> jsonString = v8AtomicString(scriptState->isolate(
), utf8Data, length); | 154 v8::Local<v8::String> jsonString = v8AtomicString(scriptState->isolate()
, utf8Data, length); |
| 155 | 155 |
| 156 v8::TryCatch exceptionCatcher; | 156 v8::TryCatch exceptionCatcher; |
| 157 v8::Local<v8::Value> jsonDictionary; | 157 v8::Local<v8::Value> jsonDictionary; |
| 158 if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDict
ionary, exceptionCatcher)) | 158 if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDict
ionary, exceptionCatcher)) |
| 159 resolver->resolve(jsonDictionary); | 159 resolver->resolve(jsonDictionary); |
| 160 else | 160 else |
| 161 resolver->reject(exceptionCatcher.Exception()); | 161 resolver->reject(exceptionCatcher.Exception()); |
| 162 } | 162 } |
| 163 clearResolver(); | 163 clearResolver(); |
| 164 } | 164 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 m_resolver = Resolver::create(scriptState, this).get(); | 215 m_resolver = Resolver::create(scriptState, this).get(); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 ScriptPromise CryptoResultImpl::promise() | 219 ScriptPromise CryptoResultImpl::promise() |
| 220 { | 220 { |
| 221 return m_resolver ? m_resolver->promise() : ScriptPromise(); | 221 return m_resolver ? m_resolver->promise() : ScriptPromise(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace blink | 224 } // namespace blink |
| OLD | NEW |