| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 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 #include <v8.h> |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class CSSStyleSheet; | 39 class CSSStyleSheet; |
| 40 class LocalDOMWindow; | |
| 41 class Document; | 40 class Document; |
| 42 class ExecutionContext; | 41 class ExecutionContext; |
| 42 class Frame; |
| 43 class LocalFrame; |
| 43 class StyleSheetContents; | 44 class StyleSheetContents; |
| 44 | 45 |
| 45 // UseCounter is used for counting the number of times features of | 46 // UseCounter is used for counting the number of times features of |
| 46 // Blink are used on real web pages and help us know commonly | 47 // Blink are used on real web pages and help us know commonly |
| 47 // features are used and thus when it's safe to remove or change them. | 48 // features are used and thus when it's safe to remove or change them. |
| 48 // | 49 // |
| 49 // The Chromium Content layer controls what is done with this data. | 50 // The Chromium Content layer controls what is done with this data. |
| 50 // For instance, in Google Chrome, these counts are submitted | 51 // For instance, in Google Chrome, these counts are submitted |
| 51 // anonymously through the Histogram recording system in Chrome | 52 // anonymously through the Histogram recording system in Chrome |
| 52 // for users who opt-in to "Usage Statistics" submission | 53 // for users who opt-in to "Usage Statistics" submission |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 InputTypeSubmitWithValue = 592, | 562 InputTypeSubmitWithValue = 592, |
| 562 | 563 |
| 563 // Add new features immediately above this line. Don't change assigned | 564 // Add new features immediately above this line. Don't change assigned |
| 564 // numbers of any item, and don't reuse removed slots. | 565 // numbers of any item, and don't reuse removed slots. |
| 565 // Also, run update_use_counter_feature_enum.py in chromium/src/tools/me
trics/histograms/ | 566 // Also, run update_use_counter_feature_enum.py in chromium/src/tools/me
trics/histograms/ |
| 566 // to update the UMA mapping. | 567 // to update the UMA mapping. |
| 567 NumberOfFeatures, // This enum value must be last. | 568 NumberOfFeatures, // This enum value must be last. |
| 568 }; | 569 }; |
| 569 | 570 |
| 570 // "count" sets the bit for this feature to 1. Repeated calls are ignored. | 571 // "count" sets the bit for this feature to 1. Repeated calls are ignored. |
| 572 static void count(const Frame*, Feature); |
| 571 static void count(const Document&, Feature); | 573 static void count(const Document&, Feature); |
| 572 // This doesn't count for ExecutionContexts for shared workers and service | 574 // This doesn't count for ExecutionContexts for shared workers and service |
| 573 // workers. | 575 // workers. |
| 574 static void count(const ExecutionContext*, Feature); | 576 static void count(const ExecutionContext*, Feature); |
| 575 // Use countIfNotPrivateScript() instead of count() if you don't want | 577 // Use countIfNotPrivateScript() instead of count() if you don't want |
| 576 // to count metrics in private scripts. You should use | 578 // to count metrics in private scripts. You should use |
| 577 // countIfNotPrivateScript() in a binding layer. | 579 // countIfNotPrivateScript() in a binding layer. |
| 580 static void countIfNotPrivateScript(v8::Isolate*, const Frame*, Feature); |
| 578 static void countIfNotPrivateScript(v8::Isolate*, const Document&, Feature); | 581 static void countIfNotPrivateScript(v8::Isolate*, const Document&, Feature); |
| 579 static void countIfNotPrivateScript(v8::Isolate*, const ExecutionContext*, F
eature); | 582 static void countIfNotPrivateScript(v8::Isolate*, const ExecutionContext*, F
eature); |
| 580 | 583 |
| 581 void count(CSSParserContext, CSSPropertyID); | 584 void count(CSSParserContext, CSSPropertyID); |
| 582 void count(Feature); | 585 void count(Feature); |
| 583 | 586 |
| 584 // "countDeprecation" sets the bit for this feature to 1, and sends a deprec
ation | 587 // "countDeprecation" sets the bit for this feature to 1, and sends a deprec
ation |
| 585 // warning to the console. Repeated calls are ignored. | 588 // warning to the console. Repeated calls are ignored. |
| 586 // | 589 // |
| 587 // Be considerate to developers' consoles: features should only send | 590 // Be considerate to developers' consoles: features should only send |
| 588 // deprecation warnings when we're actively interested in removing them from | 591 // deprecation warnings when we're actively interested in removing them from |
| 589 // the platform. | 592 // the platform. |
| 590 // | 593 // |
| 591 // The ExecutionContext* overload doesn't work for shared workers and | 594 // The ExecutionContext* overload doesn't work for shared workers and |
| 592 // service workers. | 595 // service workers. |
| 593 static void countDeprecation(const LocalDOMWindow*, Feature); | 596 static void countDeprecation(const LocalFrame*, Feature); |
| 594 static void countDeprecation(ExecutionContext*, Feature); | 597 static void countDeprecation(ExecutionContext*, Feature); |
| 595 static void countDeprecation(const Document&, Feature); | 598 static void countDeprecation(const Document&, Feature); |
| 596 // Use countDeprecationIfNotPrivateScript() instead of countDeprecation() | 599 // Use countDeprecationIfNotPrivateScript() instead of countDeprecation() |
| 597 // if you don't want to count metrics in private scripts. You should use | 600 // if you don't want to count metrics in private scripts. You should use |
| 598 // countDeprecationIfNotPrivateScript() in a binding layer. | 601 // countDeprecationIfNotPrivateScript() in a binding layer. |
| 599 static void countDeprecationIfNotPrivateScript(v8::Isolate*, ExecutionContex
t*, Feature); | 602 static void countDeprecationIfNotPrivateScript(v8::Isolate*, ExecutionContex
t*, Feature); |
| 600 String deprecationMessage(Feature); | 603 String deprecationMessage(Feature); |
| 601 | 604 |
| 602 void didCommitLoad(); | 605 void didCommitLoad(); |
| 603 | 606 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 633 | 636 |
| 634 void updateMeasurements(); | 637 void updateMeasurements(); |
| 635 | 638 |
| 636 OwnPtr<BitVector> m_countBits; | 639 OwnPtr<BitVector> m_countBits; |
| 637 BitVector m_CSSFeatureBits; | 640 BitVector m_CSSFeatureBits; |
| 638 }; | 641 }; |
| 639 | 642 |
| 640 } // namespace blink | 643 } // namespace blink |
| 641 | 644 |
| 642 #endif // UseCounter_h | 645 #endif // UseCounter_h |
| OLD | NEW |