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

Unified Diff: apps/app_shim/app_shim_host_manager_mac.mm

Issue 66043003: Put app shim IPC socket in a temporary directory. (Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always use short socket path Created 7 years, 1 month 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: apps/app_shim/app_shim_host_manager_mac.mm
diff --git a/apps/app_shim/app_shim_host_manager_mac.mm b/apps/app_shim/app_shim_host_manager_mac.mm
index eeaa114adea0e03b5921483ca98379a4ffeee43b..d509fa1f30ab6d6da8a397f473216c83ce8799b0 100644
--- a/apps/app_shim/app_shim_host_manager_mac.mm
+++ b/apps/app_shim/app_shim_host_manager_mac.mm
@@ -15,7 +15,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/mac/app_mode_common.h"
-#include "ipc/unix_domain_socket_util.h"
using content::BrowserThread;
@@ -28,8 +27,6 @@ void CreateAppShimHost(const IPC::ChannelHandle& handle) {
} // namespace
-const base::FilePath* AppShimHostManager::g_override_user_data_dir_ = NULL;
-
AppShimHostManager::AppShimHostManager() {}
void AppShimHostManager::Init() {
@@ -47,24 +44,19 @@ AppShimHostManager::~AppShimHostManager() {
void AppShimHostManager::InitOnFileThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::FilePath user_data_dir;
- if (g_override_user_data_dir_) {
- user_data_dir = *g_override_user_data_dir_;
- } else if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
+ if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
LOG(ERROR) << "Couldn't get user data directory while creating App Shim "
tapted 2013/11/21 11:12:05 while we are here.. let's ditch this LOG and just
jackhou1 2013/11/22 00:20:40 Done.
<< "Host manager.";
return;
}
- base::FilePath socket_path =
+ // The socket cannot be created if its path is longer than 128 chars
+ // (IPC::kMaxSocketNameLength). To circumvent this, we use a short path in
+ // /tmp/ that is generated from a hash of the user data dir.
+ base::FilePath udd_plus_socket_name =
user_data_dir.Append(app_mode::kAppShimSocketName);
- // This mirrors a check in unix_domain_socket_util.cc which will guarantee
- // failure and spam log files on bots because they have deeply nested paths to
- // |user_data_dir| when swarming. See http://crbug.com/240554. Shim tests that
- // run on the bots must override the path using AppShimHostManagerTestApi.
- if (socket_path.value().length() >= IPC::kMaxSocketNameLength &&
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
- return;
- }
+ base::FilePath socket_path =
+ app_mode::GetShortSocketPath(udd_plus_socket_name);
tapted 2013/11/21 11:12:05 Ah, so this is just /tmp/TWFuIGlzIGRpc3Rpbm which
jackhou1 2013/11/22 00:20:40 Yeah, I think this is a good idea. I've changed th
factory_.reset(new IPC::ChannelFactory(socket_path, this));
BrowserThread::PostTask(

Powered by Google App Engine
This is Rietveld 408576698