Revert "[SDK] Remove dart:profiler library which has been deprecated since Dart 1.2"

This reverts commit 6f85cb83cf.

Reason for revert: CFE built before this CL breaks with dill built after; it expects dart:profiler to be present in the dill.

Original change's description:
> [SDK] Remove dart:profiler library which has been deprecated since Dart 1.2
>       and remove all references to it in tests and the SDK build scripts.
> 
> Change-Id: I65a4d71b74c66ca090eba28e922e2f70a7b2989d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114965
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I5fec5c7aec55377ba5cba0b55a25e67682220276
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115242
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
This commit is contained in:
David Morgan 2019-09-03 14:26:26 +00:00 committed by commit-bot@chromium.org
parent 8ee22c246e
commit 54b95f1c8b
18 changed files with 48 additions and 11 deletions

View file

@ -4,9 +4,10 @@
/// Test that exports are serialized in platform.dill.
// This is somewhat brittle and we should extend this test framework to be
// able to deal with multiple .dill files.
import 'dart:developer' show UserTag;
// Note: "dart:profiler" exports UserTag from "dart:developer". This is
// somewhat brittle and we should extend this test framework to be able to deal
// with multiple .dill files.
import 'dart:profiler' show UserTag;
export 'dart:core' show print;

View file

@ -4,7 +4,7 @@ import "dart:core" as core;
additionalExports = (core::print)
import "dart:developer";
import "dart:profiler";
export "dart:core";
static method main() → dynamic

View file

@ -5,7 +5,7 @@ import "dart:developer" as dev;
additionalExports = (core::print)
import "dart:developer";
import "dart:profiler";
export "dart:core";
static method main() → dynamic {

View file

@ -5,7 +5,7 @@ import "dart:developer" as dev;
additionalExports = (core::print)
import "dart:developer";
import "dart:profiler";
export "dart:core";
static method main() → dynamic {

View file

@ -32,6 +32,7 @@ class DartRunnerTarget extends VmTarget {
// PRODUCT mode.
'dart:mirrors',
'dart:profiler',
'dart:typed_data',
'dart:nativewrappers',
'dart:io',

View file

@ -37,6 +37,7 @@ class FlutterTarget extends VmTarget {
// PRODUCT mode.
'dart:mirrors',
'dart:profiler',
'dart:typed_data',
'dart:nativewrappers',
'dart:io',

View file

@ -32,6 +32,7 @@ class FlutterRunnerTarget extends VmTarget {
// PRODUCT mode.
'dart:mirrors',
'dart:profiler',
'dart:typed_data',
'dart:nativewrappers',
'dart:io',

View file

@ -69,6 +69,7 @@ class VmTarget extends Target {
// PRODUCT mode.
'dart:mirrors',
'dart:profiler',
'dart:typed_data',
'dart:vmservice_io',
'dart:_vmservice',

View file

@ -52,7 +52,7 @@ var tests = <IsolateTest>[
expect(event['pid'], isInt);
expect(event['tid'], isInt);
expect(event['ts'], isInt);
expect(event['cat'], equals("Developer"));
expect(event['cat'], equals("Profiler"));
expect(event['args']['backtrace'], isString);
}
},
@ -62,7 +62,7 @@ var vmArgs = [
'--profiler=true',
'--profile-vm=false', // So this also works with DBC and KBC.
'--timeline_recorder=ring',
'--timeline_streams=Developer'
'--timeline_streams=Profiler'
];
main(args) async =>

View file

@ -13,6 +13,7 @@ import("../../sdk/lib/internal/internal_sources.gni")
import("../../sdk/lib/isolate/isolate_sources.gni")
import("../../sdk/lib/math/math_sources.gni")
import("../../sdk/lib/mirrors/mirrors_sources.gni")
import("../../sdk/lib/profiler/profiler_sources.gni")
import("../../sdk/lib/typed_data/typed_data_sources.gni")
import("../../sdk/lib/vmservice/vmservice_sources.gni")
import("../../sdk/lib/wasm/wasm_sources.gni")

View file

@ -127,6 +127,11 @@ void Bootstrap::SetupNativeResolver() {
library.set_native_entry_symbol_resolver(symbol_resolver);
#endif
library = Library::ProfilerLibrary();
ASSERT(!library.IsNull());
library.set_native_entry_resolver(resolver);
library.set_native_entry_symbol_resolver(symbol_resolver);
library = Library::TypedDataLibrary();
ASSERT(!library.IsNull());
library.set_native_entry_resolver(resolver);

View file

@ -7912,7 +7912,7 @@ TEST_CASE(DartAPI_NotifyLowMemory) {
TEST_CASE(DartAPI_InvokeImportedFunction) {
const char* kScriptChars =
"import 'dart:math';\n"
"import 'dart:developer';\n"
"import 'dart:profiler';\n"
"main() {}";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
@ -7924,6 +7924,11 @@ TEST_CASE(DartAPI_InvokeImportedFunction) {
EXPECT_ERROR(result,
"NoSuchMethodError: No top-level method 'max' declared.");
// The function 'getCurrentTag' is actually defined in the library
// dart:developer. However, the library dart:profiler exports dart:developer
// and exposes the function 'getCurrentTag'.
// NOTE: dart:profiler is deprecated. So, its use in this test is only
// an interim solution until we fix DartAPI_Invoke_CrossLibrary.
Dart_Handle getCurrentTag = Dart_NewStringFromCString("getCurrentTag");
result = Dart_Invoke(lib, getCurrentTag, 0, NULL);
EXPECT_ERROR(

View file

@ -27,6 +27,7 @@ class ObjectPointerVisitor;
M(Isolate, isolate) \
M(Math, math) \
M(Mirrors, mirrors) \
M(Profiler, profiler) \
M(TypedData, typed_data) \
M(VMService, _vmservice) \
M(Wasm, wasm)

View file

@ -2545,7 +2545,7 @@ void Profile::PrintBacktrace(ProfileTrieNode* node, TextBuffer* buf) {
}
void Profile::AddToTimeline(bool code_trie) {
TimelineStream* stream = Timeline::GetDeveloperStream();
TimelineStream* stream = Timeline::GetProfilerStream();
if (stream == NULL) {
return;
}

View file

@ -53,7 +53,7 @@ class Zone;
V(Embedder, "dart:embedder") \
V(GC, "dart:gc") \
V(Isolate, "dart:isolate") \
V(Developer, "dart:developer") \
V(Profiler, "dart:profiler") \
V(VM, "dart:vm")
// A stream of timeline events. A stream has a name and can be enabled or

View file

@ -222,6 +222,7 @@ _full_sdk_libraries = [
"js_util",
"math",
"mirrors",
"profiler",
"svg",
"typed_data",
"wasm",
@ -248,6 +249,7 @@ _full_sdk_libraries = [
# "isolate",
# "math",
# "mirrors",
# "profiler",
# "typed_data",
# ]
_platform_sdk_libraries = _full_sdk_libraries

View file

@ -0,0 +1,10 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Please see 'dart:developer'.
@Deprecated("Dart SDK 1.12")
library dart.profiler;
export 'dart:developer'
show getCurrentTag, Counter, Gauge, Metric, Metrics, UserTag;

View file

@ -0,0 +1,8 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
profiler_sdk_sources = [
"profiler.dart",
# The above file needs to be first if additional parts are added to the lib.
]