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

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

Issue 534133002: [WIP] bindings: Introduce PropertyBag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « Source/core/testing/InternalDictionary.idl ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698