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

Side by Side Diff: sky/engine/tonic/dart_timer_heap.h

Issue 1160763004: Add support for testing content in SkyView (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SKY_ENGINE_TONIC_DART_TIMER_HEAP_H_
6 #define SKY_ENGINE_TONIC_DART_TIMER_HEAP_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/time/time.h"
10 #include "dart/runtime/include/dart_api.h"
11 #include "sky/engine/tonic/dart_persistent_value.h"
12 #include "sky/engine/wtf/HashMap.h"
13 #include "sky/engine/wtf/OwnPtr.h"
14 #include "sky/engine/wtf/PassOwnPtr.h"
15
16 namespace blink {
17
18 class DartTimerHeap {
19 public:
20 DartTimerHeap();
21 ~DartTimerHeap();
22
23 struct Task {
24 DartPersistentValue closure;
25 base::TimeDelta delay;
26 bool repeating = false;
27 };
28
29 int Add(PassOwnPtr<Task> task);
30 void Remove(int id);
31
32 private:
33 void Schedule(int id, PassOwnPtr<Task> task);
34 void Run(int id);
35
36 int next_timer_id_;
37 HashMap<int, OwnPtr<Task>> heap_;
38
39 base::WeakPtrFactory<DartTimerHeap> weak_factory_;
40 };
41
42 }
43
44 #endif // SKY_ENGINE_TONIC_DART_TIMER_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698