OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 #if !defined(NACL_WIN64) | 731 #if !defined(NACL_WIN64) |
732 if (type_str == switches::kRendererProcess || | 732 if (type_str == switches::kRendererProcess || |
733 type_str == switches::kPpapiPluginProcess) { | 733 type_str == switches::kPpapiPluginProcess) { |
734 if (gfx::win::ShouldUseDirectWrite()) { | 734 if (gfx::win::ShouldUseDirectWrite()) { |
735 AddDirectory(base::DIR_WINDOWS_FONTS, | 735 AddDirectory(base::DIR_WINDOWS_FONTS, |
736 NULL, | 736 NULL, |
737 true, | 737 true, |
738 sandbox::TargetPolicy::FILES_ALLOW_READONLY, | 738 sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
739 policy); | 739 policy); |
740 | 740 |
741 // If DirectWrite is enabled for font rendering then open the font cache | 741 if (!content::ShouldUseDirectWriteFontProxyFieldTrial()) { |
jam
2016/01/11 05:05:45
ditto
Ilya Kulshin
2016/01/11 20:56:52
Done.
| |
742 // section which is created by the browser and pass the handle to the | 742 // If DirectWrite is enabled for font rendering then open the font |
743 // renderer process. This is needed because renderer processes on | 743 // cache section which is created by the browser and pass the handle to |
744 // Windows 8+ may be running in an AppContainer sandbox and hence their | 744 // the renderer process. This is needed because renderer processes on |
745 // kernel object namespace may be partitioned. | 745 // Windows 8+ may be running in an AppContainer sandbox and hence their |
746 std::string name(content::kFontCacheSharedSectionName); | 746 // kernel object namespace may be partitioned. |
747 name.append(base::UintToString(base::GetCurrentProcId())); | 747 std::string name(content::kFontCacheSharedSectionName); |
748 name.append(base::UintToString(base::GetCurrentProcId())); | |
748 | 749 |
749 base::SharedMemory direct_write_font_cache_section; | 750 base::SharedMemory direct_write_font_cache_section; |
750 if (direct_write_font_cache_section.Open(name, true)) { | 751 if (direct_write_font_cache_section.Open(name, true)) { |
751 void* shared_handle = policy->AddHandleToShare( | 752 void* shared_handle = policy->AddHandleToShare( |
752 direct_write_font_cache_section.handle().GetHandle()); | 753 direct_write_font_cache_section.handle().GetHandle()); |
753 cmd_line->AppendSwitchASCII( | 754 cmd_line->AppendSwitchASCII( |
754 switches::kFontCacheSharedHandle, | 755 switches::kFontCacheSharedHandle, |
755 base::UintToString(base::win::HandleToUint32(shared_handle))); | 756 base::UintToString(base::win::HandleToUint32(shared_handle))); |
757 } | |
756 } | 758 } |
757 } | 759 } |
758 } | 760 } |
759 #endif | 761 #endif |
760 | 762 |
761 if (type_str != switches::kRendererProcess) { | 763 if (type_str != switches::kRendererProcess) { |
762 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 764 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
763 // this subprocess. See | 765 // this subprocess. See |
764 // http://code.google.com/p/chromium/issues/detail?id=25580 | 766 // http://code.google.com/p/chromium/issues/detail?id=25580 |
765 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 767 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 } | 859 } |
858 | 860 |
859 return false; | 861 return false; |
860 } | 862 } |
861 | 863 |
862 bool BrokerAddTargetPeer(HANDLE peer_process) { | 864 bool BrokerAddTargetPeer(HANDLE peer_process) { |
863 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
864 } | 866 } |
865 | 867 |
866 } // namespace content | 868 } // namespace content |
OLD | NEW |