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

Unified Diff: webkit/support/test_webkit_platform_support.cc

Issue 12259025: Linux: apply a different hyphen patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 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 side-by-side diff with in-line comments
Download patch
« third_party/hyphen/hyphen.c ('K') | « third_party/hyphen/hyphen.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/test_webkit_platform_support.cc
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index 16a05ce6b2c1cc6865e2f734aa4c7008a398aae4..9e53dcb7dd5d8fcab56f147a41ab603936476ab9 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/memory/scoped_handle.h"
#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -486,12 +487,18 @@ size_t TestWebKitPlatformSupport::computeLastHyphenLocation(
// flakiness, this code synchronously loads the dictionary.
base::FilePath path = webkit_support::GetChromiumRootDirFilePath();
path = path.Append(FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic"));
- std::string dictionary;
- if (!file_util::ReadFileToString(path, &dictionary))
+ base::PlatformFile dict_file = base::CreatePlatformFile(
+ path,
+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
+ NULL, NULL);
+ if (dict_file == base::kInvalidPlatformFileValue)
return 0;
- hyphen_dictionary_ = hnj_hyphen_load(
- reinterpret_cast<const unsigned char*>(dictionary.data()),
- dictionary.length());
+ ScopedStdioHandle dict_handle(base::FdopenPlatformFile(dict_file, "r"));
+ if (!dict_handle.get()) {
+ base::ClosePlatformFile(dict_file);
+ return 0;
+ }
+ hyphen_dictionary_ = hnj_hyphen_load_file(dict_handle.get());
if (!hyphen_dictionary_)
return 0;
}
« third_party/hyphen/hyphen.c ('K') | « third_party/hyphen/hyphen.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698