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

Unified Diff: sky/engine/tonic/dart_timer_heap.cc

Issue 1243483002: Port more uses of OwnPtr to std::unique_ptr (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/tonic/dart_timer_heap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/tonic/dart_timer_heap.cc
diff --git a/sky/engine/tonic/dart_timer_heap.cc b/sky/engine/tonic/dart_timer_heap.cc
index ed0e6afd484d5fbaef5c943b1d4fe37e978ed75a..e5d17b2c974f4c84cd5308e1413ef620bcbc7296 100644
--- a/sky/engine/tonic/dart_timer_heap.cc
+++ b/sky/engine/tonic/dart_timer_heap.cc
@@ -20,9 +20,9 @@ DartTimerHeap::DartTimerHeap() : next_timer_id_(1), weak_factory_(this) {
DartTimerHeap::~DartTimerHeap() {
}
-int DartTimerHeap::Add(PassOwnPtr<Task> task) {
+int DartTimerHeap::Add(std::unique_ptr<Task> task) {
int id = next_timer_id_++;
- Schedule(id, task);
+ Schedule(id, std::move(task));
return id;
}
@@ -30,9 +30,9 @@ void DartTimerHeap::Remove(int id) {
heap_.erase(id);
}
-void DartTimerHeap::Schedule(int id, PassOwnPtr<Task> task) {
+void DartTimerHeap::Schedule(int id, std::unique_ptr<Task> task) {
base::TimeDelta delay = task->delay;
- heap_[id] = task;
+ heap_[id] = std::move(task);
base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
base::Bind(&DartTimerHeap::Run, weak_factory_.GetWeakPtr(), id), delay);
}
@@ -41,7 +41,7 @@ void DartTimerHeap::Run(int id) {
auto it = heap_.find(id);
if (it == heap_.end())
return;
- OwnPtr<Task> task = it->second.release();
+ std::unique_ptr<Task> task = std::unique_ptr<Task>(it->second.release());
heap_.erase(it);
if (!task->closure.dart_state())
return;
@@ -49,7 +49,7 @@ void DartTimerHeap::Run(int id) {
DartApiScope api_scope;
DartInvokeAppClosure(task->closure.value(), 0, nullptr);
if (task->repeating)
- Schedule(id, task.release());
+ Schedule(id, std::move(task));
}
}
« no previous file with comments | « sky/engine/tonic/dart_timer_heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698