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

Unified Diff: content/common/sandbox_win.cc

Issue 1122163002: Ensure that the DirectWrite font cache works in Chrome canary on Windows 8+ with AppContainer prote… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted changes to shared memory Created 5 years, 7 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
« no previous file with comments | « content/common/dwrite_font_platform_win.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 8398b798d06080dd6cd0e9281ad07005c95b49a8..91f81c3a43942aab98268c943a5dc828a6470b54 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -11,9 +11,11 @@
#include "base/debug/profiler.h"
#include "base/files/file_util.h"
#include "base/hash.h"
+#include "base/memory/shared_memory.h"
#include "base/metrics/sparse_histogram.h"
#include "base/path_service.h"
#include "base/process/launch.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
@@ -24,6 +26,7 @@
#include "content/common/content_switches_internal.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/dwrite_font_platform_win.h"
#include "content/public/common/sandbox_init.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "sandbox/win/src/process_mitigations.h"
@@ -677,6 +680,22 @@ base::Process StartSandboxedProcess(
true,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
policy);
+
+ // If DirectWrite is enabled for font rendering then open the font cache
+ // section which is created by the browser and pass the handle to the
+ // renderer process. This is needed because renderer processes on
+ // Windows 8+ may be running in an AppContainer sandbox and hence their
+ // kernel object namespace may be partitioned.
+ std::string name(content::kFontCacheSharedSectionName);
+ name.append(base::UintToString(base::GetCurrentProcId()));
+
+ base::SharedMemory direct_write_font_cache_section;
+ if (direct_write_font_cache_section.Open(name, true)) {
+ HANDLE shared_handle =
cpu_(ooo_6.6-7.5) 2015/05/08 03:03:24 use void*, we don't want future coder to try to cl
ananta 2015/05/08 19:08:19 Done.
+ policy->AddHandleToShare(direct_write_font_cache_section.handle());
+ cmd_line->AppendSwitchASCII(switches::kFontCacheSharedHandle,
+ base::UintToString(reinterpret_cast<unsigned int>(shared_handle)));
+ }
}
cpu_(ooo_6.6-7.5) 2015/05/08 03:03:24 is this code working? after the renderer process i
ananta 2015/05/08 04:10:18 The shared section is created by the browser via a
#endif
} else {
« no previous file with comments | « content/common/dwrite_font_platform_win.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698