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

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

Issue 1892623002: Fixes leak of native File objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 8 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/io_natives.cc ('k') | sdk/lib/_internal/js_runtime/lib/io_patch.dart » ('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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 if (write_magic_number) { 1092 if (write_magic_number) {
1093 // Write the magic number to indicate file is a script snapshot. 1093 // Write the magic number to indicate file is a script snapshot.
1094 DartUtils::WriteMagicNumber(file); 1094 DartUtils::WriteMagicNumber(file);
1095 } 1095 }
1096 1096
1097 if (!file->WriteFully(buffer, size)) { 1097 if (!file->WriteFully(buffer, size)) {
1098 ErrorExit(kErrorExitCode, 1098 ErrorExit(kErrorExitCode,
1099 "Unable to open file %s for writing snapshot\n", 1099 "Unable to open file %s for writing snapshot\n",
1100 qualified_filename); 1100 qualified_filename);
1101 } 1101 }
1102 delete file; 1102 file->Release();
1103 if (concat != NULL) { 1103 if (concat != NULL) {
1104 delete concat; 1104 delete concat;
1105 } 1105 }
1106 } 1106 }
1107 1107
1108 1108
1109 static void ReadSnapshotFile(const char* snapshot_directory, 1109 static void ReadSnapshotFile(const char* snapshot_directory,
1110 const char* filename, 1110 const char* filename,
1111 const uint8_t** buffer) { 1111 const uint8_t** buffer) {
1112 char* concat = NULL; 1112 char* concat = NULL;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 Platform::Exit(Process::GlobalExitCode()); 1699 Platform::Exit(Process::GlobalExitCode());
1700 } 1700 }
1701 1701
1702 } // namespace bin 1702 } // namespace bin
1703 } // namespace dart 1703 } // namespace dart
1704 1704
1705 int main(int argc, char** argv) { 1705 int main(int argc, char** argv) {
1706 dart::bin::main(argc, argv); 1706 dart::bin::main(argc, argv);
1707 UNREACHABLE(); 1707 UNREACHABLE();
1708 } 1708 }
OLDNEW
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | sdk/lib/_internal/js_runtime/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698