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

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: Change to reading the plist. 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..bf14ded30c10b0bdae95fe40575a96a6185df801 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,16 @@ 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.
tapted 2014/07/01 05:53:58 nit: mention that buckets are chosen to track the
jackhou1 2014/07/01 07:37:51 Done.
+// Order must be maintained as this is used in UMA.
+enum AppShimError {
+ 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 +507,25 @@ 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]
+ componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
tapted 2014/07/01 05:53:59 since we're rebuilding a possibly corrupt shim.. p
jackhou1 2014/07/01 07:37:51 Done. I tried breaking the field in various ways
+ int error_enum;
tapted 2014/07/01 05:53:58 int -> AppShimError?
jackhou1 2014/07/01 07:37:51 Done.
+ if (version < 38)
+ error_enum = APP_SHIM_ERROR_37_OR_LOWER;
+ else if (version == 38)
+ error_enum = APP_SHIM_ERROR_38;
+ else
+ error_enum = APP_SHIM_ERROR_39_OR_HIGHER;
+ UMA_HISTOGRAM_ENUMERATION("Apps.AppShimError",
+ 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 +969,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