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

Side by Side Diff: sky/engine/bindings/builtin_natives.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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/engine/tonic/dart_library_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sky/engine/bindings/builtin_natives.h" 5 #include "sky/engine/bindings/builtin_natives.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &milliseconds)); 203 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &milliseconds));
204 Dart_Handle closure = Dart_GetNativeArgument(args, 1); 204 Dart_Handle closure = Dart_GetNativeArgument(args, 1);
205 DART_CHECK_VALID(closure); 205 DART_CHECK_VALID(closure);
206 CHECK(Dart_IsClosure(closure)); 206 CHECK(Dart_IsClosure(closure));
207 bool repeating = false; 207 bool repeating = false;
208 DART_CHECK_VALID(Dart_GetNativeBooleanArgument(args, 2, &repeating)); 208 DART_CHECK_VALID(Dart_GetNativeBooleanArgument(args, 2, &repeating));
209 209
210 DartState* state = DartState::Current(); 210 DartState* state = DartState::Current();
211 CHECK(state); 211 CHECK(state);
212 212
213 OwnPtr<DartTimerHeap::Task> task = adoptPtr(new DartTimerHeap::Task); 213 std::unique_ptr<DartTimerHeap::Task> task =
214 std::unique_ptr<DartTimerHeap::Task>(new DartTimerHeap::Task);
214 task->closure.Set(state, closure); 215 task->closure.Set(state, closure);
215 task->delay = base::TimeDelta::FromMilliseconds(milliseconds); 216 task->delay = base::TimeDelta::FromMilliseconds(milliseconds);
216 task->repeating = repeating; 217 task->repeating = repeating;
217 218
218 int timer_id = state->timer_heap().Add(task.release()); 219 int timer_id = state->timer_heap().Add(std::move(task));
219 Dart_SetIntegerReturnValue(args, timer_id); 220 Dart_SetIntegerReturnValue(args, timer_id);
220 } 221 }
221 222
222 void Timer_cancel(Dart_NativeArguments args) { 223 void Timer_cancel(Dart_NativeArguments args) {
223 int64_t timer_id = 0; 224 int64_t timer_id = 0;
224 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &timer_id)); 225 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &timer_id));
225 226
226 DartState* state = DartState::Current(); 227 DartState* state = DartState::Current();
227 CHECK(state); 228 CHECK(state);
228 state->timer_heap().Remove(timer_id); 229 state->timer_heap().Remove(timer_id);
229 } 230 }
230 231
231 } // namespace blink 232 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/tonic/dart_library_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698