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

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

Issue 783423003: Make ScriptPromiseResolver RefCountedWillBeRefCountedGarbageCollected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/ServiceWorkerClient.h" 6 #include "modules/serviceworkers/ServiceWorkerClient.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (exceptionState.hadException()) 64 if (exceptionState.hadException())
65 return; 65 return;
66 66
67 WebString messageString = message->toWireString(); 67 WebString messageString = message->toWireString();
68 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo rtChannelArray(channels.release()); 68 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo rtChannelArray(channels.release());
69 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_id, mes sageString, webChannels.release()); 69 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_id, mes sageString, webChannels.release());
70 } 70 }
71 71
72 ScriptPromise ServiceWorkerClient::focus(ScriptState* scriptState) 72 ScriptPromise ServiceWorkerClient::focus(ScriptState* scriptState)
73 { 73 {
74 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 74 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
75 ScriptPromise promise = resolver->promise(); 75 ScriptPromise promise = resolver->promise();
76 76
77 if (!scriptState->executionContext()->isWindowFocusAllowed()) { 77 if (!scriptState->executionContext()->isWindowFocusAllowed()) {
78 resolver->resolve(false); 78 resolver->resolve(false);
79 return promise; 79 return promise;
80 } 80 }
81 scriptState->executionContext()->consumeWindowFocus(); 81 scriptState->executionContext()->consumeWindowFocus();
82 82
83 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->focus (m_id, new CallbackPromiseAdapter<bool, ServiceWorkerError>(resolver)); 83 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->focus (m_id, new CallbackPromiseAdapter<bool, ServiceWorkerError>(resolver));
84 return promise; 84 return promise;
85 } 85 }
86 86
87 } // namespace blink 87 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698