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

Unified Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 356893002: Add UMA for --app-shim-error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/mac/app_mode_common.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_mac.mm
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index 02f3f0dc7c14ead4c29c6e2e6b3ff23c5122760f..862c19f1e67aa4404cdf26a43c4b92085649d614 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -16,6 +16,7 @@
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsobject.h"
+#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "base/strings/string16.h"
@@ -57,6 +58,17 @@ namespace {
// Launch Services Key to run as an agent app, which doesn't launch in the dock.
NSString* const kLSUIElement = @"LSUIElement";
+// When a --app-shim-error is triggered, this is used to record the version of
+// the app shim. These are chosen to track the change from 32-bit to 64-bit.
+// Order must be maintained as this is used in UMA.
+enum AppShimError {
+ APP_SHIM_ERROR_UNKNOWN,
+ APP_SHIM_ERROR_37_OR_LOWER,
+ APP_SHIM_ERROR_38,
+ APP_SHIM_ERROR_39_OR_HIGHER,
+ APP_SHIM_ERROR_COUNT,
+};
+
class ScopedCarbonHandle {
public:
ScopedCarbonHandle(size_t initial_size) : handle_(NewHandle(initial_size)) {
@@ -496,6 +508,27 @@ web_app::ShortcutInfo BuildShortcutInfoFromBundle(
return shortcut_info;
}
+web_app::ShortcutInfo RecordAppShimErrorAndBuildShortcutInfo(
+ const base::FilePath& bundle_path) {
+ NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
+ int version = [[[[plist valueForKey:app_mode::kCFBundleShortVersionStringKey]
Robert Sesek 2014/07/01 14:10:39 May want to use base/version.h.
jackhou1 2014/07/02 03:18:12 Done.
+ componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
+ AppShimError error_enum;
+ if (version < 38)
tapted 2014/07/01 12:48:11 probably needs `version > 0 &&..` here so the unkn
jackhou1 2014/07/02 03:18:12 Done.
+ error_enum = APP_SHIM_ERROR_37_OR_LOWER;
+ else if (version == 38)
+ error_enum = APP_SHIM_ERROR_38;
+ else if (version > 38)
+ error_enum = APP_SHIM_ERROR_39_OR_HIGHER;
+ else
+ error_enum = APP_SHIM_ERROR_UNKNOWN;
+ UMA_HISTOGRAM_ENUMERATION("Apps.AppShimError",
Robert Sesek 2014/07/01 14:10:39 Would it make more sense to just histogram the |ve
jackhou1 2014/07/02 03:18:11 Done.
+ error_enum,
+ APP_SHIM_ERROR_COUNT);
+
+ return BuildShortcutInfoFromBundle(bundle_path);
+}
+
void UpdateFileTypes(NSMutableDictionary* plist,
const extensions::FileHandlersInfo& file_handlers_info) {
NSMutableArray* document_types =
@@ -939,7 +972,7 @@ bool MaybeRebuildShortcut(const CommandLine& command_line) {
base::PostTaskAndReplyWithResult(
content::BrowserThread::GetBlockingPool(),
FROM_HERE,
- base::Bind(&BuildShortcutInfoFromBundle,
+ base::Bind(&RecordAppShimErrorAndBuildShortcutInfo,
command_line.GetSwitchValuePath(app_mode::kAppShimError)),
base::Bind(&RebuildAppAndLaunch));
return true;
« no previous file with comments | « no previous file | chrome/common/mac/app_mode_common.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698