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

Unified Diff: mojo/services/test_service/test_request_tracker_impl.cc

Issue 687433002: Remove mojo/shell and (most) service implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove mojo/gles2, disable mojo apps in component build Created 6 years, 2 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
Index: mojo/services/test_service/test_request_tracker_impl.cc
diff --git a/mojo/services/test_service/test_request_tracker_impl.cc b/mojo/services/test_service/test_request_tracker_impl.cc
deleted file mode 100644
index 9af6266a7786e5f83c096f5659e5a5b47c4815a5..0000000000000000000000000000000000000000
--- a/mojo/services/test_service/test_request_tracker_impl.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2014 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 "base/bind.h"
-#include "mojo/services/test_service/test_request_tracker_impl.h"
-
-namespace mojo {
-namespace test {
-
- TrackingContext::TrackingContext() : next_id(1) {}
- TrackingContext::~TrackingContext() {}
-
- TestRequestTrackerImpl::TestRequestTrackerImpl(TrackingContext* context)
- : context_(context), weak_factory_(this) {
- }
-
- TestRequestTrackerImpl::~TestRequestTrackerImpl() {
- }
-
-void TestRequestTrackerImpl::RecordStats(
- uint64_t client_id,
- ServiceStatsPtr stats) {
- assert(context_->ids_to_names.find(client_id) !=
- context_->ids_to_names.end());
- context_->records[client_id].push_back(*stats);
-}
-
-void TestRequestTrackerImpl::OnConnectionEstablished() {
- uint64_t id = context_->next_id++;
- client()->SetIdAndReturnName(id,
- base::Bind(&TestRequestTrackerImpl::UploaderNameCallback,
- weak_factory_.GetWeakPtr(),
- id));
-}
-
-void TestRequestTrackerImpl::UploaderNameCallback(
- uint64_t id, const mojo::String& name) {
- DCHECK(context_->ids_to_names.find(id) == context_->ids_to_names.end());
- context_->ids_to_names[id] = name;
-}
-
-TestTrackedRequestServiceImpl::TestTrackedRequestServiceImpl(
- TrackingContext* context)
- : context_(context) {
-}
-
-TestTrackedRequestServiceImpl::~TestTrackedRequestServiceImpl() {
-}
-
-void TestTrackedRequestServiceImpl::GetReport(
- const mojo::Callback<void(mojo::Array<ServiceReportPtr>)>& callback) {
- mojo::Array<ServiceReportPtr> reports;
- for (AllRecordsMap::const_iterator it1 = context_->records.begin();
- it1 != context_->records.end(); ++it1) {
- ServiceReportPtr report(ServiceReport::New());
- report->service_name = context_->ids_to_names[it1->first];
- double mean_health_numerator = 0;
- size_t num_samples = it1->second.size();
- if (num_samples == 0)
- continue;
-
- for (std::vector<ServiceStats>::const_iterator it2 = it1->second.begin();
- it2 != it1->second.end(); ++it2) {
- report->total_requests += it2->num_new_requests;
- mean_health_numerator += it2->health;
- }
- report->mean_health = mean_health_numerator / num_samples;
- reports.push_back(report.Pass());
- }
- callback.Run(reports.Pass());
-}
-
-} // namespace test
-} // namespace mojo
« no previous file with comments | « mojo/services/test_service/test_request_tracker_impl.h ('k') | mojo/services/test_service/test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698