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

Unified Diff: sdk/lib/_internal/lib/isolate_patch.dart

Issue 338103004: Use metadata for patching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « sdk/lib/_internal/lib/io_patch.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/isolate_patch.dart
diff --git a/sdk/lib/_internal/lib/isolate_patch.dart b/sdk/lib/_internal/lib/isolate_patch.dart
index 78a8ca925677e1af628421b09c040fa4642f2370..dc41e53518d1493c2f69dae9acd9b72b2b621c96 100644
--- a/sdk/lib/_internal/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/lib/isolate_patch.dart
@@ -4,6 +4,7 @@
// Patch file for the dart:isolate library.
+import 'dart:_js_helper' show patch;
import 'dart:_isolate_helper' show CapabilityImpl,
CloseToken,
IsolateNatives,
@@ -11,8 +12,10 @@ import 'dart:_isolate_helper' show CapabilityImpl,
ReceivePortImpl,
RawReceivePortImpl;
-patch class Isolate {
- patch static Future<Isolate> spawn(void entryPoint(message), var message,
+@patch
+class Isolate {
+ @patch
+ static Future<Isolate> spawn(void entryPoint(message), var message,
{ bool paused: false }) {
try {
return IsolateNatives.spawnFunction(entryPoint, message, paused)
@@ -24,7 +27,8 @@ patch class Isolate {
}
}
- patch static Future<Isolate> spawnUri(
+ @patch
+ static Future<Isolate> spawnUri(
Uri uri, List<String> args, var message, { bool paused: false }) {
try {
if (args is List<String>) {
@@ -45,7 +49,8 @@ patch class Isolate {
}
}
- patch void _pause(Capability resumeCapability) {
+ @patch
+ void _pause(Capability resumeCapability) {
var message = new List(3)
..[0] = "pause"
..[1] = pauseCapability
@@ -53,14 +58,16 @@ patch class Isolate {
controlPort.send(message);
}
- patch void resume(Capability resumeCapability) {
+ @patch
+ void resume(Capability resumeCapability) {
var message = new List(2)
..[0] = "resume"
..[1] = resumeCapability;
controlPort.send(message);
}
- patch void addOnExitListener(SendPort responsePort) {
+ @patch
+ void addOnExitListener(SendPort responsePort) {
// TODO(lrn): Can we have an internal method that checks if the receiving
// isolate of a SendPort is still alive?
var message = new List(2)
@@ -69,14 +76,16 @@ patch class Isolate {
controlPort.send(message);
}
- patch void removeOnExitListener(SendPort responsePort) {
+ @patch
+ void removeOnExitListener(SendPort responsePort) {
var message = new List(2)
..[0] = "remove-ondone"
..[1] = responsePort;
controlPort.send(message);
}
- patch void setErrorsFatal(bool errorsAreFatal) {
+ @patch
+ void setErrorsFatal(bool errorsAreFatal) {
var message = new List(3)
..[0] = "set-errors-fatal"
..[1] = terminateCapability
@@ -84,11 +93,13 @@ patch class Isolate {
controlPort.send(message);
}
- patch void kill([int priority = BEFORE_NEXT_EVENT]) {
+ @patch
+ void kill([int priority = BEFORE_NEXT_EVENT]) {
controlPort.send(["kill", terminateCapability, priority]);
}
- patch void ping(SendPort responsePort, [int pingType = IMMEDIATE]) {
+ @patch
+ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) {
var message = new List(3)
..[0] = "ping"
..[1] = responsePort
@@ -96,14 +107,16 @@ patch class Isolate {
controlPort.send(message);
}
- patch void addErrorListener(SendPort port) {
+ @patch
+ void addErrorListener(SendPort port) {
var message = new List(2)
..[0] = "getErrors"
..[1] = port;
controlPort.send(message);
}
- patch void removeErrorListener(SendPort port) {
+ @patch
+ void removeErrorListener(SendPort port) {
var message = new List(2)
..[0] = "stopErrors"
..[1] = port;
@@ -112,20 +125,27 @@ patch class Isolate {
}
/** Default factory for receive ports. */
-patch class ReceivePort {
- patch factory ReceivePort() = ReceivePortImpl;
+@patch
+class ReceivePort {
+ @patch
+ factory ReceivePort() = ReceivePortImpl;
- patch factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
+ @patch
+ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
return new ReceivePortImpl.fromRawReceivePort(rawPort);
}
}
-patch class RawReceivePort {
- patch factory RawReceivePort([void handler(event)]) {
+@patch
+class RawReceivePort {
+ @patch
+ factory RawReceivePort([void handler(event)]) {
return new RawReceivePortImpl(handler);
}
}
-patch class Capability {
- patch factory Capability() = CapabilityImpl;
+@patch
+class Capability {
+ @patch
+ factory Capability() = CapabilityImpl;
}
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698