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

Side by Side Diff: media/blink/url_index.cc

Issue 2983733002: media: Add UMA stats for bytes going in and out of multibuffer cache (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/metrics/histogram_macros.h"
10 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "media/blink/resource_multibuffer_data_provider.h" 14 #include "media/blink/resource_multibuffer_data_provider.h"
14 #include "media/blink/url_index.h" 15 #include "media/blink/url_index.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 const int kBlockSizeShift = 15; // 1<<15 == 32kb 19 const int kBlockSizeShift = 15; // 1<<15 == 32kb
19 const int kUrlMappingTimeoutSeconds = 300; 20 const int kUrlMappingTimeoutSeconds = 300;
(...skipping 27 matching lines...) Expand all
47 have_data_origin_(false), 48 have_data_origin_(false),
48 cors_mode_(cors_mode), 49 cors_mode_(cors_mode),
49 url_index_(url_index), 50 url_index_(url_index),
50 length_(kPositionNotSpecified), 51 length_(kPositionNotSpecified),
51 range_supported_(false), 52 range_supported_(false),
52 cacheable_(false), 53 cacheable_(false),
53 last_used_(), 54 last_used_(),
54 multibuffer_(this, url_index_->block_shift_), 55 multibuffer_(this, url_index_->block_shift_),
55 frame_(url_index->frame()) {} 56 frame_(url_index->frame()) {}
56 57
57 UrlData::~UrlData() {} 58 UrlData::~UrlData() {
59 UMA_HISTOGRAM_MEMORY_KB("Media.BytesReadFromCache",
60 BytesReadFromCache() >> 10);
61 UMA_HISTOGRAM_MEMORY_KB("Media.BytesReadFromNetwork",
62 BytesReadFromNetwork() >> 10);
63 }
58 64
59 std::pair<GURL, UrlData::CORSMode> UrlData::key() const { 65 std::pair<GURL, UrlData::CORSMode> UrlData::key() const {
60 DCHECK(thread_checker_.CalledOnValidThread()); 66 DCHECK(thread_checker_.CalledOnValidThread());
61 return std::make_pair(url(), cors_mode()); 67 return std::make_pair(url(), cors_mode());
62 } 68 }
63 69
64 void UrlData::set_valid_until(base::Time valid_until) { 70 void UrlData::set_valid_until(base::Time valid_until) {
65 DCHECK(thread_checker_.CalledOnValidThread()); 71 DCHECK(thread_checker_.CalledOnValidThread());
66 valid_until_ = valid_until; 72 valid_until_ = valid_until;
67 } 73 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 url_data->CachedSize() > (*by_url_slot)->CachedSize())) { 285 url_data->CachedSize() > (*by_url_slot)->CachedSize())) {
280 *by_url_slot = url_data; 286 *by_url_slot = url_data;
281 } else { 287 } else {
282 (*by_url_slot)->MergeFrom(url_data); 288 (*by_url_slot)->MergeFrom(url_data);
283 } 289 }
284 } 290 }
285 return *by_url_slot; 291 return *by_url_slot;
286 } 292 }
287 293
288 } // namespace media 294 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698