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

Side by Side Diff: Source/core/frame/UseCounter.h

Issue 656693002: Don't count UseCounters in private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/core/V8TestObject.cpp ('k') | Source/core/frame/UseCounter.cpp » ('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 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef UseCounter_h 26 #ifndef UseCounter_h
27 #define UseCounter_h 27 #define UseCounter_h
28 28
29 #include "core/CSSPropertyNames.h" 29 #include "core/CSSPropertyNames.h"
30 #include "wtf/BitVector.h" 30 #include "wtf/BitVector.h"
31 #include "wtf/Noncopyable.h" 31 #include "wtf/Noncopyable.h"
32 #include "wtf/OwnPtr.h" 32 #include "wtf/OwnPtr.h"
33 #include "wtf/PassOwnPtr.h" 33 #include "wtf/PassOwnPtr.h"
34 #include "wtf/text/WTFString.h" 34 #include "wtf/text/WTFString.h"
35 #include <v8.h>
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class CSSStyleSheet; 39 class CSSStyleSheet;
39 class LocalDOMWindow; 40 class LocalDOMWindow;
40 class Document; 41 class Document;
41 class ExecutionContext; 42 class ExecutionContext;
42 class StyleSheetContents; 43 class StyleSheetContents;
43 44
44 // UseCounter is used for counting the number of times features of 45 // UseCounter is used for counting the number of times features of
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // Also, run update_use_counter_feature_enum.py in chromium/src/tools/me trics/histograms/ 541 // Also, run update_use_counter_feature_enum.py in chromium/src/tools/me trics/histograms/
541 // to update the UMA mapping. 542 // to update the UMA mapping.
542 NumberOfFeatures, // This enum value must be last. 543 NumberOfFeatures, // This enum value must be last.
543 }; 544 };
544 545
545 // "count" sets the bit for this feature to 1. Repeated calls are ignored. 546 // "count" sets the bit for this feature to 1. Repeated calls are ignored.
546 static void count(const Document&, Feature); 547 static void count(const Document&, Feature);
547 // This doesn't count for ExecutionContexts for shared workers and service 548 // This doesn't count for ExecutionContexts for shared workers and service
548 // workers. 549 // workers.
549 static void count(const ExecutionContext*, Feature); 550 static void count(const ExecutionContext*, Feature);
551 // Use countIfNotPrivateScript() instead of count() if you don't want
552 // to count metrics in private scripts. You should use
553 // countIfNotPrivateScript() in a binding layer.
554 static void countIfNotPrivateScript(v8::Isolate*, const Document&, Feature);
555 static void countIfNotPrivateScript(v8::Isolate*, const ExecutionContext*, F eature);
556
550 void count(CSSParserContext, CSSPropertyID); 557 void count(CSSParserContext, CSSPropertyID);
551 void count(Feature); 558 void count(Feature);
552 559
553 // "countDeprecation" sets the bit for this feature to 1, and sends a deprec ation 560 // "countDeprecation" sets the bit for this feature to 1, and sends a deprec ation
554 // warning to the console. Repeated calls are ignored. 561 // warning to the console. Repeated calls are ignored.
555 // 562 //
556 // Be considerate to developers' consoles: features should only send 563 // Be considerate to developers' consoles: features should only send
557 // deprecation warnings when we're actively interested in removing them from 564 // deprecation warnings when we're actively interested in removing them from
558 // the platform. 565 // the platform.
559 // 566 //
560 // The ExecutionContext* overload doesn't work for shared workers and 567 // The ExecutionContext* overload doesn't work for shared workers and
561 // service workers. 568 // service workers.
562 static void countDeprecation(const LocalDOMWindow*, Feature); 569 static void countDeprecation(const LocalDOMWindow*, Feature);
563 static void countDeprecation(ExecutionContext*, Feature); 570 static void countDeprecation(ExecutionContext*, Feature);
564 static void countDeprecation(const Document&, Feature); 571 static void countDeprecation(const Document&, Feature);
572 // Use countDeprecationIfNotPrivateScript() instead of countDeprecation()
573 // if you don't want to count metrics in private scripts. You should use
574 // countDeprecationIfNotPrivateScript() in a binding layer.
575 static void countDeprecationIfNotPrivateScript(v8::Isolate*, ExecutionContex t*, Feature);
565 String deprecationMessage(Feature); 576 String deprecationMessage(Feature);
566 577
567 void didCommitLoad(); 578 void didCommitLoad();
568 579
569 static UseCounter* getFrom(const Document*); 580 static UseCounter* getFrom(const Document*);
570 static UseCounter* getFrom(const CSSStyleSheet*); 581 static UseCounter* getFrom(const CSSStyleSheet*);
571 static UseCounter* getFrom(const StyleSheetContents*); 582 static UseCounter* getFrom(const StyleSheetContents*);
572 583
573 static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id); 584 static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);
574 585
(...skipping 23 matching lines...) Expand all
598 609
599 void updateMeasurements(); 610 void updateMeasurements();
600 611
601 OwnPtr<BitVector> m_countBits; 612 OwnPtr<BitVector> m_countBits;
602 BitVector m_CSSFeatureBits; 613 BitVector m_CSSFeatureBits;
603 }; 614 };
604 615
605 } // namespace blink 616 } // namespace blink
606 617
607 #endif // UseCounter_h 618 #endif // UseCounter_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestObject.cpp ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698