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

Side by Side Diff: tonic/dart_builtin.cc

Issue 1244493002: Wholesale move sky/engine/tonic to tonic (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 | « tonic/dart_builtin.h ('k') | tonic/dart_class_library.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "tonic/dart_builtin.h"
6
7 #include <stdlib.h>
8 #include <string.h>
9
10 #include "base/logging.h"
11 #include "tonic/dart_converter.h"
12
13 namespace blink {
14
15 DartBuiltin::DartBuiltin(const Natives* natives, size_t count)
16 : natives_(natives), count_(count) {
17 }
18
19 DartBuiltin::~DartBuiltin() {
20 }
21
22 Dart_NativeFunction DartBuiltin::Resolver(Dart_Handle name,
23 int argument_count,
24 bool* auto_setup_scope) const {
25 const char* function_name = nullptr;
26 Dart_Handle result = Dart_StringToCString(name, &function_name);
27 DART_CHECK_VALID(result);
28 DCHECK(function_name != nullptr);
29 DCHECK(auto_setup_scope != nullptr);
30 *auto_setup_scope = true;
31 for (size_t i = 0; i < count_; ++i) {
32 const Natives& entry = natives_[i];
33 if (!strcmp(function_name, entry.name) &&
34 (entry.argument_count == argument_count)) {
35 return entry.function;
36 }
37 }
38 return nullptr;
39 }
40
41 const uint8_t* DartBuiltin::Symbolizer(Dart_NativeFunction native_function) cons t {
42 for (size_t i = 0; i < count_; ++i) {
43 const Natives& entry = natives_[i];
44 if (entry.function == native_function)
45 return reinterpret_cast<const uint8_t*>(entry.name);
46 }
47 return nullptr;
48 }
49
50 Dart_Handle DartBuiltin::LookupLibrary(const char* name) {
51 Dart_Handle library = Dart_LookupLibrary(ToDart(name));
52 DCHECK(!Dart_IsError(library));
53 return library;
54 }
55
56 } // namespace blink
OLDNEW
« no previous file with comments | « tonic/dart_builtin.h ('k') | tonic/dart_class_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698