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

Unified Diff: Source/core/css/FontFaceSet.cpp

Issue 273683006: ScriptPromise should understand the ScriptState from which the ScriptPromise is generated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/FontFaceSet.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/FontFaceSet.cpp
diff --git a/Source/core/css/FontFaceSet.cpp b/Source/core/css/FontFaceSet.cpp
index 035a49baa311464a7aeb57552d132b422cb09264..8621037478094c8a7dbb8cec7cca5d5546a044b2 100644
--- a/Source/core/css/FontFaceSet.cpp
+++ b/Source/core/css/FontFaceSet.cpp
@@ -115,9 +115,9 @@ void LoadFontPromiseResolver::trace(Visitor* visitor)
class FontsReadyPromiseResolver {
public:
- static PassOwnPtr<FontsReadyPromiseResolver> create(ExecutionContext* context)
+ static PassOwnPtr<FontsReadyPromiseResolver> create(ScriptState* scriptState)
{
- return adoptPtr(new FontsReadyPromiseResolver(context));
+ return adoptPtr(new FontsReadyPromiseResolver(scriptState));
}
void resolve(PassRefPtrWillBeRawPtr<FontFaceSet> fontFaceSet)
@@ -128,8 +128,8 @@ public:
ScriptPromise promise() { return m_resolver->promise(); }
private:
- FontsReadyPromiseResolver(ExecutionContext* context)
- : m_resolver(ScriptPromiseResolverWithContext::create(ScriptState::current(toIsolate(context))))
+ explicit FontsReadyPromiseResolver(ScriptState* scriptState)
+ : m_resolver(ScriptPromiseResolverWithContext::create(scriptState))
{
}
@@ -267,11 +267,11 @@ void FontFaceSet::removeFromLoadingFonts(PassRefPtrWillBeRawPtr<FontFace> fontFa
handlePendingEventsAndPromisesSoon();
}
-ScriptPromise FontFaceSet::ready()
+ScriptPromise FontFaceSet::ready(ScriptState* scriptState)
{
if (!inActiveDocumentContext())
return ScriptPromise();
- OwnPtr<FontsReadyPromiseResolver> resolver = FontsReadyPromiseResolver::create(executionContext());
+ OwnPtr<FontsReadyPromiseResolver> resolver = FontsReadyPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
m_readyResolvers.append(resolver.release());
handlePendingEventsAndPromisesSoon();
@@ -436,14 +436,14 @@ static const String& nullToSpace(const String& s)
return s.isNull() ? space : s;
}
-ScriptPromise FontFaceSet::load(const String& fontString, const String& text)
+ScriptPromise FontFaceSet::load(ScriptState* scriptState, const String& fontString, const String& text)
{
if (!inActiveDocumentContext())
return ScriptPromise();
Font font;
if (!resolveFontStyle(fontString, font)) {
- RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(executionContext());
+ RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
resolver->reject(DOMError::create(SyntaxError, "Could not resolve '" + fontString + "' as a font."));
return promise;
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/FontFaceSet.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698