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

Side by Side Diff: Source/modules/webmidi/MIDIAccessInitializer.cpp

Issue 873573005: Oilpan: merge MIDIAccessInitializer's prefinalizers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webmidi/MIDIAccessInitializer.h" 6 #include "modules/webmidi/MIDIAccessInitializer.h"
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMError.h" 10 #include "core/dom/DOMError.h"
11 #include "core/dom/Document.h" 11 #include "core/dom/Document.h"
12 #include "core/frame/Navigator.h" 12 #include "core/frame/Navigator.h"
13 #include "modules/webmidi/MIDIAccess.h" 13 #include "modules/webmidi/MIDIAccess.h"
14 #include "modules/webmidi/MIDIController.h" 14 #include "modules/webmidi/MIDIController.h"
15 #include "modules/webmidi/MIDIOptions.h" 15 #include "modules/webmidi/MIDIOptions.h"
16 #include "modules/webmidi/MIDIPort.h" 16 #include "modules/webmidi/MIDIPort.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 MIDIAccessInitializer::MIDIAccessInitializer(ScriptState* scriptState, const MID IOptions& options) 20 MIDIAccessInitializer::MIDIAccessInitializer(ScriptState* scriptState, const MID IOptions& options)
21 : ScriptPromiseResolver(scriptState) 21 : ScriptPromiseResolver(scriptState)
22 , m_requestSysex(false) 22 , m_requestSysex(false)
23 { 23 {
24 #if ENABLE(OILPAN) 24 #if ENABLE(OILPAN)
25 // A prefinalizer has already been registered (as a LifecycleObserver);
26 // remove it and register a combined one, as the infrastructure doesn't
27 // support multiple prefinalizers for an object.
haraken 2015/01/28 09:53:10 Shall we add a FIXME?
sof 2015/01/28 09:56:42 Can do that, what did you have in mind? i.e., mult
haraken 2015/01/28 10:01:36 Avoid multiple prefinalizers and add an ASSERT abo
sof 2015/01/28 10:56:38 Done.
28 ThreadState::current()->unregisterPreFinalizer(*this);
kouhei (in TOK) 2015/01/28 09:58:04 How about ThreadState::current()->unregisterPreFin
sof 2015/01/28 10:56:38 Done.
25 ThreadState::current()->registerPreFinalizer(*this); 29 ThreadState::current()->registerPreFinalizer(*this);
26 #endif 30 #endif
27 if (options.hasSysex()) 31 if (options.hasSysex())
28 m_requestSysex = options.sysex(); 32 m_requestSysex = options.sysex();
29 } 33 }
30 34
31 MIDIAccessInitializer::~MIDIAccessInitializer() 35 MIDIAccessInitializer::~MIDIAccessInitializer()
32 { 36 {
33 #if !ENABLE(OILPAN) 37 #if !ENABLE(OILPAN)
34 dispose(); 38 dispose();
35 #endif 39 #endif
36 } 40 }
37 41
38 void MIDIAccessInitializer::dispose() 42 void MIDIAccessInitializer::dispose()
39 { 43 {
40 // It is safe to cancel a request which is already finished or cancelled. 44 // It is safe to cancel a request which is already finished or cancelled.
41 Document* document = toDocument(executionContext()); 45 Document* document = toDocument(executionContext());
42 ASSERT(document); 46 ASSERT(document);
43 if (MIDIController* controller = MIDIController::from(document->frame())) 47 if (MIDIController* controller = MIDIController::from(document->frame()))
44 controller->cancelSysexPermissionRequest(this); 48 controller->cancelSysexPermissionRequest(this);
49
50 #if ENABLE(OILPAN)
51 // Delegate to LifecycleObserver's prefinalizer.
52 LifecycleObserver::dispose();
53 #endif
45 } 54 }
46 55
47 ScriptPromise MIDIAccessInitializer::start() 56 ScriptPromise MIDIAccessInitializer::start()
48 { 57 {
49 ScriptPromise promise = this->promise(); 58 ScriptPromise promise = this->promise();
50 m_accessor = MIDIAccessor::create(this); 59 m_accessor = MIDIAccessor::create(this);
51 60
52 if (!m_requestSysex) { 61 if (!m_requestSysex) {
53 m_accessor->startSession(); 62 m_accessor->startSession();
54 return promise; 63 return promise;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 { 120 {
112 return executionContext()->securityOrigin(); 121 return executionContext()->securityOrigin();
113 } 122 }
114 123
115 ExecutionContext* MIDIAccessInitializer::executionContext() const 124 ExecutionContext* MIDIAccessInitializer::executionContext() const
116 { 125 {
117 return scriptState()->executionContext(); 126 return scriptState()->executionContext();
118 } 127 }
119 128
120 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698