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

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..9a9694be9f0e056f3aa0d3d51f239c968ffaaf67 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"
@@ -24,6 +25,7 @@
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/version.h"
#include "chrome/browser/browser_process.h"
#import "chrome/browser/mac/dock.h"
#include "chrome/browser/browser_process.h"
@@ -57,6 +59,11 @@ 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, we record the version of the app shim.
+// This is the number of buckets in the UMA histogram, i.e. the highest version
+// we can track plus 1.
+const int kAppShimErrorVersionMax = 51;
Robert Sesek 2014/07/02 14:53:51 FYI Chrome 51 will ship in December 2015/January 2
+
class ScopedCarbonHandle {
public:
ScopedCarbonHandle(size_t initial_size) : handle_(NewHandle(initial_size)) {
@@ -496,6 +503,21 @@ web_app::ShortcutInfo BuildShortcutInfoFromBundle(
return shortcut_info;
}
+web_app::ShortcutInfo RecordAppShimErrorAndBuildShortcutInfo(
+ const base::FilePath& bundle_path) {
+ NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
+ base::Version full_version(base::SysNSStringToUTF8(
+ [plist valueForKey:app_mode::kCFBundleShortVersionStringKey]));
+ int major_version = 0;
+ if (full_version.IsValid())
+ major_version = full_version.components()[0];
+ UMA_HISTOGRAM_ENUMERATION("Apps.AppShimErrorVersion",
+ major_version,
+ kAppShimErrorVersionMax);
Alexei Svitkine (slow) 2014/07/04 12:49:24 I suggest using UMA_HISTOGRAM_SPARSE_SLOWLY() inst
jackhou1 2014/07/07 05:38:36 Done.
+
+ return BuildShortcutInfoFromBundle(bundle_path);
+}
+
void UpdateFileTypes(NSMutableDictionary* plist,
const extensions::FileHandlersInfo& file_handlers_info) {
NSMutableArray* document_types =
@@ -939,7 +961,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