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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2137483003: Add UMA metrics for root scroller intervention to track forcing passive breakage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use HistogramTester Created 4 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #include "platform/Language.h" 131 #include "platform/Language.h"
132 #include "platform/PlatformKeyboardEvent.h" 132 #include "platform/PlatformKeyboardEvent.h"
133 #include "platform/RuntimeEnabledFeatures.h" 133 #include "platform/RuntimeEnabledFeatures.h"
134 #include "platform/TraceEvent.h" 134 #include "platform/TraceEvent.h"
135 #include "platform/geometry/IntRect.h" 135 #include "platform/geometry/IntRect.h"
136 #include "platform/geometry/LayoutRect.h" 136 #include "platform/geometry/LayoutRect.h"
137 #include "platform/graphics/GraphicsLayer.h" 137 #include "platform/graphics/GraphicsLayer.h"
138 #include "platform/heap/Handle.h" 138 #include "platform/heap/Handle.h"
139 #include "platform/inspector_protocol/FrontendChannel.h" 139 #include "platform/inspector_protocol/FrontendChannel.h"
140 #include "platform/scroll/ProgrammaticScrollAnimator.h" 140 #include "platform/scroll/ProgrammaticScrollAnimator.h"
141 #include "platform/testing/HistogramTester.h"
141 #include "platform/weborigin/SchemeRegistry.h" 142 #include "platform/weborigin/SchemeRegistry.h"
142 #include "public/platform/Platform.h" 143 #include "public/platform/Platform.h"
143 #include "public/platform/WebConnectionType.h" 144 #include "public/platform/WebConnectionType.h"
144 #include "public/platform/WebGraphicsContext3DProvider.h" 145 #include "public/platform/WebGraphicsContext3DProvider.h"
145 #include "public/platform/WebLayer.h" 146 #include "public/platform/WebLayer.h"
146 #include "wtf/InstanceCounter.h" 147 #include "wtf/InstanceCounter.h"
147 #include "wtf/PtrUtil.h" 148 #include "wtf/PtrUtil.h"
148 #include "wtf/dtoa.h" 149 #include "wtf/dtoa.h"
149 #include "wtf/text/StringBuffer.h" 150 #include "wtf/text/StringBuffer.h"
150 #include <deque> 151 #include <deque>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 Internals* Internals::create(ScriptState* scriptState) 215 Internals* Internals::create(ScriptState* scriptState)
215 { 216 {
216 return new Internals(scriptState); 217 return new Internals(scriptState);
217 } 218 }
218 219
219 Internals::~Internals() 220 Internals::~Internals()
220 { 221 {
221 } 222 }
222 223
223 static RuntimeEnabledFeatures::Backup* sFeaturesBackup = nullptr; 224 static RuntimeEnabledFeatures::Backup* sFeaturesBackup = nullptr;
225 static std::unique_ptr<HistogramTester> sHistogramSnapshot;
224 226
225 void Internals::resetToConsistentState(Page* page) 227 void Internals::resetToConsistentState(Page* page)
226 { 228 {
227 ASSERT(page); 229 ASSERT(page);
228 230
229 if (!sFeaturesBackup) 231 if (!sFeaturesBackup)
230 sFeaturesBackup = new RuntimeEnabledFeatures::Backup; 232 sFeaturesBackup = new RuntimeEnabledFeatures::Backup;
233 if (!sHistogramSnapshot)
234 sHistogramSnapshot.reset(new HistogramTester());
231 sFeaturesBackup->restore(); 235 sFeaturesBackup->restore();
232 page->setIsCursorVisible(true); 236 page->setIsCursorVisible(true);
233 page->setPageScaleFactor(1); 237 page->setPageScaleFactor(1);
234 page->deprecatedLocalMainFrame()->view()->layoutViewportScrollableArea()->se tScrollPosition(IntPoint(0, 0), ProgrammaticScroll); 238 page->deprecatedLocalMainFrame()->view()->layoutViewportScrollableArea()->se tScrollPosition(IntPoint(0, 0), ProgrammaticScroll);
235 overrideUserPreferredLanguages(Vector<AtomicString>()); 239 overrideUserPreferredLanguages(Vector<AtomicString>());
236 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled()) 240 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled())
237 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking(); 241 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking();
238 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) 242 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled())
239 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); 243 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled();
240 244
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check"); 383 exceptionState.throwDOMException(InvalidAccessError, "Must supply docume nt to check");
380 return; 384 return;
381 } 385 }
382 386
383 if (doc->layoutViewItem().isNull()) 387 if (doc->layoutViewItem().isNull())
384 return; 388 return;
385 389
386 doc->layoutViewItem().clearHitTestCache(); 390 doc->layoutViewItem().clearHitTestCache();
387 } 391 }
388 392
393 int Internals::histogramCount(const String& name, int bucket) const
394 {
395 return sHistogramSnapshot->histogramCount(name.utf8().data(), bucket);
396 }
397
398 void Internals::clearHistogramCounts()
399 {
400 sHistogramSnapshot.reset(new HistogramTester());
401 }
402
389 bool Internals::isPreloaded(const String& url) 403 bool Internals::isPreloaded(const String& url)
390 { 404 {
391 return isPreloadedBy(url, contextDocument()); 405 return isPreloadedBy(url, contextDocument());
392 } 406 }
393 407
394 bool Internals::isPreloadedBy(const String& url, Document* document) 408 bool Internals::isPreloadedBy(const String& url, Document* document)
395 { 409 {
396 if (!document) 410 if (!document)
397 return false; 411 return false;
398 return document->fetcher()->isPreloaded(document->completeURL(url)); 412 return document->fetcher()->isPreloaded(document->completeURL(url));
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 } 2644 }
2631 2645
2632 String Internals::getProgrammaticScrollAnimationState(Node* node) const 2646 String Internals::getProgrammaticScrollAnimationState(Node* node) const
2633 { 2647 {
2634 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node)) 2648 if (ScrollableArea* scrollableArea = scrollableAreaForNode(node))
2635 return scrollableArea->programmaticScrollAnimator().runStateAsText(); 2649 return scrollableArea->programmaticScrollAnimator().runStateAsText();
2636 return String(); 2650 return String();
2637 } 2651 }
2638 2652
2639 } // namespace blink 2653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698