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

Unified Diff: runtime/bin/file_linux.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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 3114d01c0be8aba4161a2881c513190526393cc0..760d501ee7e72e7ecdc000830863331e4ad25239 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -17,11 +17,14 @@
#include "bin/builtin.h"
#include "bin/log.h"
+#include "bin/signal_blocker.h"
namespace dart {
namespace bin {
+
+
siva 2013/12/13 21:29:14 ???
class FileHandle {
public:
explicit FileHandle(int fd) : fd_(fd) { }
@@ -64,12 +67,16 @@ bool File::IsClosed() {
int64_t File::Read(void* buffer, int64_t num_bytes) {
ASSERT(handle_->fd() >= 0);
+ // Block profile interrupts while making I/O call.
+ ThreadSignalBlocker tsb(SIGPROF);
return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
}
int64_t File::Write(const void* buffer, int64_t num_bytes) {
ASSERT(handle_->fd() >= 0);
+ // Block profile interrupts while making I/O call.
+ ThreadSignalBlocker tsb(SIGPROF);
return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
}
@@ -248,6 +255,8 @@ bool File::Copy(const char* old_path, const char* new_path) {
if (result < 0 && (errno == EINVAL || errno == ENOSYS)) {
const intptr_t kBufferSize = 8 * 1024;
uint8_t buffer[kBufferSize];
+ // Block profile interrupts while making I/O call.
+ ThreadSignalBlocker tsb(SIGPROF);
while ((result = TEMP_FAILURE_RETRY(
read(old_fd, buffer, kBufferSize))) > 0) {
int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));

Powered by Google App Engine
This is Rietveld 408576698