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

Side by Side Diff: runtime/bin/namespace_patch.dart

Issue 3001963002: [dart:io] Namespaces for file IO (Closed)
Patch Set: Fuchsia fix Created 3 years, 3 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 | « runtime/bin/namespace_macos.cc ('k') | runtime/bin/namespace_unsupported.cc » ('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 (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 class _NamespaceImpl extends NativeFieldWrapperClass1 implements _Namespace {
6 _NamespaceImpl._();
7
8 static _NamespaceImpl _create(_NamespaceImpl namespace, var n)
9 native "Namespace_Create";
10 static int _getPointer(_NamespaceImpl namespace)
11 native "Namespace_GetPointer";
12 static int _getDefault() native "Namespace_GetDefault";
13
14 // If the platform supports "namespaces", this method is called by the
15 // embedder with the platform-specific namespace information.
16 static _NamespaceImpl _cachedNamespace = null;
17 static void _setupNamespace(var namespace) {
18 _cachedNamespace = _create(new _NamespaceImpl._(), namespace);
19 }
20
21 static _NamespaceImpl get _namespace {
22 if (_cachedNamespace == null) {
23 // The embedder has not supplied a namespace before one is needed, so
24 // instead use a safe-ish default value.
25 _cachedNamespace = _create(new _NamespaceImpl._(), _getDefault());
26 }
27 return _cachedNamespace;
28 }
29
30 static int get _namespacePointer => _getPointer(_namespace);
31 }
32
33 @patch
34 class _Namespace {
35 @patch
36 static void _setupNamespace(var namespace) {
37 _NamespaceImpl._setupNamespace(namespace);
38 }
39
40 @patch
41 static _Namespace get _namespace => _NamespaceImpl._namespace;
42
43 @patch
44 static int get _namespacePointer => _NamespaceImpl._namespacePointer;
45 }
OLDNEW
« no previous file with comments | « runtime/bin/namespace_macos.cc ('k') | runtime/bin/namespace_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698