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

Side by Side Diff: third_party/WebKit/Source/platform/text/CompressibleString.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today Created 4 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/text/CompressibleString.h" 5 #include "platform/text/CompressibleString.h"
6 6
7 #include "public/platform/Platform.h" 7 #include "platform/Histogram.h"
8 #include "wtf/Assertions.h" 8 #include "wtf/Assertions.h"
9 #include "wtf/WTFThreadData.h" 9 #include "wtf/WTFThreadData.h"
10 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class CompressibleStringTable { 14 class CompressibleStringTable {
15 WTF_MAKE_NONCOPYABLE(CompressibleStringTable); 15 WTF_MAKE_NONCOPYABLE(CompressibleStringTable);
16 public: 16 public:
17 static CompressibleStringTable* create(WTFThreadData& data) 17 static CompressibleStringTable* create(WTFThreadData& data)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 enum CompressibleStringCountType { 92 enum CompressibleStringCountType {
93 StringWasCompressedInBackgroundTab, 93 StringWasCompressedInBackgroundTab,
94 StringWasDecompressed, 94 StringWasDecompressed,
95 CompressibleStringCountTypeMax = StringWasDecompressed, 95 CompressibleStringCountTypeMax = StringWasDecompressed,
96 }; 96 };
97 97
98 static void recordCompressibleStringCount(CompressibleStringCountType type) 98 static void recordCompressibleStringCount(CompressibleStringCountType type)
99 { 99 {
100 Platform::current()->histogramEnumeration("Memory.CompressibleStringCount", type, CompressibleStringCountTypeMax + 1); 100 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, sringTypeHistogram, ne w EnumerationHistogram("Memory.CompressibleStringCount", CompressibleStringCount TypeMax + 1));
101 sringTypeHistogram.count(type);
101 } 102 }
102 103
103 // compressString does nothing but collect UMA so far. 104 // compressString does nothing but collect UMA so far.
104 // TODO(hajimehoshi): Implement this. 105 // TODO(hajimehoshi): Implement this.
105 void CompressibleStringImpl::compressString() 106 void CompressibleStringImpl::compressString()
106 { 107 {
107 recordCompressibleStringCount(StringWasCompressedInBackgroundTab); 108 recordCompressibleStringCount(StringWasCompressedInBackgroundTab);
108 ASSERT(!isCompressed()); 109 ASSERT(!isCompressed());
109 m_isCompressed = true; 110 m_isCompressed = true;
110 } 111 }
111 112
112 // decompressString does nothing but collect UMA so far. 113 // decompressString does nothing but collect UMA so far.
113 // TODO(hajimehoshi): Implement this. 114 // TODO(hajimehoshi): Implement this.
114 void CompressibleStringImpl::decompressString() 115 void CompressibleStringImpl::decompressString()
115 { 116 {
116 // TODO(hajimehoshi): We wanted to tell whether decompressing in a 117 // TODO(hajimehoshi): We wanted to tell whether decompressing in a
117 // background tab or a foreground tab, but this was impossible. For example, 118 // background tab or a foreground tab, but this was impossible. For example,
118 // one renderer process of a new tab page is used for multiple tabs. 119 // one renderer process of a new tab page is used for multiple tabs.
119 // Another example is that reloading a page will re-use the process with a 120 // Another example is that reloading a page will re-use the process with a
120 // new Page object and updating a static variable along with reloading will 121 // new Page object and updating a static variable along with reloading will
121 // be complex. See also crbug/581266. We will revisit when the situation 122 // be complex. See also crbug/581266. We will revisit when the situation
122 // changes. 123 // changes.
123 recordCompressibleStringCount(StringWasDecompressed); 124 recordCompressibleStringCount(StringWasDecompressed);
124 ASSERT(isCompressed()); 125 ASSERT(isCompressed());
125 m_isCompressed = false; 126 m_isCompressed = false;
126 } 127 }
127 128
128 } // namespace blink 129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698