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

Unified Diff: chrome/common/mac/mock_launchd.cc

Issue 982883003: Use fixed socket name instead of SecureSocketWithKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed histogram Created 5 years, 9 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: chrome/common/mac/mock_launchd.cc
diff --git a/chrome/common/mac/mock_launchd.cc b/chrome/common/mac/mock_launchd.cc
index e463733e26d032ae4b51a6a6034e85e2c4139e74..8aebf44b98a01d12855585cc6d5608daa8a3a7b0 100644
--- a/chrome/common/mac/mock_launchd.cc
+++ b/chrome/common/mac/mock_launchd.cc
@@ -97,6 +97,7 @@ MockLaunchd::MockLaunchd(const base::FilePath& file,
bool create_socket,
bool as_service)
: file_(file),
+ pipe_name_(GetServiceProcessChannel().name),
message_loop_(loop),
create_socket_(create_socket),
as_service_(as_service),
@@ -105,40 +106,11 @@ MockLaunchd::MockLaunchd(const base::FilePath& file,
checkin_called_(false),
write_called_(false),
delete_called_(false) {
- std::string pipe_suffix("_SOCKET");
- base::FilePath socket_path = file_;
- while (socket_path.value().length() + pipe_suffix.length() >
- kMaxPipeNameLength - 2) {
- socket_path = socket_path.DirName();
- }
- pipe_name_ = socket_path.value() + pipe_suffix;
}
MockLaunchd::~MockLaunchd() {
}
-CFDictionaryRef MockLaunchd::CopyExports() {
- if (!create_socket_) {
- ADD_FAILURE();
- return NULL;
- }
-
- CFStringRef env_var =
- base::mac::NSToCFCast(GetServiceProcessLaunchDSocketEnvVar());
- base::ScopedCFTypeRef<CFStringRef> socket_path(CFStringCreateWithCString(
- kCFAllocatorDefault, pipe_name_.c_str(), kCFStringEncodingUTF8));
- const void *keys[] = { env_var };
- const void *values[] = { socket_path };
- static_assert(arraysize(keys) == arraysize(values),
- "keys must have the same number of elements as values");
- return CFDictionaryCreate(kCFAllocatorDefault,
- keys,
- values,
- arraysize(keys),
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-}
-
CFDictionaryRef MockLaunchd::CopyJobDictionary(CFStringRef label) {
if (!as_service_) {
scoped_ptr<MultiProcessLock> running_lock(

Powered by Google App Engine
This is Rietveld 408576698