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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1660063002: Remove many features when building product mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/vm/dart.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5506 matching lines...) Expand 10 before | Expand all | Expand 10 after
5517 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); 5517 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
5518 if (::Dart_IsError(state)) { 5518 if (::Dart_IsError(state)) {
5519 return state; 5519 return state;
5520 } 5520 }
5521 5521
5522 // Now that the newly loaded classes are finalized, notify the debugger 5522 // Now that the newly loaded classes are finalized, notify the debugger
5523 // that new code has been loaded. If there are latent breakpoints in 5523 // that new code has been loaded. If there are latent breakpoints in
5524 // the new code, the debugger convert them to unresolved source breakpoints. 5524 // the new code, the debugger convert them to unresolved source breakpoints.
5525 // The code that completes the futures (invoked below) may call into the 5525 // The code that completes the futures (invoked below) may call into the
5526 // newly loaded code and trigger one of these breakpoints. 5526 // newly loaded code and trigger one of these breakpoints.
5527 I->debugger()->NotifyDoneLoading(); 5527 if (FLAG_support_debugger) {
5528 I->debugger()->NotifyDoneLoading();
5529 }
5528 5530
5529 if (FLAG_enable_mirrors) { 5531 if (FLAG_enable_mirrors) {
5530 // Notify mirrors that MirrorSystem.libraries needs to be recomputed. 5532 // Notify mirrors that MirrorSystem.libraries needs to be recomputed.
5531 const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary()); 5533 const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary());
5532 const Field& dirty_bit = Field::Handle(Z, 5534 const Field& dirty_bit = Field::Handle(Z,
5533 libmirrors.LookupLocalField(String::Handle(String::New("dirty")))); 5535 libmirrors.LookupLocalField(String::Handle(String::New("dirty"))));
5534 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static()); 5536 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static());
5535 dirty_bit.SetStaticValue(Bool::True()); 5537 dirty_bit.SetStaticValue(Bool::True());
5536 } 5538 }
5537 5539
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
5625 5627
5626 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort() { 5628 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort() {
5627 return ServiceIsolate::WaitForLoadPort(); 5629 return ServiceIsolate::WaitForLoadPort();
5628 } 5630 }
5629 5631
5630 5632
5631 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( 5633 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(
5632 const char* name, 5634 const char* name,
5633 Dart_ServiceRequestCallback callback, 5635 Dart_ServiceRequestCallback callback,
5634 void* user_data) { 5636 void* user_data) {
5635 Service::RegisterIsolateEmbedderCallback(name, callback, user_data); 5637 if (FLAG_support_service) {
5638 Service::RegisterIsolateEmbedderCallback(name, callback, user_data);
5639 }
5636 } 5640 }
5637 5641
5638 5642
5639 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5643 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5640 const char* name, 5644 const char* name,
5641 Dart_ServiceRequestCallback callback, 5645 Dart_ServiceRequestCallback callback,
5642 void* user_data) { 5646 void* user_data) {
5643 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5647 if (FLAG_support_service) {
5648 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5649 }
5644 } 5650 }
5645 5651
5646 5652
5647 DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks( 5653 DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks(
5648 Dart_ServiceStreamListenCallback listen_callback, 5654 Dart_ServiceStreamListenCallback listen_callback,
5649 Dart_ServiceStreamCancelCallback cancel_callback) { 5655 Dart_ServiceStreamCancelCallback cancel_callback) {
5656 if (!FLAG_support_service) {
5657 return Api::Success();
5658 }
5650 if (listen_callback != NULL) { 5659 if (listen_callback != NULL) {
5651 if (Service::stream_listen_callback() != NULL) { 5660 if (Service::stream_listen_callback() != NULL) {
5652 return Api::NewError( 5661 return Api::NewError(
5653 "%s permits only one listen callback to be registered, please " 5662 "%s permits only one listen callback to be registered, please "
5654 "remove the existing callback and then add this callback", 5663 "remove the existing callback and then add this callback",
5655 CURRENT_FUNC); 5664 CURRENT_FUNC);
5656 } 5665 }
5657 } else { 5666 } else {
5658 if (Service::stream_listen_callback() == NULL) { 5667 if (Service::stream_listen_callback() == NULL) {
5659 return Api::NewError( 5668 return Api::NewError(
(...skipping 17 matching lines...) Expand all
5677 } 5686 }
5678 Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback); 5687 Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback);
5679 return Api::Success(); 5688 return Api::Success();
5680 } 5689 }
5681 5690
5682 5691
5683 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, 5692 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id,
5684 const char* event_kind, 5693 const char* event_kind,
5685 const uint8_t* bytes, 5694 const uint8_t* bytes,
5686 intptr_t bytes_length) { 5695 intptr_t bytes_length) {
5696 #ifdef PRODUCT
5697 return Api::Success();
5698 #else
5687 DARTSCOPE(Thread::Current()); 5699 DARTSCOPE(Thread::Current());
5688 Isolate* I = T->isolate(); 5700 Isolate* I = T->isolate();
5689 if (stream_id == NULL) { 5701 if (stream_id == NULL) {
5690 RETURN_NULL_ERROR(stream_id); 5702 RETURN_NULL_ERROR(stream_id);
5691 } 5703 }
5692 if (event_kind == NULL) { 5704 if (event_kind == NULL) {
5693 RETURN_NULL_ERROR(event_kind); 5705 RETURN_NULL_ERROR(event_kind);
5694 } 5706 }
5695 if (bytes == NULL) { 5707 if (bytes == NULL) {
5696 RETURN_NULL_ERROR(bytes); 5708 RETURN_NULL_ERROR(bytes);
5697 } 5709 }
5698 if (bytes_length < 0) { 5710 if (bytes_length < 0) {
5699 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.", 5711 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.",
5700 CURRENT_FUNC); 5712 CURRENT_FUNC);
5701 } 5713 }
5702 Service::SendEmbedderEvent(I, stream_id, event_kind, 5714 Service::SendEmbedderEvent(I, stream_id, event_kind,
5703 bytes, bytes_length); 5715 bytes, bytes_length);
5704 return Api::Success(); 5716 return Api::Success();
5717 #endif // PRODUCT
5705 } 5718 }
5706 5719
5707 5720
5708 DART_EXPORT int64_t Dart_TimelineGetMicros() { 5721 DART_EXPORT int64_t Dart_TimelineGetMicros() {
5709 return OS::GetCurrentMonotonicMicros(); 5722 return OS::GetCurrentMonotonicMicros();
5710 } 5723 }
5711 5724
5712 5725
5713 DART_EXPORT void Dart_TimelineSetRecordedStreams(int64_t stream_mask) { 5726 DART_EXPORT void Dart_TimelineSetRecordedStreams(int64_t stream_mask) {
5714 Isolate* isolate = Isolate::Current(); 5727 Isolate* isolate = Isolate::Current();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5852 free(output); 5865 free(output);
5853 5866
5854 // Finish the stream. 5867 // Finish the stream.
5855 FinishStreamToConsumer(consumer, user_data, "timeline"); 5868 FinishStreamToConsumer(consumer, user_data, "timeline");
5856 return true; 5869 return true;
5857 } 5870 }
5858 5871
5859 5872
5860 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer, 5873 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer,
5861 void* user_data) { 5874 void* user_data) {
5875 if (!FLAG_support_timeline) {
5876 return false;
5877 }
5862 Isolate* isolate = Isolate::Current(); 5878 Isolate* isolate = Isolate::Current();
5863 CHECK_ISOLATE(isolate); 5879 CHECK_ISOLATE(isolate);
5864 if (consumer == NULL) { 5880 if (consumer == NULL) {
5865 return false; 5881 return false;
5866 } 5882 }
5867 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); 5883 TimelineEventRecorder* timeline_recorder = Timeline::recorder();
5868 if (timeline_recorder == NULL) { 5884 if (timeline_recorder == NULL) {
5869 // Nothing has been recorded. 5885 // Nothing has been recorded.
5870 return false; 5886 return false;
5871 } 5887 }
5872 Thread* T = Thread::Current(); 5888 Thread* T = Thread::Current();
5873 StackZone zone(T); 5889 StackZone zone(T);
5874 Timeline::ReclaimCachedBlocksFromThreads(); 5890 Timeline::ReclaimCachedBlocksFromThreads();
5875 JSONStream js; 5891 JSONStream js;
5876 IsolateTimelineEventFilter filter(isolate->main_port()); 5892 IsolateTimelineEventFilter filter(isolate->main_port());
5877 timeline_recorder->PrintTraceEvent(&js, &filter); 5893 timeline_recorder->PrintTraceEvent(&js, &filter);
5878 return StreamTraceEvents(consumer, user_data, &js); 5894 return StreamTraceEvents(consumer, user_data, &js);
5879 } 5895 }
5880 5896
5881 5897
5882 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, 5898 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer,
5883 void* user_data) { 5899 void* user_data) {
5900 if (!FLAG_support_timeline) {
5901 return false;
5902 }
5884 // To support various embedders, it must be possible to call this function 5903 // To support various embedders, it must be possible to call this function
5885 // from a thread for which we have not entered an Isolate and set up a Thread 5904 // from a thread for which we have not entered an Isolate and set up a Thread
5886 // TLS object. Therefore, a Zone may not be available, a StackZone cannot be 5905 // TLS object. Therefore, a Zone may not be available, a StackZone cannot be
5887 // created, and no ZoneAllocated objects can be allocated. 5906 // created, and no ZoneAllocated objects can be allocated.
5888 if (consumer == NULL) { 5907 if (consumer == NULL) {
5889 return false; 5908 return false;
5890 } 5909 }
5891 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); 5910 TimelineEventRecorder* timeline_recorder = Timeline::recorder();
5892 if (timeline_recorder == NULL) { 5911 if (timeline_recorder == NULL) {
5893 // Nothing has been recorded. 5912 // Nothing has been recorded.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
6104 return Api::Success(); 6123 return Api::Success();
6105 } 6124 }
6106 #endif // DART_PRECOMPILER 6125 #endif // DART_PRECOMPILER
6107 6126
6108 6127
6109 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { 6128 DART_EXPORT bool Dart_IsRunningPrecompiledCode() {
6110 return Dart::IsRunningPrecompiledCode(); 6129 return Dart::IsRunningPrecompiledCode();
6111 } 6130 }
6112 6131
6113 } // namespace dart 6132 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698