| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (m_resolver) | 151 if (m_resolver) |
| 152 m_resolver->resolve(CryptoKey::create(key)); | 152 m_resolver->resolve(CryptoKey::create(key)); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const
WebCryptoKey& privateKey) | 155 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const
WebCryptoKey& privateKey) |
| 156 { | 156 { |
| 157 if (m_resolver) { | 157 if (m_resolver) { |
| 158 ScriptState* scriptState = m_resolver->scriptState(); | 158 ScriptState* scriptState = m_resolver->scriptState(); |
| 159 ScriptState::Scope scope(scriptState); | 159 ScriptState::Scope scope(scriptState); |
| 160 | 160 |
| 161 #ifdef REMOVE_DIC |
| 162 Dictionary keyPair(v8::Object::New(scriptState->isolate()), scriptState-
>isolate()); |
| 163 #else |
| 161 Dictionary keyPair = Dictionary::createEmpty(scriptState->isolate()); | 164 Dictionary keyPair = Dictionary::createEmpty(scriptState->isolate()); |
| 165 #endif |
| 162 | 166 |
| 163 v8::Handle<v8::Value> publicKeyValue = toV8NoInline(CryptoKey::create(pu
blicKey), scriptState->context()->Global(), scriptState->isolate()); | 167 v8::Handle<v8::Value> publicKeyValue = toV8NoInline(CryptoKey::create(pu
blicKey), scriptState->context()->Global(), scriptState->isolate()); |
| 164 v8::Handle<v8::Value> privateKeyValue = toV8NoInline(CryptoKey::create(p
rivateKey), scriptState->context()->Global(), scriptState->isolate()); | 168 v8::Handle<v8::Value> privateKeyValue = toV8NoInline(CryptoKey::create(p
rivateKey), scriptState->context()->Global(), scriptState->isolate()); |
| 165 | 169 |
| 166 keyPair.set("publicKey", publicKeyValue); | 170 keyPair.set("publicKey", publicKeyValue); |
| 167 keyPair.set("privateKey", privateKeyValue); | 171 keyPair.set("privateKey", privateKeyValue); |
| 168 | 172 |
| 169 m_resolver->resolve(keyPair.v8Value()); | 173 m_resolver->resolve(keyPair.v8Value()); |
| 170 } | 174 } |
| 171 } | 175 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 187 // been stopped. And in the process set m_cancelled to 1. | 191 // been stopped. And in the process set m_cancelled to 1. |
| 188 m_resolver = WeakResolver::create(scriptState, this); | 192 m_resolver = WeakResolver::create(scriptState, this); |
| 189 } | 193 } |
| 190 | 194 |
| 191 ScriptPromise CryptoResultImpl::promise() | 195 ScriptPromise CryptoResultImpl::promise() |
| 192 { | 196 { |
| 193 return m_resolver ? m_resolver->promise() : ScriptPromise(); | 197 return m_resolver ? m_resolver->promise() : ScriptPromise(); |
| 194 } | 198 } |
| 195 | 199 |
| 196 } // namespace blink | 200 } // namespace blink |
| OLD | NEW |