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

Unified Diff: sync/util/get_session_name_mac.mm

Issue 10827126: mac: Don't use |NSHost currentHost|, as it takes 4s per test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/util/get_session_name_mac.mm
diff --git a/sync/util/get_session_name_mac.mm b/sync/util/get_session_name_mac.mm
index e7d29c46210d264d867ca4db58e28077292b40db..b8eb25e3e94d12f3842699e11211c793f2d7c22c 100644
--- a/sync/util/get_session_name_mac.mm
+++ b/sync/util/get_session_name_mac.mm
@@ -4,23 +4,22 @@
#include "sync/util/get_session_name_mac.h"
-#import <Foundation/Foundation.h>
#import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
-#include <sys/sysctl.h> // sysctlbyname()
-#include "base/mac/foundation_util.h"
-#include "base/mac/mac_util.h"
-#include "base/memory/scoped_nsobject.h"
-#include "base/string_util.h"
-#include "base/sys_info.h"
+#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
namespace syncer {
namespace internal {
std::string GetHardwareModelName() {
- NSHost* myHost = [NSHost currentHost];
- return base::SysNSStringToUTF8([myHost localizedName]);
+ // Do not use NSHost currentHost, as it's very slow. http://crbug.com/138570
+ SCDynamicStoreContext context = { 0, NULL, NULL, NULL };
+ base::mac::ScopedCFTypeRef<SCDynamicStoreRef> store(
+ SCDynamicStoreCreate(kCFAllocatorDefault, CFSTR("policy_subsystem"),
+ NULL, &context));
+ CFStringRef machine_name = SCDynamicStoreCopyLocalHostName(store.get());
+ return base::SysCFStringRefToUTF8(machine_name);
}
} // namespace internal
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698