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

Side by Side Diff: src/platform-win32.cc

Issue 6543039: Bug: OS::MemoryMappedFile::open() should not truncate a pre-existing file. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« src/platform-freebsd.cc ('K') | « src/platform-solaris.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 HANDLE file_mapping_; 932 HANDLE file_mapping_;
933 void* memory_; 933 void* memory_;
934 int size_; 934 int size_;
935 }; 935 };
936 936
937 937
938 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) { 938 OS::MemoryMappedFile* OS::MemoryMappedFile::open(const char* name) {
939 // Open a physical file 939 // Open a physical file
940 HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE, 940 HANDLE file = CreateFileA(name, GENERIC_READ | GENERIC_WRITE,
941 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); 941 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
942 if (file == NULL) return NULL; 942 if (file == INVALID_HANDLE_VALUE) return NULL;
943 943
944 int size = static_cast<int>(GetFileSize(file, NULL)); 944 int size = static_cast<int>(GetFileSize(file, NULL));
945 945
946 // Create a file mapping for the physical file 946 // Create a file mapping for the physical file
947 HANDLE file_mapping = CreateFileMapping(file, NULL, 947 HANDLE file_mapping = CreateFileMapping(file, NULL,
948 PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL); 948 PAGE_READWRITE, 0, static_cast<DWORD>(size), NULL);
949 if (file_mapping == NULL) return NULL; 949 if (file_mapping == NULL) return NULL;
950 950
951 // Map a view of the file into memory 951 // Map a view of the file into memory
952 void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size); 952 void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size);
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 1965
1966 // Release the thread handles 1966 // Release the thread handles
1967 CloseHandle(data_->sampler_thread_); 1967 CloseHandle(data_->sampler_thread_);
1968 CloseHandle(data_->profiled_thread_); 1968 CloseHandle(data_->profiled_thread_);
1969 } 1969 }
1970 1970
1971 1971
1972 #endif // ENABLE_LOGGING_AND_PROFILING 1972 #endif // ENABLE_LOGGING_AND_PROFILING
1973 1973
1974 } } // namespace v8::internal 1974 } } // namespace v8::internal
OLDNEW
« src/platform-freebsd.cc ('K') | « src/platform-solaris.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698