Changeset 128788 in webkit


Ignore:
Timestamp:
Sep 17, 2012 11:53:35 AM (12 years ago)
Author:
abarth@webkit.org
Message:

We should make collecting metrics easier by adding an IDL attribute
https://bugs.webkit.org/show_bug.cgi?id=96837

Reviewed by Kentaro Hara.

Currently it is too hard to set up a good measurement experiment to see
whether we can safely remove a feature (including vendor-prefixed
features). This patch introduces the [V8MeasureAs] IDL attribute to make
that process easier.

When you add the [V8MeasureAs] IDL property to an API, we'll count what
fraction of Page objects used that API.

  • Modules/notifications/DOMWindowNotifications.idl:
  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateFeatureObservation):
(GenerateNormalAttrGetter):
(GenerateReplaceableAttrSetter):
(GenerateNormalAttrSetter):
(GenerateOverloadedFunctionCallback):
(GenerateFunctionCallback):
(GenerateConstructorCallback):
(GenerateNamedConstructorCallback):

  • bindings/scripts/IDLAttributes.txt:
  • bindings/scripts/test/TestObj.idl:
  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore::TestObjV8Internal::testObjAttrAttrGetter):
(WebCore::TestObjV8Internal::testObjAttrAttrSetter):
(WebCore::TestObjV8Internal::objMethodCallback):
(WebCore):

  • page/Page.h:

(WebCore::Page::featureObserver):
(Page):

