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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 247263010: ServiceWorker: Wait for registration promise to resolve before changing states. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: yhirano comments Created 6 years, 8 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 | Annotate | Revision Log
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return promise; 92 return promise;
93 } 93 }
94 94
95 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorker, ServiceWorkerError>(resolver)); 95 m_provider->registerServiceWorker(patternURL, scriptURL, new CallbackPromise Adapter<ServiceWorker, ServiceWorkerError>(resolver));
96 return promise; 96 return promise;
97 } 97 }
98 98
99 class UndefinedValue { 99 class UndefinedValue {
100 public: 100 public:
101 typedef WebServiceWorker WebType; 101 typedef WebServiceWorker WebType;
102 static v8::Handle<v8::Value> from(NewScriptState* scriptState, WebServiceWor ker* worker) 102 static V8UndefinedType from(ScriptPromiseResolverWithContext* resolver, WebS erviceWorker* worker)
103 { 103 {
104 ASSERT(!worker); // Anything passed here will be leaked. 104 ASSERT(!worker); // Anything passed here will be leaked.
105 return v8::Undefined(scriptState->isolate()); 105 return V8UndefinedType();
106 } 106 }
107 107
108 private: 108 private:
109 UndefinedValue(); 109 UndefinedValue();
110 }; 110 };
111 111
112 ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ExecutionContext* executionContext, const String& pattern) 112 ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ExecutionContext* executionContext, const String& pattern)
113 { 113 {
114 ASSERT(RuntimeEnabledFeatures::serviceWorkerEnabled()); 114 ASSERT(RuntimeEnabledFeatures::serviceWorkerEnabled());
115 RefPtr<ScriptPromiseResolverWithContext> resolver = ScriptPromiseResolverWit hContext::create(NewScriptState::current(toIsolate(executionContext))); 115 RefPtr<ScriptPromiseResolverWithContext> resolver = ScriptPromiseResolverWit hContext::create(NewScriptState::current(toIsolate(executionContext)));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return; 148 return;
149 149
150 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) { 150 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro m(executionContext)) {
151 m_provider = client->provider(); 151 m_provider = client->provider();
152 if (m_provider) 152 if (m_provider)
153 m_provider->setClient(this); 153 m_provider->setClient(this);
154 } 154 }
155 } 155 }
156 156
157 } // namespace WebCore 157 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698