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

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

Issue 2552993002: Rename activeDOMObjectsAreStopped to isContextDestroyed (Closed)
Patch Set: Created 4 years 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "public/platform/Platform.h" 46 #include "public/platform/Platform.h"
47 #include "public/platform/WebCryptoAlgorithm.h" 47 #include "public/platform/WebCryptoAlgorithm.h"
48 #include "wtf/Atomics.h" 48 #include "wtf/Atomics.h"
49 49
50 namespace blink { 50 namespace blink {
51 51
52 static void rejectWithTypeError(const String& errorDetails, 52 static void rejectWithTypeError(const String& errorDetails,
53 ScriptPromiseResolver* resolver) { 53 ScriptPromiseResolver* resolver) {
54 // Duplicate some of the checks done by ScriptPromiseResolver. 54 // Duplicate some of the checks done by ScriptPromiseResolver.
55 if (!resolver->getExecutionContext() || 55 if (!resolver->getExecutionContext() ||
56 resolver->getExecutionContext()->activeDOMObjectsAreStopped()) 56 resolver->getExecutionContext()->isContextDestroyed())
57 return; 57 return;
58 58
59 ScriptState::Scope scope(resolver->getScriptState()); 59 ScriptState::Scope scope(resolver->getScriptState());
60 v8::Isolate* isolate = resolver->getScriptState()->isolate(); 60 v8::Isolate* isolate = resolver->getScriptState()->isolate();
61 resolver->reject(v8::Exception::TypeError(v8String(isolate, errorDetails))); 61 resolver->reject(v8::Exception::TypeError(v8String(isolate, errorDetails)));
62 } 62 }
63 63
64 class CryptoResultImpl::Resolver final : public ScriptPromiseResolver { 64 class CryptoResultImpl::Resolver final : public ScriptPromiseResolver {
65 public: 65 public:
66 static Resolver* create(ScriptState* scriptState, CryptoResultImpl* result) { 66 static Resolver* create(ScriptState* scriptState, CryptoResultImpl* result) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 ASSERT_NOT_REACHED(); 118 ASSERT_NOT_REACHED();
119 return 0; 119 return 0;
120 } 120 }
121 121
122 CryptoResultImpl::CryptoResultImpl(ScriptState* scriptState) 122 CryptoResultImpl::CryptoResultImpl(ScriptState* scriptState)
123 : m_resolver(Resolver::create(scriptState, this)), 123 : m_resolver(Resolver::create(scriptState, this)),
124 m_cancel(ResultCancel::create()) { 124 m_cancel(ResultCancel::create()) {
125 // Sync cancellation state. 125 // Sync cancellation state.
126 if (scriptState->getExecutionContext()->activeDOMObjectsAreStopped()) 126 if (scriptState->getExecutionContext()->isContextDestroyed())
127 m_cancel->cancel(); 127 m_cancel->cancel();
128 } 128 }
129 129
130 CryptoResultImpl::~CryptoResultImpl() { 130 CryptoResultImpl::~CryptoResultImpl() {
131 ASSERT(!m_resolver); 131 ASSERT(!m_resolver);
132 } 132 }
133 133
134 DEFINE_TRACE(CryptoResultImpl) { 134 DEFINE_TRACE(CryptoResultImpl) {
135 visitor->trace(m_resolver); 135 visitor->trace(m_resolver);
136 CryptoResult::trace(visitor); 136 CryptoResult::trace(visitor);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 m_cancel->cancel(); 229 m_cancel->cancel();
230 m_cancel.clear(); 230 m_cancel.clear();
231 clearResolver(); 231 clearResolver();
232 } 232 }
233 233
234 ScriptPromise CryptoResultImpl::promise() { 234 ScriptPromise CryptoResultImpl::promise() {
235 return m_resolver ? m_resolver->promise() : ScriptPromise(); 235 return m_resolver ? m_resolver->promise() : ScriptPromise();
236 } 236 }
237 237
238 } // namespace blink 238 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698