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

Side by Side Diff: Source/WebCore/dom/DeviceOrientationController.cpp

Issue 6476007: Merge 77418 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 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
« no previous file with comments | « Source/WebCore/dom/DeviceOrientationController.h ('k') | 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 /* 1 /*
2 * Copyright 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer) 49 void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer)
50 { 50 {
51 ASSERT_UNUSED(timer, timer == &m_timer); 51 ASSERT_UNUSED(timer, timer == &m_timer);
52 ASSERT(m_client->lastOrientation()); 52 ASSERT(m_client->lastOrientation());
53 53
54 RefPtr<DeviceOrientation> orientation = m_client->lastOrientation(); 54 RefPtr<DeviceOrientation> orientation = m_client->lastOrientation();
55 RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventN ames().deviceorientationEvent, orientation.get()); 55 RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventN ames().deviceorientationEvent, orientation.get());
56 56
57 Vector<DOMWindow*> listenersVector; 57 Vector<RefPtr<DOMWindow> > listenersVector;
58 copyToVector(m_newListeners, listenersVector); 58 copyToVector(m_newListeners, listenersVector);
59 m_newListeners.clear(); 59 m_newListeners.clear();
60 for (size_t i = 0; i < listenersVector.size(); ++i) 60 for (size_t i = 0; i < listenersVector.size(); ++i)
61 listenersVector[i]->dispatchEvent(event); 61 listenersVector[i]->dispatchEvent(event);
62 } 62 }
63 63
64 void DeviceOrientationController::addListener(DOMWindow* window) 64 void DeviceOrientationController::addListener(DOMWindow* window)
65 { 65 {
66 // If the client already has an orientation, we should fire an event with th at 66 // If the client already has an orientation, we should fire an event with th at
67 // orientation. The event is fired asynchronously, but without 67 // orientation. The event is fired asynchronously, but without
(...skipping 27 matching lines...) Expand all
95 95
96 m_listeners.removeAll(window); 96 m_listeners.removeAll(window);
97 m_newListeners.remove(window); 97 m_newListeners.remove(window);
98 if (m_listeners.isEmpty()) 98 if (m_listeners.isEmpty())
99 m_client->stopUpdating(); 99 m_client->stopUpdating();
100 } 100 }
101 101
102 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation* orientation) 102 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation* orientation)
103 { 103 {
104 RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventN ames().deviceorientationEvent, orientation); 104 RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventN ames().deviceorientationEvent, orientation);
105 Vector<DOMWindow*> listenersVector; 105 Vector<RefPtr<DOMWindow> > listenersVector;
106 copyToVector(m_listeners, listenersVector); 106 copyToVector(m_listeners, listenersVector);
107 for (size_t i = 0; i < listenersVector.size(); ++i) 107 for (size_t i = 0; i < listenersVector.size(); ++i)
108 listenersVector[i]->dispatchEvent(event); 108 listenersVector[i]->dispatchEvent(event);
109 } 109 }
110 110
111 } // namespace WebCore 111 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/dom/DeviceOrientationController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698