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

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

Issue 2715463003: Add option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. (Closed)
Patch Set: . Created 3 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/bin/file.h ('k') | runtime/bin/file_fuchsia.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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); 113 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes));
114 } 114 }
115 115
116 116
117 int64_t File::Write(const void* buffer, int64_t num_bytes) { 117 int64_t File::Write(const void* buffer, int64_t num_bytes) {
118 ASSERT(handle_->fd() >= 0); 118 ASSERT(handle_->fd() >= 0);
119 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes)); 119 return TEMP_FAILURE_RETRY(write(handle_->fd(), buffer, num_bytes));
120 } 120 }
121 121
122 122
123 bool File::VPrint(const char* format, va_list args) {
124 // Measure.
125 va_list measure_args;
126 va_copy(measure_args, args);
127 intptr_t len = vsnprintf(NULL, 0, format, measure_args);
128 va_end(measure_args);
129
130 char* buffer = reinterpret_cast<char*>(malloc(len + 1));
131
132 // Print.
133 va_list print_args;
134 va_copy(print_args, args);
135 vsnprintf(buffer, len + 1, format, print_args);
136 va_end(print_args);
137
138 bool result = WriteFully(buffer, len);
139 free(buffer);
140 return result;
141 }
142
143
123 int64_t File::Position() { 144 int64_t File::Position() {
124 ASSERT(handle_->fd() >= 0); 145 ASSERT(handle_->fd() >= 0);
125 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); 146 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR));
126 } 147 }
127 148
128 149
129 bool File::SetPosition(int64_t position) { 150 bool File::SetPosition(int64_t position) {
130 ASSERT(handle_->fd() >= 0); 151 ASSERT(handle_->fd() >= 0);
131 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; 152 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0;
132 } 153 }
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 return ((file_1_info.st_ino == file_2_info.st_ino) && 602 return ((file_1_info.st_ino == file_2_info.st_ino) &&
582 (file_1_info.st_dev == file_2_info.st_dev)) 603 (file_1_info.st_dev == file_2_info.st_dev))
583 ? File::kIdentical 604 ? File::kIdentical
584 : File::kDifferent; 605 : File::kDifferent;
585 } 606 }
586 607
587 } // namespace bin 608 } // namespace bin
588 } // namespace dart 609 } // namespace dart
589 610
590 #endif // defined(TARGET_OS_ANDROID) 611 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698