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

Unified Diff: content/common/dwrite_font_platform_win.cc

Issue 1320783002: Make SharedMemoryHandle a class on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_global
Patch Set: Rebase. Created 5 years, 3 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: content/common/dwrite_font_platform_win.cc
diff --git a/content/common/dwrite_font_platform_win.cc b/content/common/dwrite_font_platform_win.cc
index f2b4bd93b6043f4e0dadd5db27c8b9cc3e4b4540..033a8e63f242fb6b0b09b5ad47b03e6ccfa92ed5 100644
--- a/content/common/dwrite_font_platform_win.cc
+++ b/content/common/dwrite_font_platform_win.cc
@@ -7,6 +7,7 @@
#include <windows.h>
#include <dwrite.h>
+#include <limits>
#include <map>
#include <string>
#include <utility>
@@ -937,10 +938,13 @@ bool FontCollectionLoader::LoadCacheFile() {
if (font_cache_handle_string.empty())
return false;
- base::SharedMemoryHandle font_cache_handle = NULL;
- base::StringToUint(font_cache_handle_string,
- reinterpret_cast<unsigned int*>(&font_cache_handle));
- DCHECK(font_cache_handle);
+ unsigned int handle_uint;
+ base::StringToUint(font_cache_handle_string, &handle_uint);
+ DCHECK(handle_uint);
+ if (handle_uint > static_cast<unsigned int>(std::numeric_limits<long>::max()))
+ return false;
+ base::SharedMemoryHandle font_cache_handle(LongToHandle(handle_uint),
+ base::GetCurrentProcId());
base::SharedMemory* shared_mem = new base::SharedMemory(
font_cache_handle, true);
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/common/gpu/client/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698