Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: Source/modules/crypto/CryptoResultImpl.cpp

Issue 1029093003: [WIP] IDL: Add limited serializer support and use for RTCIceCandidate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use V8ObjectBuilder in modules/crypto Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 m_resolver->resolve(CryptoKey::create(key)); 177 m_resolver->resolve(CryptoKey::create(key));
178 clearResolver(); 178 clearResolver();
179 } 179 }
180 180
181 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const WebCryptoKey& privateKey) 181 void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const WebCryptoKey& privateKey)
182 { 182 {
183 if (m_resolver) { 183 if (m_resolver) {
184 ScriptState* scriptState = m_resolver->scriptState(); 184 ScriptState* scriptState = m_resolver->scriptState();
185 ScriptState::Scope scope(scriptState); 185 ScriptState::Scope scope(scriptState);
186 186
187 Dictionary keyPair = Dictionary::createEmpty(scriptState->isolate()); 187 V8ObjectBuilder keyPair(scriptState->isolate());
188 188
189 v8::Handle<v8::Value> publicKeyValue = toV8(CryptoKey::create(publicKey) , scriptState->context()->Global(), scriptState->isolate()); 189 keyPair.add("publicKey", ScriptValue::from(scriptState, CryptoKey::creat e(publicKey)));
190 v8::Handle<v8::Value> privateKeyValue = toV8(CryptoKey::create(privateKe y), scriptState->context()->Global(), scriptState->isolate()); 190 keyPair.add("privateKey", ScriptValue::from(scriptState, CryptoKey::crea te(privateKey)));
191
192 keyPair.set("publicKey", publicKeyValue);
193 keyPair.set("privateKey", privateKeyValue);
194 191
195 m_resolver->resolve(keyPair.v8Value()); 192 m_resolver->resolve(keyPair.v8Value());
196 } 193 }
197 clearResolver(); 194 clearResolver();
198 } 195 }
199 196
200 bool CryptoResultImpl::cancelled() const 197 bool CryptoResultImpl::cancelled() const
201 { 198 {
202 return acquireLoad(&m_cancelled); 199 return acquireLoad(&m_cancelled);
203 } 200 }
(...skipping 15 matching lines...) Expand all
219 m_resolver = Resolver::create(scriptState, this).get(); 216 m_resolver = Resolver::create(scriptState, this).get();
220 } 217 }
221 } 218 }
222 219
223 ScriptPromise CryptoResultImpl::promise() 220 ScriptPromise CryptoResultImpl::promise()
224 { 221 {
225 return m_resolver ? m_resolver->promise() : ScriptPromise(); 222 return m_resolver ? m_resolver->promise() : ScriptPromise();
226 } 223 }
227 224
228 } // namespace blink 225 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698