Location:
trunk/Source/WebCore
Files:
17 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r128588 r128788  
    16861686    page/EventHandler.cpp
    16871687    page/EventSource.cpp
     1688    page/FeatureObserver.cpp
    16881689    page/FocusController.cpp
    16891690    page/Frame.cpp
  • trunk/Source/WebCore/ChangeLog

    r128786 r128788  
     12012-09-17  Adam Barth  <abarth@webkit.org>
     2
     3        We should make collecting metrics easier by adding an IDL attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=96837
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Currently it is too hard to set up a good measurement experiment to see
     9        whether we can safely remove a feature (including vendor-prefixed
     10        features). This patch introduces the [V8MeasureAs] IDL attribute to make
     11        that process easier.
     12
     13        When you add the [V8MeasureAs] IDL property to an API, we'll count what
     14        fraction of Page objects used that API.
     15
     16        * Modules/notifications/DOMWindowNotifications.idl:
     17        * bindings/scripts/CodeGeneratorV8.pm:
     18        (GenerateFeatureObservation):
     19        (GenerateNormalAttrGetter):
     20        (GenerateReplaceableAttrSetter):
     21        (GenerateNormalAttrSetter):
     22        (GenerateOverloadedFunctionCallback):
     23        (GenerateFunctionCallback):
     24        (GenerateConstructorCallback):
     25        (GenerateNamedConstructorCallback):
     26        * bindings/scripts/IDLAttributes.txt:
     27        * bindings/scripts/test/TestObj.idl:
     28        * bindings/scripts/test/V8/V8TestObj.cpp:
     29        (WebCore::TestObjV8Internal::testObjAttrAttrGetter):
     30        (WebCore::TestObjV8Internal::testObjAttrAttrSetter):
     31        (WebCore::TestObjV8Internal::objMethodCallback):
     32        (WebCore):
     33        * page/Page.h:
     34        (WebCore::Page::featureObserver):
     35        (Page):
     36
    1372012-09-17  Bear Travis  <betravis@adobe.com>
    238
  • trunk/Source/WebCore/GNUmakefile.list.am

    r128700 r128788  
    39693969        Source/WebCore/page/EventSource.cpp \
    39703970        Source/WebCore/page/EventSource.h \
     3971        Source/WebCore/page/FeatureObserver.cpp \
     3972        Source/WebCore/page/FeatureObserver.h \
    39713973        Source/WebCore/page/FocusController.cpp \
    39723974        Source/WebCore/page/FocusController.h \
  • trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl

    r121882 r128788  
    3232    ] DOMWindowNotifications {
    3333#if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS
    34         readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
     34        readonly attribute [V8EnabledAtRuntime, V8MeasureAs=LegacyNotifications] NotificationCenter webkitNotifications;
    3535#endif
    3636#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
  • trunk/Source/WebCore/Target.pri

    r128626 r128788  
    866866    page/EventHandler.cpp \
    867867    page/EventSource.cpp \
     868    page/FeatureObserver.cpp \
    868869    page/FocusController.cpp \
    869870    page/Frame.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r128778 r128788  
    233233            'page/EditorClient.h',
    234234            'page/EventHandler.h',
     235            'page/FeatureObserver.h',
    235236            'page/FocusController.h',
    236237            'page/FocusDirection.h',
     
    31143115            'page/EventSource.cpp',
    31153116            'page/EventSource.h',
     3117            'page/FeatureObserver.cpp',
    31163118            'page/FocusController.cpp',
    31173119            'page/Frame.cpp',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r128778 r128788  
    2705227052                        </File>
    2705327053                        <File
     27054                                RelativePath="..\page\FeatureObserver.cpp"
     27055                                >
     27056                        </File>
     27057                        <File
     27058                                RelativePath="..\page\FeatureObserver.h"
     27059                                >
     27060                        </File>
     27061                        <File
    2705427062                                RelativePath="..\page\FocusController.cpp"
    2705527063                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r128700 r128788  
    36913691                97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; };
    36923692                97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3693                97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C740121603F7A10011FF2D /* FeatureObserver.cpp */; };
     3694                97C740151603F7A10011FF2D /* FeatureObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C740131603F7A10011FF2D /* FeatureObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
    36933695                97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; };
    36943696                97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1091610918                97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; };
    1091710919                97C471DA12F925BD0086354B /* ContentSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSecurityPolicy.h; sourceTree = "<group>"; };
     10920                97C740121603F7A10011FF2D /* FeatureObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FeatureObserver.cpp; sourceTree = "<group>"; };
     10921                97C740131603F7A10011FF2D /* FeatureObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureObserver.h; sourceTree = "<group>"; };
    1091810922                97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; };
    1091910923                97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; };
     
    1581515819                                E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */,
    1581615820                                14993BE30B2F2B1C0050497F /* FocusController.cpp */,
     15821                                97C740121603F7A10011FF2D /* FeatureObserver.cpp */,
     15822                                97C740131603F7A10011FF2D /* FeatureObserver.h */,
    1581715823                                14993BE40B2F2B1C0050497F /* FocusController.h */,
    1581815824                                062287830B4DB322000C34DF /* FocusDirection.h */,
     
    2340723413                                FD31609512B026F700C1A359 /* FFTConvolver.h in Headers */,
    2340823414                                FD31609712B026F700C1A359 /* FFTFrame.h in Headers */,
     23415                                97C740151603F7A10011FF2D /* FeatureObserver.h in Headers */,
    2340923416                                976D6C81122B8A3D001FD1F7 /* File.h in Headers */,
    2341023417                                893C47A71238908B002B3D86 /* FileCallback.h in Headers */,
     
    2665926666                                FD31609612B026F700C1A359 /* FFTFrame.cpp in Sources */,
    2666026667                                FD3160C012B0272A00C1A359 /* FFTFrameMac.cpp in Sources */,
     26668                                97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */,
    2666126669                                976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */,
    2666226670                                934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */,
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r128520 r128788  
    814814}
    815815
     816sub GenerateFeatureObservation
     817{
     818    my $measureAs = shift;
     819
     820    if ($measureAs) {
     821        AddToImplIncludes("FeatureObserver.h");
     822        return "    FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::${measureAs});\n";
     823    }
     824
     825    return "";
     826}
     827
    816828sub GenerateNormalAttrGetter
    817829{
     
    837849static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
    838850{
    839     INC_STATS(\"DOM.$implClassName.$attrName._get\");
    840 END
     851    INC_STATS("DOM.$implClassName.$attrName._get");
     852END
     853    push(@implContentDecls, GenerateFeatureObservation($attrExt->{"V8MeasureAs"}));
    841854
    842855    if ($svgNativeType) {
     
    10861099    INC_STATS("DOM.$implClassName.replaceable._set");
    10871100END
     1101    push(@implContentDecls, GenerateFeatureObservation($dataNode->extendedAttributes->{"V8MeasureAs"}));
    10881102
    10891103    if ($implClassName eq "DOMWindow" || $dataNode->extendedAttributes->{"CheckSecurity"}) {
     
    11181132    push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n");
    11191133    push(@implContentDecls, "    INC_STATS(\"DOM.$implClassName.$attrName._set\");\n");
     1134    push(@implContentDecls, GenerateFeatureObservation($attribute->signature->extendedAttributes->{"V8MeasureAs"}));
    11201135
    11211136    # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an
     
    14241439    INC_STATS(\"DOM.$implClassName.$name\");
    14251440END
     1441    push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}));
    14261442
    14271443    foreach my $overload (@{$function->{overloads}}) {
     
    14741490    INC_STATS(\"DOM.$implClassName.$name\");
    14751491END
     1492    push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}));
    14761493
    14771494    push(@implContentDecls, GenerateArgumentsCountCheck($function, $dataNode));
     
    18001817    }
    18011818
     1819    my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"});
     1820
    18021821    my @beforeArgumentList;
    18031822    my @afterArgumentList;
     
    18061825{
    18071826    INC_STATS("DOM.${implClassName}.Constructor");
    1808 
     1827    ${maybeObserveFeature}
    18091828    if (!args.IsConstructCall())
    18101829        return throwTypeError("DOM object constructor cannot be called as a function.");
     
    19771996    }
    19781997
     1998    my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"});
     1999
    19792000    my @beforeArgumentList;
    19802001    my @afterArgumentList;
     
    19972018{
    19982019    INC_STATS("DOM.${implClassName}.Constructor");
    1999 
     2020    ${maybeObserveFeature}
    20002021    if (!args.IsConstructCall())
    20012022        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt

    r125484 r128788  
    120120V8EnabledPerContext=*
    121121V8GenerateIsReachable=ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot|ImplBaseRoot
     122V8MeasureAs=*
    122123V8ReadOnly
    123124V8Unforgeable
  • trunk/Source/WebCore/bindings/scripts/test/TestObj.idl

    r128248 r128788  
    5050        attribute unsigned long long       unsignedLongLongAttr;
    5151        attribute DOMString                stringAttr;
    52         attribute TestObj                  testObjAttr;
     52        attribute [V8MeasureAs=TestFeature] TestObj testObjAttr;
    5353
    5454        JS, V8
     
    7676        long    longMethod();
    7777        long    longMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg);
    78         TestObj objMethod();
     78        [V8MeasureAs=TestFeature] TestObj objMethod();
    7979        TestObj objMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg);
    8080
     
    9898        // 'Custom' extended attribute
    9999        attribute [Custom] long            customAttr;
    100         [Custom] void customMethod();
     100        [Custom, V8MeasureAs=CustomTestFeature] void customMethod();
    101101        [Custom] void customMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg);
    102102
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r128520 r128788  
    243243{
    244244    INC_STATS("DOM.TestInterface.Constructor");
    245 
     245   
    246246    if (!args.IsConstructCall())
    247247        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r128251 r128788  
    4646{
    4747    INC_STATS("DOM.TestNamedConstructor.Constructor");
    48 
     48   
    4949    if (!args.IsConstructCall())
    5050        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp

    r128251 r128788  
    4444{
    4545    INC_STATS("DOM.TestNode.Constructor");
    46 
     46   
    4747    if (!args.IsConstructCall())
    4848        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r128520 r128788  
    2727#include "Dictionary.h"
    2828#include "ExceptionCode.h"
     29#include "FeatureObserver.h"
    2930#include "Frame.h"
    3031#include "HTMLNames.h"
     
    228229{
    229230    INC_STATS("DOM.TestObj.testObjAttr._get");
     231    FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
    230232    TestObj* imp = V8TestObj::toNative(info.Holder());
    231233    return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate());
     
    235237{
    236238    INC_STATS("DOM.TestObj.testObjAttr._set");
     239    FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
    237240    TestObj* imp = V8TestObj::toNative(info.Holder());
    238241    TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
     
    10951098{
    10961099    INC_STATS("DOM.TestObj.objMethod");
     1100    FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature);
    10971101    TestObj* imp = V8TestObj::toNative(args.Holder());
    10981102    return toV8(imp->objMethod(), args.Holder(), args.GetIsolate());
     
    19291933    // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
    19301934    {"stringAttr", TestObjV8Internal::stringAttrAttrGetter, TestObjV8Internal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    1931     // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
     1935    // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: 'V8MeasureAs')
    19321936    {"testObjAttr", TestObjV8Internal::testObjAttrAttrGetter, TestObjV8Internal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    19331937    // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '')
     
    21232127{
    21242128    INC_STATS("DOM.TestObj.Constructor");
    2125 
     2129   
    21262130    if (!args.IsConstructCall())
    21272131        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r128520 r128788  
    211211{
    212212    INC_STATS("DOM.TestSerializedScriptValueInterface.Constructor");
    213 
     213   
    214214    if (!args.IsConstructCall())
    215215        return throwTypeError("DOM object constructor cannot be called as a function.");
  • trunk/Source/WebCore/page/FeatureObserver.cpp

    r128787 r128788  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
    3  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google, Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    1211 *    documentation and/or other materials provided with the distribution.
    1312 *
    14  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
    1514 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1615 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2524 */
    2625
    27 module window {
     26#include "config.h"
     27#include "FeatureObserver.h"
    2828
    29     interface [
    30         Conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS,
    31         Supplemental=DOMWindow
    32     ] DOMWindowNotifications {
    33 #if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS
    34         readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
    35 #endif
    36 #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
    37         attribute NotificationConstructor Notification;
    38 #endif
    39     };
     29#include "DOMWindow.h"
     30#include "Document.h"
     31#include "HistogramSupport.h"
     32#include "Page.h"
    4033
     34namespace WebCore {
     35
     36FeatureObserver::FeatureObserver()
     37    : m_featureMask(0)
     38{
    4139}
     40
     41FeatureObserver::~FeatureObserver()
     42{
     43    // We always log PageDestruction so that we have a scale for the rest of the features.
     44    HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures);
     45
     46    if (!m_featureMask)
     47        return;
     48
     49    for (int i = 0; i < NumberOfFeatures; ++i) {
     50        if (m_featureMask & (1 << i))
     51            HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures);
     52    }
     53}
     54
     55void FeatureObserver::observe(DOMWindow* domWindow, Feature feature)
     56{
     57    Document* document = domWindow->document();
     58    if (!document)
     59        return;
     60
     61    Page* page = document->page();
     62    if (!page)
     63        return;
     64
     65    page->featureObserver()->didObserve(feature);
     66}
     67
     68} // namespace WebCore
  • trunk/Source/WebCore/page/FeatureObserver.h

    r128787 r128788  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
    3  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google, Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    1211 *    documentation and/or other materials provided with the distribution.
    1312 *
    14  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
    1514 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1615 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    2524 */
    2625
    27 module window {
     26#ifndef FeatureObserver_h
     27#define FeatureObserver_h
    2828
    29     interface [
    30         Conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS,
    31         Supplemental=DOMWindow
    32     ] DOMWindowNotifications {
    33 #if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS
    34         readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
    35 #endif
    36 #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
    37         attribute NotificationConstructor Notification;
    38 #endif
     29#include <wtf/Noncopyable.h>
     30
     31namespace WebCore {
     32
     33class DOMWindow;
     34
     35class FeatureObserver {
     36    WTF_MAKE_NONCOPYABLE(FeatureObserver);
     37public:
     38    FeatureObserver();
     39    ~FeatureObserver();
     40
     41    enum Feature {
     42        PageDestruction,
     43        LegacyNotifications,
     44        // Add new features above this line.
     45        NumberOfFeatures, // This enum value must be last.
    3946    };
    4047
    41 }
     48    static void observe(DOMWindow*, Feature);
     49
     50private:
     51    void didObserve(Feature feature)
     52    {
     53        COMPILE_ASSERT(sizeof(m_featureMask) * 8 >= NumberOfFeatures, FeaturesMustNotOverflowBitmask);
     54        ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
     55        ASSERT(feature < NumberOfFeatures);
     56        m_featureMask |= 1 << static_cast<int>(feature);
     57    }
     58
     59    int m_featureMask;
     60};
     61
     62} // namespace WebCore
     63   
     64#endif // FeatureObserver_h
  • trunk/Source/WebCore/page/Page.h

    r128653 r128788  
    2222#define Page_h
    2323
     24#include "FeatureObserver.h"
    2425#include "FrameLoaderTypes.h"
    2526#include "FindOptions.h"
     
    198199        BackForwardController* backForward() const { return m_backForwardController.get(); }
    199200
     201        FeatureObserver* featureObserver() { return &m_featureObserver; }
     202
    200203        enum ViewMode {
    201204            ViewModeInvalid,
     
    392395        ValidationMessageClient* m_validationMessageClient;
    393396
     397        FeatureObserver m_featureObserver;
     398
    394399        int m_frameCount;
    395400        String m_groupName;
Note: See TracChangeset for help on using the changeset viewer.