Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "TimeManager.h"
7 #include "mozilla/dom/Date.h"
8 #include "mozilla/dom/MozTimeManagerBinding.h"
9 #include "nsITimeService.h"
10 #include "nsServiceManagerUtils.h"
12 namespace mozilla {
13 namespace dom {
14 namespace time {
16 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeManager)
17 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
18 NS_INTERFACE_MAP_ENTRY(nsISupports)
19 NS_INTERFACE_MAP_END
21 NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeManager)
22 NS_IMPL_CYCLE_COLLECTING_RELEASE(TimeManager)
24 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(TimeManager, mWindow)
26 JSObject*
27 TimeManager::WrapObject(JSContext* aCx)
28 {
29 return MozTimeManagerBinding::Wrap(aCx, this);
30 }
32 void
33 TimeManager::Set(Date& aDate)
34 {
35 Set(aDate.TimeStamp());
36 }
38 void
39 TimeManager::Set(double aTime)
40 {
41 nsCOMPtr<nsITimeService> timeService = do_GetService(TIMESERVICE_CONTRACTID);
42 if (timeService) {
43 timeService->Set(aTime);
44 }
45 }
47 } // namespace time
48 } // namespace dom
49 } // namespace mozilla