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

Side by Side Diff: third_party/WebKit/Source/core/input/InputDeviceCapabilities.cpp

Issue 2675793005: Track constant InputDeviceCapabilities objects per-window. (Closed)
Patch Set: test tidying Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/input/InputDeviceCapabilities.h" 5 #include "core/input/InputDeviceCapabilities.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 InputDeviceCapabilities::InputDeviceCapabilities(bool firesTouchEvents) { 9 InputDeviceCapabilities::InputDeviceCapabilities(bool firesTouchEvents) {
10 m_firesTouchEvents = firesTouchEvents; 10 m_firesTouchEvents = firesTouchEvents;
11 } 11 }
12 12
13 InputDeviceCapabilities::InputDeviceCapabilities( 13 InputDeviceCapabilities::InputDeviceCapabilities(
14 const InputDeviceCapabilitiesInit& initializer) { 14 const InputDeviceCapabilitiesInit& initializer) {
15 m_firesTouchEvents = initializer.firesTouchEvents(); 15 m_firesTouchEvents = initializer.firesTouchEvents();
16 } 16 }
17 17
18 InputDeviceCapabilities* 18 InputDeviceCapabilities* InputDeviceCapabilitiesConstants::firesTouchEvents(
19 InputDeviceCapabilities::firesTouchEventsSourceCapabilities() { 19 bool firesTouch) {
20 DEFINE_STATIC_LOCAL(InputDeviceCapabilities, instance, 20 if (firesTouch) {
21 (InputDeviceCapabilities::create(true))); 21 if (!m_firesTouchEvents)
22 return &instance; 22 m_firesTouchEvents = InputDeviceCapabilities::create(true);
23 } 23 return m_firesTouchEvents;
24 24 }
25 InputDeviceCapabilities* 25 if (!m_doesntFireTouchEvents)
26 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities() { 26 m_doesntFireTouchEvents = InputDeviceCapabilities::create(false);
27 DEFINE_STATIC_LOCAL(InputDeviceCapabilities, instance, 27 return m_doesntFireTouchEvents;
28 (InputDeviceCapabilities::create(false)));
29 return &instance;
30 } 28 }
31 29
32 } // namespace blink 30 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698