Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "modules/wake_lock/WakeLockPromiseResolver.h" | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptState.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 namespace { | |
| 13 int getNextId() | |
| 14 { | |
| 15 static int id = 0; | |
| 16 return ++id; | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 // static | |
| 21 PassOwnPtr<WakeLockPromiseResolver> WakeLockPromiseResolver::create( | |
| 22 ScriptState* scriptState, WebWakeLockType type) | |
| 23 { | |
| 24 return adoptPtr(new WakeLockPromiseResolver(scriptState, type, getNextId())) ; | |
| 25 } | |
| 26 | |
| 27 WakeLockPromiseResolver::WakeLockPromiseResolver( | |
| 28 ScriptState* scriptState, WebWakeLockType type, int id) | |
| 29 : m_resolver(ScriptPromiseResolver::create(scriptState)) | |
| 30 , m_type(type) | |
| 31 , m_id(id) | |
| 32 { | |
| 33 } | |
| 34 | |
| 35 void WakeLockPromiseResolver::resolve() | |
| 36 { | |
| 37 m_resolver->resolve(0); | |
|
mlamouri (slow - plz ping)
2014/08/18 12:15:53
Maybe you want:
m_resolver->resolve();
redchenko
2014/08/19 16:42:21
Done.
| |
| 38 } | |
| 39 | |
| 40 void WakeLockPromiseResolver::reject() | |
| 41 { | |
| 42 m_resolver->reject(0); | |
|
mlamouri (slow - plz ping)
2014/08/18 12:15:53
and:
m_resolver->reject();
redchenko
2014/08/19 16:42:21
Done.
| |
| 43 } | |
| 44 | |
| 45 ScriptPromise WakeLockPromiseResolver::promise() | |
| 46 { | |
| 47 return m_resolver->promise(); | |
| 48 } | |
| 49 | |
| 50 } // namespace WebCore | |
| OLD | NEW |