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

Unified Diff: chrome/renderer/translate/translate_helper.cc

Issue 320513002: Remove base::kInvalidPlatformFileValue from Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/translate/translate_helper.cc
diff --git a/chrome/renderer/translate/translate_helper.cc b/chrome/renderer/translate/translate_helper.cc
index b3c758da84d1bec037903eece349c5d344a3f38c..f29b31ff9007e331b0e7d08ed0c442219559ffdf 100644
--- a/chrome/renderer/translate/translate_helper.cc
+++ b/chrome/renderer/translate/translate_helper.cc
@@ -626,7 +626,8 @@ void TranslateHelper::OnCLDDataAvailable(
const IPC::PlatformFileForTransit ipc_file_handle,
const uint64 data_offset,
const uint64 data_length) {
- LoadCLDDData(ipc_file_handle, data_offset, data_length);
+ LoadCLDDData(IPC::PlatformFileForTransitToFile(ipc_file_handle), data_offset,
+ data_length);
if (deferred_page_capture_ && CLD2::isDataLoaded()) {
deferred_page_capture_ = false; // Don't do this a second time.
PageCaptured(deferred_page_id_, deferred_contents_);
@@ -636,7 +637,7 @@ void TranslateHelper::OnCLDDataAvailable(
}
void TranslateHelper::LoadCLDDData(
- const IPC::PlatformFileForTransit ipc_file_handle,
+ base::File file,
const uint64 data_offset,
const uint64 data_length) {
// Terminate immediately if told to stop polling.
@@ -647,18 +648,14 @@ void TranslateHelper::LoadCLDDData(
if (CLD2::isDataLoaded())
return;
- // Grab the file handle
- base::PlatformFile platform_file =
- IPC::PlatformFileForTransitToPlatformFile(ipc_file_handle);
- if (platform_file == base::kInvalidPlatformFileValue) {
+ if (!file.IsValid()) {
LOG(ERROR) << "Can't find the CLD data file.";
return;
}
- base::File basic_file(platform_file);
// mmap the file
s_cld_mmap_.Get().value = new base::MemoryMappedFile();
- bool initialized = s_cld_mmap_.Get().value->Initialize(basic_file.Pass());
+ bool initialized = s_cld_mmap_.Get().value->Initialize(file.Pass());
if (!initialized) {
LOG(ERROR) << "mmap initialization failed";
delete s_cld_mmap_.Get().value;

Powered by Google App Engine
This is Rietveld 408576698