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

Side by Side Diff: Source/core/frame/PlatformEventDispatcher.cpp

Issue 1329863002: Fix flaky crashes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Early return Created 5 years, 3 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
« 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 "core/frame/PlatformEventDispatcher.h" 6 #include "core/frame/PlatformEventDispatcher.h"
7 7
8 #include "core/frame/PlatformEventController.h" 8 #include "core/frame/PlatformEventController.h"
9 #include "wtf/TemporaryChange.h" 9 #include "wtf/TemporaryChange.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 PlatformEventDispatcher::PlatformEventDispatcher() 13 PlatformEventDispatcher::PlatformEventDispatcher()
14 : m_isDispatching(false) 14 : m_isDispatching(false)
15 , m_isListening(false) 15 , m_isListening(false)
16 { 16 {
17 } 17 }
18 18
19 void PlatformEventDispatcher::addController(PlatformEventController* controller) 19 void PlatformEventDispatcher::addController(PlatformEventController* controller)
20 { 20 {
21 ASSERT(controller); 21 ASSERT(controller);
22 ASSERT(!m_controllers.contains(controller)); 22 // TODO: If we can avoid to register a same controller twice, we can change
23 // this 'if' to ASSERT.
24 if (m_controllers.contains(controller))
25 return;
23 26
24 m_controllers.add(controller); 27 m_controllers.add(controller);
28
25 if (!m_isListening) { 29 if (!m_isListening) {
26 startListening(); 30 startListening();
27 m_isListening = true; 31 m_isListening = true;
28 } 32 }
29 } 33 }
30 34
31 void PlatformEventDispatcher::removeController(PlatformEventController* controll er) 35 void PlatformEventDispatcher::removeController(PlatformEventController* controll er)
32 { 36 {
33 ASSERT(m_controllers.contains(controller)); 37 ASSERT(m_controllers.contains(controller));
34 38
(...skipping 28 matching lines...) Expand all
63 } 67 }
64 68
65 DEFINE_TRACE(PlatformEventDispatcher) 69 DEFINE_TRACE(PlatformEventDispatcher)
66 { 70 {
67 #if ENABLE(OILPAN) 71 #if ENABLE(OILPAN)
68 visitor->trace(m_controllers); 72 visitor->trace(m_controllers);
69 #endif 73 #endif
70 } 74 }
71 75
72 } // namespace blink 76 } // 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