Changeset 128788 in webkit
- Timestamp:
- Sep 17, 2012 11:53:35 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 17 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r128588 r128788 1686 1686 page/EventHandler.cpp 1687 1687 page/EventSource.cpp 1688 page/FeatureObserver.cpp 1688 1689 page/FocusController.cpp 1689 1690 page/Frame.cpp -
trunk/Source/WebCore/ChangeLog
r128786 r128788 1 2012-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 1 37 2012-09-17 Bear Travis <betravis@adobe.com> 2 38 -
trunk/Source/WebCore/GNUmakefile.list.am
r128700 r128788 3969 3969 Source/WebCore/page/EventSource.cpp \ 3970 3970 Source/WebCore/page/EventSource.h \ 3971 Source/WebCore/page/FeatureObserver.cpp \ 3972 Source/WebCore/page/FeatureObserver.h \ 3971 3973 Source/WebCore/page/FocusController.cpp \ 3972 3974 Source/WebCore/page/FocusController.h \ -
trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.idl
r121882 r128788 32 32 ] DOMWindowNotifications { 33 33 #if defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS 34 readonly attribute [V8EnabledAtRuntime ] NotificationCenter webkitNotifications;34 readonly attribute [V8EnabledAtRuntime, V8MeasureAs=LegacyNotifications] NotificationCenter webkitNotifications; 35 35 #endif 36 36 #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS -
trunk/Source/WebCore/Target.pri
r128626 r128788 866 866 page/EventHandler.cpp \ 867 867 page/EventSource.cpp \ 868 page/FeatureObserver.cpp \ 868 869 page/FocusController.cpp \ 869 870 page/Frame.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r128778 r128788 233 233 'page/EditorClient.h', 234 234 'page/EventHandler.h', 235 'page/FeatureObserver.h', 235 236 'page/FocusController.h', 236 237 'page/FocusDirection.h', … … 3114 3115 'page/EventSource.cpp', 3115 3116 'page/EventSource.h', 3117 'page/FeatureObserver.cpp', 3116 3118 'page/FocusController.cpp', 3117 3119 'page/Frame.cpp', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r128778 r128788 27052 27052 </File> 27053 27053 <File 27054 RelativePath="..\page\FeatureObserver.cpp" 27055 > 27056 </File> 27057 <File 27058 RelativePath="..\page\FeatureObserver.h" 27059 > 27060 </File> 27061 <File 27054 27062 RelativePath="..\page\FocusController.cpp" 27055 27063 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r128700 r128788 3691 3691 97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */; }; 3692 3692 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, ); }; }; 3693 3695 97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */; }; 3694 3696 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10916 10918 97C471D912F925BC0086354B /* ContentSecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSecurityPolicy.cpp; sourceTree = "<group>"; }; 10917 10919 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>"; }; 10918 10922 97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowProperty.cpp; sourceTree = "<group>"; }; 10919 10923 97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowProperty.h; sourceTree = "<group>"; }; … … 15815 15819 E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */, 15816 15820 14993BE30B2F2B1C0050497F /* FocusController.cpp */, 15821 97C740121603F7A10011FF2D /* FeatureObserver.cpp */, 15822 97C740131603F7A10011FF2D /* FeatureObserver.h */, 15817 15823 14993BE40B2F2B1C0050497F /* FocusController.h */, 15818 15824 062287830B4DB322000C34DF /* FocusDirection.h */, … … 23407 23413 FD31609512B026F700C1A359 /* FFTConvolver.h in Headers */, 23408 23414 FD31609712B026F700C1A359 /* FFTFrame.h in Headers */, 23415 97C740151603F7A10011FF2D /* FeatureObserver.h in Headers */, 23409 23416 976D6C81122B8A3D001FD1F7 /* File.h in Headers */, 23410 23417 893C47A71238908B002B3D86 /* FileCallback.h in Headers */, … … 26659 26666 FD31609612B026F700C1A359 /* FFTFrame.cpp in Sources */, 26660 26667 FD3160C012B0272A00C1A359 /* FFTFrameMac.cpp in Sources */, 26668 97C740141603F7A10011FF2D /* FeatureObserver.cpp in Sources */, 26661 26669 976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */, 26662 26670 934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */, -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r128520 r128788 814 814 } 815 815 816 sub 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 816 828 sub GenerateNormalAttrGetter 817 829 { … … 837 849 static v8::Handle<v8::Value> ${attrName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 838 850 { 839 INC_STATS(\"DOM.$implClassName.$attrName._get\"); 840 END 851 INC_STATS("DOM.$implClassName.$attrName._get"); 852 END 853 push(@implContentDecls, GenerateFeatureObservation($attrExt->{"V8MeasureAs"})); 841 854 842 855 if ($svgNativeType) { … … 1086 1099 INC_STATS("DOM.$implClassName.replaceable._set"); 1087 1100 END 1101 push(@implContentDecls, GenerateFeatureObservation($dataNode->extendedAttributes->{"V8MeasureAs"})); 1088 1102 1089 1103 if ($implClassName eq "DOMWindow" || $dataNode->extendedAttributes->{"CheckSecurity"}) { … … 1118 1132 push(@implContentDecls, "static void ${attrName}AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)\n{\n"); 1119 1133 push(@implContentDecls, " INC_STATS(\"DOM.$implClassName.$attrName._set\");\n"); 1134 push(@implContentDecls, GenerateFeatureObservation($attribute->signature->extendedAttributes->{"V8MeasureAs"})); 1120 1135 1121 1136 # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an … … 1424 1439 INC_STATS(\"DOM.$implClassName.$name\"); 1425 1440 END 1441 push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"})); 1426 1442 1427 1443 foreach my $overload (@{$function->{overloads}}) { … … 1474 1490 INC_STATS(\"DOM.$implClassName.$name\"); 1475 1491 END 1492 push(@implContentDecls, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"})); 1476 1493 1477 1494 push(@implContentDecls, GenerateArgumentsCountCheck($function, $dataNode)); … … 1800 1817 } 1801 1818 1819 my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}); 1820 1802 1821 my @beforeArgumentList; 1803 1822 my @afterArgumentList; … … 1806 1825 { 1807 1826 INC_STATS("DOM.${implClassName}.Constructor"); 1808 1827 ${maybeObserveFeature} 1809 1828 if (!args.IsConstructCall()) 1810 1829 return throwTypeError("DOM object constructor cannot be called as a function."); … … 1977 1996 } 1978 1997 1998 my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}); 1999 1979 2000 my @beforeArgumentList; 1980 2001 my @afterArgumentList; … … 1997 2018 { 1998 2019 INC_STATS("DOM.${implClassName}.Constructor"); 1999 2020 ${maybeObserveFeature} 2000 2021 if (!args.IsConstructCall()) 2001 2022 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r125484 r128788 120 120 V8EnabledPerContext=* 121 121 V8GenerateIsReachable=ImplElementRoot|ImplOwnerRoot|ImplOwnerNodeRoot|ImplBaseRoot 122 V8MeasureAs=* 122 123 V8ReadOnly 123 124 V8Unforgeable -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r128248 r128788 50 50 attribute unsigned long long unsignedLongLongAttr; 51 51 attribute DOMString stringAttr; 52 attribute TestObjtestObjAttr;52 attribute [V8MeasureAs=TestFeature] TestObj testObjAttr; 53 53 54 54 JS, V8 … … 76 76 long longMethod(); 77 77 long longMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); 78 TestObj objMethod();78 [V8MeasureAs=TestFeature] TestObj objMethod(); 79 79 TestObj objMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); 80 80 … … 98 98 // 'Custom' extended attribute 99 99 attribute [Custom] long customAttr; 100 [Custom ] void customMethod();100 [Custom, V8MeasureAs=CustomTestFeature] void customMethod(); 101 101 [Custom] void customMethodWithArgs(in long longArg, in DOMString strArg, in TestObj objArg); 102 102 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r128520 r128788 243 243 { 244 244 INC_STATS("DOM.TestInterface.Constructor"); 245 245 246 246 if (!args.IsConstructCall()) 247 247 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
r128251 r128788 46 46 { 47 47 INC_STATS("DOM.TestNamedConstructor.Constructor"); 48 48 49 49 if (!args.IsConstructCall()) 50 50 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
r128251 r128788 44 44 { 45 45 INC_STATS("DOM.TestNode.Constructor"); 46 46 47 47 if (!args.IsConstructCall()) 48 48 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r128520 r128788 27 27 #include "Dictionary.h" 28 28 #include "ExceptionCode.h" 29 #include "FeatureObserver.h" 29 30 #include "Frame.h" 30 31 #include "HTMLNames.h" … … 228 229 { 229 230 INC_STATS("DOM.TestObj.testObjAttr._get"); 231 FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); 230 232 TestObj* imp = V8TestObj::toNative(info.Holder()); 231 233 return toV8(imp->testObjAttr(), info.Holder(), info.GetIsolate()); … … 235 237 { 236 238 INC_STATS("DOM.TestObj.testObjAttr._set"); 239 FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); 237 240 TestObj* imp = V8TestObj::toNative(info.Holder()); 238 241 TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; … … 1095 1098 { 1096 1099 INC_STATS("DOM.TestObj.objMethod"); 1100 FeatureObserver::observe(activeDOMWindow(BindingState::instance()), FeatureObserver::TestFeature); 1097 1101 TestObj* imp = V8TestObj::toNative(args.Holder()); 1098 1102 return toV8(imp->objMethod(), args.Holder(), args.GetIsolate()); … … 1929 1933 // Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '') 1930 1934 {"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') 1932 1936 {"testObjAttr", TestObjV8Internal::testObjAttrAttrGetter, TestObjV8Internal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 1933 1937 // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '') … … 2123 2127 { 2124 2128 INC_STATS("DOM.TestObj.Constructor"); 2125 2129 2126 2130 if (!args.IsConstructCall()) 2127 2131 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
r128520 r128788 211 211 { 212 212 INC_STATS("DOM.TestSerializedScriptValueInterface.Constructor"); 213 213 214 214 if (!args.IsConstructCall()) 215 215 return throwTypeError("DOM object constructor cannot be called as a function."); -
trunk/Source/WebCore/page/FeatureObserver.cpp
r128787 r128788 1 1 /* 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. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 12 11 * documentation and/or other materials provided with the distribution. 13 12 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 15 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR … … 25 24 */ 26 25 27 module window { 26 #include "config.h" 27 #include "FeatureObserver.h" 28 28 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" 40 33 34 namespace WebCore { 35 36 FeatureObserver::FeatureObserver() 37 : m_featureMask(0) 38 { 41 39 } 40 41 FeatureObserver::~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 55 void 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 1 1 /* 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. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 12 11 * documentation and/or other materials provided with the distribution. 13 12 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY 15 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR … … 25 24 */ 26 25 27 module window { 26 #ifndef FeatureObserver_h 27 #define FeatureObserver_h 28 28 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 31 namespace WebCore { 32 33 class DOMWindow; 34 35 class FeatureObserver { 36 WTF_MAKE_NONCOPYABLE(FeatureObserver); 37 public: 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. 39 46 }; 40 47 41 } 48 static void observe(DOMWindow*, Feature); 49 50 private: 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 22 22 #define Page_h 23 23 24 #include "FeatureObserver.h" 24 25 #include "FrameLoaderTypes.h" 25 26 #include "FindOptions.h" … … 198 199 BackForwardController* backForward() const { return m_backForwardController.get(); } 199 200 201 FeatureObserver* featureObserver() { return &m_featureObserver; } 202 200 203 enum ViewMode { 201 204 ViewModeInvalid, … … 392 395 ValidationMessageClient* m_validationMessageClient; 393 396 397 FeatureObserver m_featureObserver; 398 394 399 int m_frameCount; 395 400 String m_groupName;
Note: See TracChangeset
for help on using the changeset viewer.