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

Unified Diff: chrome/app/breakpad_field_trial_win.cc

Issue 9432033: Add experiments info to crash dumps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Last Few Nits Created 8 years, 8 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 | « chrome/app/breakpad_field_trial_win.h ('k') | chrome/app/breakpad_unittest_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/breakpad_field_trial_win.cc
===================================================================
--- chrome/app/breakpad_field_trial_win.cc (revision 0)
+++ chrome/app/breakpad_field_trial_win.cc (revision 0)
@@ -0,0 +1,71 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/app/breakpad_field_trial_win.h"
+
+#include "base/lazy_instance.h"
+#include "base/string_util.h"
+#include "base/string16.h"
+#include "base/stringprintf.h"
+#include "breakpad/src/client/windows/common/ipc_protocol.h"
+#include "chrome/app/breakpad_win.h"
+#include "chrome/common/child_process_logging.h"
+
+extern "C" void __declspec(dllexport) __cdecl SetExperimentList(
+ const std::vector<string16>& experiment_strings) {
+ // Make sure we were initialized before we start writing data
+ if (breakpad_win::g_experiment_chunks_offset == 0)
+ return;
+
+ size_t num_chunks = 0;
+ size_t current_experiment = 0;
+ string16 current_chunk(google_breakpad::CustomInfoEntry::kValueMaxLength, 0);
+ while (current_experiment < experiment_strings.size() &&
+ num_chunks < kMaxReportedExperimentChunks) {
+ // Check if we have enough room to add another experiment to the current
+ // chunk string. If not, we commit the current chunk string and start over.
+ if (current_chunk.size() + experiment_strings[current_experiment].size() >
+ google_breakpad::CustomInfoEntry::kValueMaxLength) {
+ base::wcslcpy(
+ (*breakpad_win::g_custom_entries)[
+ breakpad_win::g_experiment_chunks_offset + num_chunks].value,
+ current_chunk.c_str(),
+ current_chunk.size() + 1); // This must include the NULL termination.
+ ++num_chunks;
+ current_chunk = experiment_strings[current_experiment];
+ } else {
+ if (!current_chunk.empty())
+ current_chunk += L",";
+ current_chunk += experiment_strings[current_experiment];
+ }
+ ++current_experiment;
+ }
+
+ // Commit the last chunk that didn't get big enough yet.
+ if (!current_chunk.empty() && num_chunks < kMaxReportedExperimentChunks) {
+ base::wcslcpy(
+ (*breakpad_win::g_custom_entries)[
+ breakpad_win::g_experiment_chunks_offset + num_chunks].value,
+ current_chunk.c_str(),
+ current_chunk.size() + 1); // This must include the NULL termination.
+ }
+
+ // Make note of the total number of experiments,
+ // even if it's > kMaxReportedExperimentChunks. This is useful when
+ // correlating stability with the number of experiments running
+ // simultaneously.
+ base::wcslcpy(
+ (*breakpad_win::g_custom_entries)[
+ breakpad_win::g_num_of_experiments_offset].value,
+ base::StringPrintf(L"%d", experiment_strings.size()).c_str(),
+ google_breakpad::CustomInfoEntry::kValueMaxLength);
+}
+
+namespace testing {
+
+void SetExperimentList(const std::vector<string16>& experiment_strings) {
+ ::SetExperimentList(experiment_strings);
+}
+
+} // namespace testing
Property changes on: chrome\app\breakpad_field_trial_win.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/app/breakpad_field_trial_win.h ('k') | chrome/app/breakpad_unittest_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698