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

Side by Side Diff: runtime/bin/file_macos.cc

Issue 109803002: Profiler Take 2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
11 #include <fcntl.h> // NOLINT 11 #include <fcntl.h> // NOLINT
12 #include <copyfile.h> // NOLINT 12 #include <copyfile.h> // NOLINT
13 #include <sys/stat.h> // NOLINT 13 #include <sys/stat.h> // NOLINT
14 #include <unistd.h> // NOLINT 14 #include <unistd.h> // NOLINT
15 #include <libgen.h> // NOLINT 15 #include <libgen.h> // NOLINT
16 #include <limits.h> // NOLINT 16 #include <limits.h> // NOLINT
17 17
18 #include "bin/builtin.h" 18 #include "bin/builtin.h"
19 #include "bin/fdutils.h" 19 #include "bin/fdutils.h"
20 #include "bin/log.h" 20 #include "bin/log.h"
21 21 #include "bin/signal_blocker.h"
22 22
23 namespace dart { 23 namespace dart {
24 namespace bin { 24 namespace bin {
25 25
26 class FileHandle { 26 class FileHandle {
27 public: 27 public:
28 explicit FileHandle(int fd) : fd_(fd) { } 28 explicit FileHandle(int fd) : fd_(fd) { }
29 ~FileHandle() { } 29 ~FileHandle() { }
30 int fd() const { return fd_; } 30 int fd() const { return fd_; }
31 void set_fd(int fd) { fd_ = fd; } 31 void set_fd(int fd) { fd_ = fd; }
(...skipping 27 matching lines...) Expand all
59 } 59 }
60 60
61 61
62 bool File::IsClosed() { 62 bool File::IsClosed() {
63 return handle_->fd() == kClosedFd; 63 return handle_->fd() == kClosedFd;
64 } 64 }
65 65
66 66
67 int64_t File::Read(void* buffer, int64_t num_bytes) { 67 int64_t File::Read(void* buffer, int64_t num_bytes) {
68 ASSERT(handle_->fd() >= 0); 68 ASSERT(handle_->fd() >= 0);
69 // Block profile interrupts while making I/O call.
70 ThreadSignalBlocker tsb(SIGPROF);
69 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); 71 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
70 } 72 }
71 73
72 74
73 int64_t File::Write(const void* buffer, int64_t num_bytes) { 75 int64_t File::Write(const void* buffer, int64_t num_bytes) {
74 ASSERT(handle_->fd() >= 0); 76 ASSERT(handle_->fd() >= 0);
77 // Block profile interrupts while making I/O call.
78 ThreadSignalBlocker tsb(SIGPROF);
75 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); 79 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
76 } 80 }
77 81
78 82
79 off64_t File::Position() { 83 off64_t File::Position() {
80 ASSERT(handle_->fd() >= 0); 84 ASSERT(handle_->fd() >= 0);
81 return lseek(handle_->fd(), 0, SEEK_CUR); 85 return lseek(handle_->fd(), 0, SEEK_CUR);
82 } 86 }
83 87
84 88
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return (file_1_info.st_ino == file_2_info.st_ino && 376 return (file_1_info.st_ino == file_2_info.st_ino &&
373 file_1_info.st_dev == file_2_info.st_dev) ? 377 file_1_info.st_dev == file_2_info.st_dev) ?
374 File::kIdentical : 378 File::kIdentical :
375 File::kDifferent; 379 File::kDifferent;
376 } 380 }
377 381
378 } // namespace bin 382 } // namespace bin
379 } // namespace dart 383 } // namespace dart
380 384
381 #endif // defined(TARGET_OS_MACOS) 385 #endif // defined(TARGET_OS_MACOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698