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

Unified Diff: chrome/browser/metrics/metrics_response.cc

Issue 10834057: Dead code removal: remove MetricsResponse implementation and tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « chrome/browser/metrics/metrics_response.h ('k') | chrome/browser/metrics/metrics_response_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_response.cc
diff --git a/chrome/browser/metrics/metrics_response.cc b/chrome/browser/metrics/metrics_response.cc
deleted file mode 100644
index 71787e2d7206b87d430ad522525e5fdc8913ecfa..0000000000000000000000000000000000000000
--- a/chrome/browser/metrics/metrics_response.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2006-2008 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/browser/metrics/metrics_response.h"
-
-#include "libxml/parser.h"
-
-// State to pass around during SAX parsing.
-struct SAXState {
- int collectors;
- int events;
- int interval;
-};
-
-// libxml uses xmlChar*, which is unsigned char*
-inline const char* Char(const xmlChar* input) {
- return reinterpret_cast<const char*>(input);
-}
-
-static void SAXStartElement(void* user_data,
- const xmlChar* name,
- const xmlChar** attrs) {
- if (!name || !attrs)
- return;
-
- SAXState* state = static_cast<SAXState*>(user_data);
-
- if (strcmp(Char(name), "upload") == 0) {
- for (int i = 0; attrs[i] && attrs[i + i]; i += 2) {
- if (strcmp(Char(attrs[i]), "interval") == 0) {
- state->interval = atoi(Char(attrs[i + 1]));
- return;
- }
- }
- } else if (strcmp(Char(name), "limit") == 0) {
- for (int i = 0; attrs[i] && attrs[i + 1]; i += 2) {
- if (strcmp(Char(attrs[i]), "events") == 0) {
- state->events = atoi(Char(attrs[i + 1]));
- return;
- }
- }
- } else if (strcmp(Char(name), "collector") == 0) {
- for (int i = 0; attrs[i] && attrs[i + 1]; i += 2) {
- if (strcmp(Char(attrs[i]), "type") == 0) {
- const char* type = Char(attrs[i + 1]);
- if (strcmp(type, "document") == 0) {
- state->collectors |= MetricsResponse::COLLECTOR_DOCUMENT;
- } else if (strcmp(type, "profile") == 0) {
- state->collectors |= MetricsResponse::COLLECTOR_PROFILE;
- } else if (strcmp(type, "window") == 0) {
- state->collectors |= MetricsResponse::COLLECTOR_WINDOW;
- } else if (strcmp(type, "ui") == 0) {
- state->collectors |= MetricsResponse::COLLECTOR_UI;
- }
- return;
- }
- }
- }
-}
-
-MetricsResponse::MetricsResponse(const std::string& response_xml)
- : valid_(false),
- collectors_(COLLECTOR_NONE),
- events_(0),
- interval_(0) {
- if (response_xml.empty())
- return;
-
- xmlSAXHandler handler = {0};
- handler.startElement = SAXStartElement;
- SAXState state = {0};
-
- valid_ = !xmlSAXUserParseMemory(&handler, &state,
- response_xml.data(),
- static_cast<int>(response_xml.size()));
-
- collectors_ = state.collectors;
- events_ = state.events;
- interval_ = state.interval;
-}
« no previous file with comments | « chrome/browser/metrics/metrics_response.h ('k') | chrome/browser/metrics/metrics_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698