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

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

Issue 34623009: Revamp style resolver stats (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix stats for mac, crazy StyleResolver constructor side effects Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 #include "MallocStatistics.h" 38 #include "MallocStatistics.h"
39 #include "MockPagePopupDriver.h" 39 #include "MockPagePopupDriver.h"
40 #include "RuntimeEnabledFeatures.h" 40 #include "RuntimeEnabledFeatures.h"
41 #include "TypeConversions.h" 41 #include "TypeConversions.h"
42 #include "bindings/v8/ExceptionState.h" 42 #include "bindings/v8/ExceptionState.h"
43 #include "bindings/v8/SerializedScriptValue.h" 43 #include "bindings/v8/SerializedScriptValue.h"
44 #include "bindings/v8/V8ThrowException.h" 44 #include "bindings/v8/V8ThrowException.h"
45 #include "core/animation/DocumentTimeline.h" 45 #include "core/animation/DocumentTimeline.h"
46 #include "core/css/StyleSheetContents.h" 46 #include "core/css/StyleSheetContents.h"
47 #include "core/css/resolver/StyleResolver.h" 47 #include "core/css/resolver/StyleResolver.h"
48 #include "core/css/resolver/StyleResolverStats.h"
48 #include "core/css/resolver/ViewportStyleResolver.h" 49 #include "core/css/resolver/ViewportStyleResolver.h"
49 #include "core/dom/ClientRect.h" 50 #include "core/dom/ClientRect.h"
50 #include "core/dom/ClientRectList.h" 51 #include "core/dom/ClientRectList.h"
51 #include "core/dom/DOMStringList.h" 52 #include "core/dom/DOMStringList.h"
52 #include "core/dom/Document.h" 53 #include "core/dom/Document.h"
53 #include "core/dom/DocumentMarker.h" 54 #include "core/dom/DocumentMarker.h"
54 #include "core/dom/DocumentMarkerController.h" 55 #include "core/dom/DocumentMarkerController.h"
55 #include "core/dom/Element.h" 56 #include "core/dom/Element.h"
56 #include "core/dom/ExceptionCode.h" 57 #include "core/dom/ExceptionCode.h"
57 #include "core/dom/FullscreenElementStack.h" 58 #include "core/dom/FullscreenElementStack.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return false; 297 return false;
297 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple teURL(url)); 298 Resource* resource = memoryCache()->resourceForURL(contextDocument()->comple teURL(url));
298 return resource && resource->status() == Resource::Cached; 299 return resource && resource->status() == Resource::Cached;
299 } 300 }
300 301
301 void Internals::crash() 302 void Internals::crash()
302 { 303 {
303 CRASH(); 304 CRASH();
304 } 305 }
305 306
307 void Internals::setStyleResolverStatsEnabled(bool enabled)
308 {
309 Document* document = contextDocument();
310 if (enabled)
311 document->styleResolver()->enableStats(StyleResolver::ReportSlowStats);
312 else
313 document->styleResolver()->disableStats();
314 }
315
316 String Internals::styleResolverStatsReport(ExceptionState& es) const
317 {
318 Document* document = contextDocument();
319 if (!document->styleResolver()->stats()) {
320 es.throwDOMException(InvalidStateError, "Style resolver stats not enable d");
321 return String();
322 }
323 return document->styleResolver()->stats()->report();
324 }
325
326 String Internals::styleResolverStatsTotalsReport(ExceptionState& es) const
327 {
328 Document* document = contextDocument();
329 if (!document->styleResolver()->statsTotals()) {
330 es.throwDOMException(InvalidStateError, "Style resolver stats not enable d");
331 return String();
332 }
333 return document->styleResolver()->statsTotals()->report();
334 }
335
306 PassRefPtr<Element> Internals::createContentElement(ExceptionState& es) 336 PassRefPtr<Element> Internals::createContentElement(ExceptionState& es)
307 { 337 {
308 Document* document = contextDocument(); 338 Document* document = contextDocument();
309 if (!document) { 339 if (!document) {
310 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 340 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
311 return 0; 341 return 0;
312 } 342 }
313 343
314 return HTMLContentElement::create(*document); 344 return HTMLContentElement::create(*document);
315 } 345 }
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 } 2291 }
2262 2292
2263 document->updateLayout(); 2293 document->updateLayout();
2264 2294
2265 RenderView* view = document->renderView(); 2295 RenderView* view = document->renderView();
2266 if (view->compositor()) 2296 if (view->compositor())
2267 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork); 2297 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork);
2268 } 2298 }
2269 2299
2270 } 2300 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698