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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 m_resolver->resolve(CryptoKey::create(key)); | 175 m_resolver->resolve(CryptoKey::create(key)); |
176 clearResolver(); | 176 clearResolver(); |
177 } | 177 } |
178 | 178 |
179 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const
WebCryptoKey& privateKey) | 179 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const
WebCryptoKey& privateKey) |
180 { | 180 { |
181 if (m_resolver) { | 181 if (m_resolver) { |
182 ScriptState* scriptState = m_resolver->scriptState(); | 182 ScriptState* scriptState = m_resolver->scriptState(); |
183 ScriptState::Scope scope(scriptState); | 183 ScriptState::Scope scope(scriptState); |
184 | 184 |
185 Dictionary keyPair = Dictionary::createEmpty(scriptState->isolate()); | 185 V8ObjectBuilder keyPair(scriptState->isolate()); |
186 | 186 |
187 v8::Handle<v8::Value> publicKeyValue = toV8(CryptoKey::create(publicKey)
, scriptState->context()->Global(), scriptState->isolate()); | 187 keyPair.add("publicKey", ScriptValue::from(scriptState, CryptoKey::creat
e(publicKey))); |
188 v8::Handle<v8::Value> privateKeyValue = toV8(CryptoKey::create(privateKe
y), scriptState->context()->Global(), scriptState->isolate()); | 188 keyPair.add("privateKey", ScriptValue::from(scriptState, CryptoKey::crea
te(privateKey))); |
189 | |
190 keyPair.set("publicKey", publicKeyValue); | |
191 keyPair.set("privateKey", privateKeyValue); | |
192 | 189 |
193 m_resolver->resolve(keyPair.v8Value()); | 190 m_resolver->resolve(keyPair.v8Value()); |
194 } | 191 } |
195 clearResolver(); | 192 clearResolver(); |
196 } | 193 } |
197 | 194 |
198 bool CryptoResultImpl::cancelled() const | 195 bool CryptoResultImpl::cancelled() const |
199 { | 196 { |
200 return acquireLoad(&m_cancelled); | 197 return acquireLoad(&m_cancelled); |
201 } | 198 } |
(...skipping 15 matching lines...) Expand all Loading... |
217 m_resolver = Resolver::create(scriptState, this).get(); | 214 m_resolver = Resolver::create(scriptState, this).get(); |
218 } | 215 } |
219 } | 216 } |
220 | 217 |
221 ScriptPromise CryptoResultImpl::promise() | 218 ScriptPromise CryptoResultImpl::promise() |
222 { | 219 { |
223 return m_resolver ? m_resolver->promise() : ScriptPromise(); | 220 return m_resolver ? m_resolver->promise() : ScriptPromise(); |
224 } | 221 } |
225 | 222 |
226 } // namespace blink | 223 } // namespace blink |
OLD | NEW |