| OLD | NEW |
| 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/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/bindings/builtin_natives.h" | 6 #include "sky/engine/bindings/builtin_natives.h" |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 Dart_Handle closure = Dart_GetNativeArgument(args, 0); | 185 Dart_Handle closure = Dart_GetNativeArgument(args, 0); |
| 186 if (LogIfError(closure) || !Dart_IsClosure(closure)) | 186 if (LogIfError(closure) || !Dart_IsClosure(closure)) |
| 187 return; | 187 return; |
| 188 DartState* dart_state = DartState::Current(); | 188 DartState* dart_state = DartState::Current(); |
| 189 CHECK(dart_state); | 189 CHECK(dart_state); |
| 190 Microtask::enqueueMicrotask(base::Bind(&ExecuteMicrotask, | 190 Microtask::enqueueMicrotask(base::Bind(&ExecuteMicrotask, |
| 191 dart_state->GetWeakPtr(), DartValue::Create(dart_state, closure))); | 191 dart_state->GetWeakPtr(), DartValue::Create(dart_state, closure))); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GetBaseURLString(Dart_NativeArguments args) { | 194 void GetBaseURLString(Dart_NativeArguments args) { |
| 195 String url; | 195 String url = DOMDartState::Current()->url(); |
| 196 if (Document* document = DOMDartState::CurrentDocument()) | |
| 197 url = document->url().string(); | |
| 198 Dart_SetReturnValue(args, StringToDart(DartState::Current(), url)); | 196 Dart_SetReturnValue(args, StringToDart(DartState::Current(), url)); |
| 199 } | 197 } |
| 200 | 198 |
| 201 void Timer_create(Dart_NativeArguments args) { | 199 void Timer_create(Dart_NativeArguments args) { |
| 202 int64_t milliseconds = 0; | 200 int64_t milliseconds = 0; |
| 203 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &milliseconds)); | 201 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &milliseconds)); |
| 204 Dart_Handle closure = Dart_GetNativeArgument(args, 1); | 202 Dart_Handle closure = Dart_GetNativeArgument(args, 1); |
| 205 DART_CHECK_VALID(closure); | 203 DART_CHECK_VALID(closure); |
| 206 CHECK(Dart_IsClosure(closure)); | 204 CHECK(Dart_IsClosure(closure)); |
| 207 bool repeating = false; | 205 bool repeating = false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 222 void Timer_cancel(Dart_NativeArguments args) { | 220 void Timer_cancel(Dart_NativeArguments args) { |
| 223 int64_t timer_id = 0; | 221 int64_t timer_id = 0; |
| 224 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &timer_id)); | 222 DART_CHECK_VALID(Dart_GetNativeIntegerArgument(args, 0, &timer_id)); |
| 225 | 223 |
| 226 DartState* state = DartState::Current(); | 224 DartState* state = DartState::Current(); |
| 227 CHECK(state); | 225 CHECK(state); |
| 228 state->timer_heap().Remove(timer_id); | 226 state->timer_heap().Remove(timer_id); |
| 229 } | 227 } |
| 230 | 228 |
| 231 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |