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

Side by Side Diff: content/plugin/plugin_main_mac.mm

Issue 347783002: Alter the design of the bootstrap sandbox to only take over the bootstrap port of children when nec… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bootstrap_check_in Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 #include <servers/bootstrap.h>
7 6
8 #include "base/environment.h" 7 #include "base/environment.h"
9 #include "base/mac/mach_logging.h"
10 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
12 #include "content/common/plugin_carbon_interpose_constants_mac.h" 10 #include "content/common/plugin_carbon_interpose_constants_mac.h"
13 #include "content/common/sandbox_init_mac.h"
14 #include "content/plugin/plugin_interpose_util_mac.h" 11 #include "content/plugin/plugin_interpose_util_mac.h"
15 #include "content/public/common/content_client.h" 12 #include "content/public/common/content_client.h"
16 13
17 namespace content { 14 namespace content {
18 15
19 #if !defined(__LP64__) 16 #if !defined(__LP64__)
20 void TrimInterposeEnvironment() { 17 void TrimInterposeEnvironment() {
21 scoped_ptr<base::Environment> env(base::Environment::Create()); 18 scoped_ptr<base::Environment> env(base::Environment::Create());
22 19
23 std::string interpose_list; 20 std::string interpose_list;
(...skipping 18 matching lines...) Expand all
42 interpose_list.substr(suffix_offset) == interpose_library_path) { 39 interpose_list.substr(suffix_offset) == interpose_library_path) {
43 std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1); 40 std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1);
44 env->SetVar(kDYLDInsertLibrariesKey, trimmed_list.c_str()); 41 env->SetVar(kDYLDInsertLibrariesKey, trimmed_list.c_str());
45 } else { 42 } else {
46 NOTREACHED() << "Missing Carbon interposing library"; 43 NOTREACHED() << "Missing Carbon interposing library";
47 } 44 }
48 } 45 }
49 #endif 46 #endif
50 47
51 void InitializeChromeApplication() { 48 void InitializeChromeApplication() {
52 // The bootstrap sandbox has taken over the bootstrap port. However, NPAPI
53 // plugins request servers with the BOOTSTRAP_PER_PID_SERVICE flag. This
54 // will fail, since the browser will be forwarding the message on behalf of
55 // the plugin, and the browser has already created these per-pid services
56 // for itself.
57 //
58 // Instead, request the real bootstrap port from the sandbox server, which
59 // can then be used by the plugin.
60 mach_port_t new_bootstrap_port = MACH_PORT_NULL;
61 kern_return_t kr = bootstrap_look_up(bootstrap_port,
62 kBootstrapPortNameForNPAPIPlugins, &new_bootstrap_port);
63 BOOTSTRAP_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
64 << "Failed to look up original bootstrap port.";
65 if (kr == KERN_SUCCESS) {
66 bootstrap_port = new_bootstrap_port;
67 kr = task_set_bootstrap_port(mach_task_self(), new_bootstrap_port);
68 MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
69 << "Failed to reset TASK_BOOTSTRAP_PORT.";
70 }
71
72
73 [NSApplication sharedApplication]; 49 [NSApplication sharedApplication];
74 mac_plugin_interposing::SetUpCocoaInterposing(); 50 mac_plugin_interposing::SetUpCocoaInterposing();
75 } 51 }
76 52
77 } // namespace content 53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698