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

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

Issue 1807293002: - Fix for issue 25950 (add registration of a thread exit callback) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 9 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/isolate.cc ('k') | runtime/vm/os_linux.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <android/log.h> // NOLINT 10 #include <android/log.h> // NOLINT
(...skipping 19 matching lines...) Expand all
30 // Android CodeObservers. 30 // Android CodeObservers.
31 31
32 #ifndef PRODUCT 32 #ifndef PRODUCT
33 33
34 DEFINE_FLAG(bool, generate_perf_events_symbols, false, 34 DEFINE_FLAG(bool, generate_perf_events_symbols, false,
35 "Generate events symbols for profiling with perf"); 35 "Generate events symbols for profiling with perf");
36 36
37 class PerfCodeObserver : public CodeObserver { 37 class PerfCodeObserver : public CodeObserver {
38 public: 38 public:
39 PerfCodeObserver() : out_file_(NULL) { 39 PerfCodeObserver() : out_file_(NULL) {
40 Dart_FileOpenCallback file_open = Isolate::file_open_callback(); 40 Dart_FileOpenCallback file_open = Dart::file_open_callback();
41 if (file_open == NULL) { 41 if (file_open == NULL) {
42 return; 42 return;
43 } 43 }
44 intptr_t pid = getpid(); 44 intptr_t pid = getpid();
45 char* filename = OS::SCreate(NULL, "/tmp/perf-%" Pd ".map", pid); 45 char* filename = OS::SCreate(NULL, "/tmp/perf-%" Pd ".map", pid);
46 out_file_ = (*file_open)(filename, true); 46 out_file_ = (*file_open)(filename, true);
47 free(filename); 47 free(filename);
48 } 48 }
49 49
50 ~PerfCodeObserver() { 50 ~PerfCodeObserver() {
51 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 51 Dart_FileCloseCallback file_close = Dart::file_close_callback();
52 if ((file_close == NULL) || (out_file_ == NULL)) { 52 if ((file_close == NULL) || (out_file_ == NULL)) {
53 return; 53 return;
54 } 54 }
55 (*file_close)(out_file_); 55 (*file_close)(out_file_);
56 } 56 }
57 57
58 virtual bool IsActive() const { 58 virtual bool IsActive() const {
59 return FLAG_generate_perf_events_symbols && (out_file_ != NULL); 59 return FLAG_generate_perf_events_symbols && (out_file_ != NULL);
60 } 60 }
61 61
62 virtual void Notify(const char* name, 62 virtual void Notify(const char* name,
63 uword base, 63 uword base,
64 uword prologue_offset, 64 uword prologue_offset,
65 uword size, 65 uword size,
66 bool optimized) { 66 bool optimized) {
67 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); 67 Dart_FileWriteCallback file_write = Dart::file_write_callback();
68 if ((file_write == NULL) || (out_file_ == NULL)) { 68 if ((file_write == NULL) || (out_file_ == NULL)) {
69 return; 69 return;
70 } 70 }
71 const char* marker = optimized ? "*" : ""; 71 const char* marker = optimized ? "*" : "";
72 char* buffer = OS::SCreate(Thread::Current()->zone(), 72 char* buffer = OS::SCreate(Thread::Current()->zone(),
73 "%" Px " %" Px " %s%s\n", base, size, marker, name); 73 "%" Px " %" Px " %s%s\n", base, size, marker, name);
74 (*file_write)(buffer, strlen(buffer), out_file_); 74 (*file_write)(buffer, strlen(buffer), out_file_);
75 } 75 }
76 76
77 private: 77 private:
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 427 }
428 428
429 429
430 void OS::Exit(int code) { 430 void OS::Exit(int code) {
431 exit(code); 431 exit(code);
432 } 432 }
433 433
434 } // namespace dart 434 } // namespace dart
435 435
436 #endif // defined(TARGET_OS_ANDROID) 436 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698