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

Unified Diff: pkg/path/lib/path.dart

Issue 429173002: Don't cache path Context based on cwd, as cwd involves a system-call to compute. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « pkg/path/CHANGELOG.md ('k') | pkg/path/lib/src/context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/lib/path.dart
diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart
index 599a351507326afcb6a34b2cfc2bdae5061d3c27..b9a4175b5f6695337f5599fc6680742613748f6e 100644
--- a/pkg/path/lib/path.dart
+++ b/pkg/path/lib/path.dart
@@ -49,7 +49,7 @@ library path;
import 'src/context.dart';
import 'src/style.dart';
-export 'src/context.dart';
+export 'src/context.dart' hide createInternal;
export 'src/path_exception.dart';
export 'src/style.dart';
@@ -62,22 +62,9 @@ final windows = new Context(style: Style.windows);
/// A default context for manipulating URLs.
final url = new Context(style: Style.url);
-/// The result of [Uri.base] last time the current working directory was
-/// calculated.
-///
-/// This is used to invalidate [_cachedContext] when the working directory has
-/// changed since the last time a function was called.
-Uri _lastBaseUri;
-
/// An internal context for the current OS so we can provide a straight
/// functional interface and not require users to create one.
-Context get _context {
- if (_cachedContext != null && Uri.base == _lastBaseUri) return _cachedContext;
- _lastBaseUri = Uri.base;
- _cachedContext = new Context();
- return _cachedContext;
-}
-Context _cachedContext;
+final Context _context = createInternal();
/// Returns the [Style] of the current context.
///
« no previous file with comments | « pkg/path/CHANGELOG.md ('k') | pkg/path/lib/src/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698