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

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

Issue 1228373006: Reliably cancel in-progress CryptoResult(Impl) upon shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize stopped crypto result as cancelled Created 5 years, 4 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
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.cpp ('k') | Source/platform/CryptoResult.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits, result.get())) 388 if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits, result.get()))
389 return promise; 389 return promise;
390 390
391 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey ->key()); 391 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey ->key());
392 Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthB its, result->result()); 392 Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthB its, result->result());
393 return promise; 393 return promise;
394 } 394 }
395 395
396 ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmI dentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDeriv edKeyType, bool extractable, const Vector<String>& rawKeyUsages) 396 ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmI dentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDeriv edKeyType, bool extractable, const Vector<String>& rawKeyUsages)
397 { 397 {
398 RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState); 398 RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scrip tState);
399 ScriptPromise promise = result->promise(); 399 ScriptPromise promise = result->promise();
400 400
401 if (!canAccessWebCrypto(scriptState, result.get())) 401 if (!canAccessWebCrypto(scriptState, result.get()))
402 return promise; 402 return promise;
403 403
404 WebCryptoKeyUsageMask keyUsages; 404 WebCryptoKeyUsageMask keyUsages;
405 if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get())) 405 if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
406 return promise; 406 return promise;
407 407
408 WebCryptoAlgorithm algorithm; 408 WebCryptoAlgorithm algorithm;
(...skipping 11 matching lines...) Expand all
420 if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLe ngthAlgorithm, result.get())) 420 if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLe ngthAlgorithm, result.get()))
421 return promise; 421 return promise;
422 422
423 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey ->key()); 423 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey ->key());
424 histogramAlgorithm(scriptState->executionContext(), importAlgorithm); 424 histogramAlgorithm(scriptState->executionContext(), importAlgorithm);
425 Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAl gorithm, keyLengthAlgorithm, extractable, keyUsages, result->result()); 425 Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAl gorithm, keyLengthAlgorithm, extractable, keyUsages, result->result());
426 return promise; 426 return promise;
427 } 427 }
428 428
429 } // namespace blink 429 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.cpp ('k') | Source/platform/CryptoResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698