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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // renderer process. This is needed because renderer processes on | 740 // renderer process. This is needed because renderer processes on |
741 // Windows 8+ may be running in an AppContainer sandbox and hence their | 741 // Windows 8+ may be running in an AppContainer sandbox and hence their |
742 // kernel object namespace may be partitioned. | 742 // kernel object namespace may be partitioned. |
743 std::string name(content::kFontCacheSharedSectionName); | 743 std::string name(content::kFontCacheSharedSectionName); |
744 name.append(base::UintToString(base::GetCurrentProcId())); | 744 name.append(base::UintToString(base::GetCurrentProcId())); |
745 | 745 |
746 base::SharedMemory direct_write_font_cache_section; | 746 base::SharedMemory direct_write_font_cache_section; |
747 if (direct_write_font_cache_section.Open(name, true)) { | 747 if (direct_write_font_cache_section.Open(name, true)) { |
748 void* shared_handle = policy->AddHandleToShare( | 748 void* shared_handle = policy->AddHandleToShare( |
749 direct_write_font_cache_section.handle().GetHandle()); | 749 direct_write_font_cache_section.handle().GetHandle()); |
750 cmd_line->AppendSwitchASCII(switches::kFontCacheSharedHandle, | 750 // Cast through uintptr_t and then unsigned int to make the truncation |
751 base::UintToString(reinterpret_cast<unsigned int>(shared_handle))); | 751 // explicit. Handles are size-of-pointer but are always 32-bit values. |
| 752 cmd_line->AppendSwitchASCII( |
| 753 switches::kFontCacheSharedHandle, |
| 754 base::UintToString(static_cast<unsigned int>( |
| 755 reinterpret_cast<uintptr_t>(shared_handle)))); |
752 } | 756 } |
753 } | 757 } |
754 } | 758 } |
755 #endif | 759 #endif |
756 | 760 |
757 if (type_str != switches::kRendererProcess) { | 761 if (type_str != switches::kRendererProcess) { |
758 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 762 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
759 // this subprocess. See | 763 // this subprocess. See |
760 // http://code.google.com/p/chromium/issues/detail?id=25580 | 764 // http://code.google.com/p/chromium/issues/detail?id=25580 |
761 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 765 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 } | 881 } |
878 | 882 |
879 return false; | 883 return false; |
880 } | 884 } |
881 | 885 |
882 bool BrokerAddTargetPeer(HANDLE peer_process) { | 886 bool BrokerAddTargetPeer(HANDLE peer_process) { |
883 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 887 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
884 } | 888 } |
885 | 889 |
886 } // namespace content | 890 } // namespace content |
OLD | NEW |