Changeset 154962 in webkit
- Timestamp:
- Sep 2, 2013 11:50:01 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 68 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r154902 r154962 1 2013-09-01 Andreas Kling <akling@apple.com> 2 3 Ref: A smart pointer for the reference age. 4 <https://webkit.org/b/120570> 5 6 Reviewed by Antti Koivisto. 7 8 Add a very simple simple Ref<T> smart pointer class that is never null. 9 It's initialized by passing a T& to the constructor and cannot be assigned to. 10 11 operator-> is not overloaded, to prevent unsafe-looking code. 12 The value is extracted by "T& get()", since C++ does not let you override operator.() 13 14 * wtf/Ref.h: 15 1 16 2013-08-30 Oliver Hunt <oliver@apple.com> 2 17 -
trunk/Source/WTF/WTF.pro
r154498 r154962 86 86 MetaAllocator.h \ 87 87 MetaAllocatorHandle.h \ 88 Ref.h \ 88 89 Noncopyable.h \ 89 90 NonCopyingSort.h \ -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
r154507 r154962 495 495 <Filter>wtf</Filter> 496 496 </ClInclude> 497 <ClInclude Include="..\wtf\Ref.h"> 498 <Filter>wtf</Filter> 499 </ClInclude> 497 500 <ClInclude Include="..\wtf\Noncopyable.h"> 498 501 <Filter>wtf</Filter> -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r154499 r154962 55 55 1FA47C8B152502DA00568D1B /* WebCoreThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FA47C89152502DA00568D1B /* WebCoreThread.h */; }; 56 56 26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */; }; 57 26299B6E17A9E5B800ADEBE5 /* Ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 26299B6D17A9E5B800ADEBE5 /* Ref.h */; }; 57 58 2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; }; 58 59 2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; }; … … 321 322 1FA47C89152502DA00568D1B /* WebCoreThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreThread.h; sourceTree = "<group>"; }; 322 323 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegerToStringConversion.h; sourceTree = "<group>"; }; 324 26299B6D17A9E5B800ADEBE5 /* Ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ref.h; sourceTree = "<group>"; }; 323 325 2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; }; 324 326 2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; }; … … 709 711 A8A472CF151A825B004123FF /* MetaAllocatorHandle.h */, 710 712 1A3F6BE6174ADA2100B2EEA7 /* NeverDestroyed.h */, 713 26299B6D17A9E5B800ADEBE5 /* Ref.h */, 711 714 0F0D85B317234CB100338210 /* NoLock.h */, 712 715 A8A472D0151A825B004123FF /* Noncopyable.h */, … … 1002 1005 A8A473DB151A825B004123FF /* HexNumber.h in Headers */, 1003 1006 A8A473DC151A825B004123FF /* InlineASM.h in Headers */, 1007 26299B6E17A9E5B800ADEBE5 /* Ref.h in Headers */, 1004 1008 A70DA0841799F04D00529A9B /* Insertion.h in Headers */, 1005 1009 26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */, … … 1064 1068 A748745317A0BDAE00FA04CB /* SixCharacterHash.h in Headers */, 1065 1069 A8A47426151A825B004123FF /* Spectrum.h in Headers */, 1070 26A7052617445A5F00118ACA /* Ref.h in Headers */, 1066 1071 A8A47428151A825B004123FF /* StackBounds.h in Headers */, 1067 1072 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r154498 r154962 56 56 NonCopyingSort.h 57 57 ThreadRestrictionVerifier.h 58 Ref.h 58 59 Noncopyable.h 59 60 NotFound.h -
trunk/Source/WTF/wtf/Forward.h
r153728 r154962 33 33 template<typename T> class PassRefPtr; 34 34 template<typename T> class RefPtr; 35 template<typename T> class Ref; 35 36 template<typename T, size_t inlineCapacity, typename OverflowHandler> class Vector; 36 37 … … 56 57 using WTF::PassRefPtr; 57 58 using WTF::RefPtr; 59 using WTF::Ref; 58 60 using WTF::Vector; 59 61 -
trunk/Source/WebCore/ChangeLog
r154961 r154962 1 2013-09-01 Andreas Kling <akling@apple.com> 2 3 Ref: A smart pointer for the reference age. 4 <https://webkit.org/b/120570> 5 6 Reviewed by Antti Koivisto. 7 8 Use Ref<T> for various stack guards where null checking isn't needed. 9 1 10 2013-09-02 Andreas Kling <akling@apple.com> 2 11 -
trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp
r146537 r154962 36 36 #include "Page.h" 37 37 #include <wtf/CurrentTime.h> 38 #include <wtf/Ref.h> 38 39 39 40 #include "Coordinates.h" … … 148 149 // Protect this GeoNotifier object, since it 149 150 // could be deleted by a call to clearWatch in a callback. 150 Ref Ptr<GeoNotifier> protect(this);151 Ref<GeoNotifier> protect(*this); 151 152 152 153 // Test for fatal error first. This is required for the case where the Frame is … … 434 435 { 435 436 // Protect the Geolocation object from garbage collection during a callback. 436 Ref Ptr<Geolocation> protect(this);437 Ref<Geolocation> protect(*this); 437 438 438 439 // This may be due to either a new position from the service, or a cached -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r153728 r154962 85 85 #include <wtf/OwnPtr.h> 86 86 #include <wtf/PassOwnPtr.h> 87 #include <wtf/Ref.h> 87 88 #include <wtf/RefCounted.h> 88 89 #include <wtf/text/WTFString.h> … … 844 845 845 846 // Protect this object from being deleted before we release the mutex locked by AutoLocker. 846 Ref Ptr<AudioContext> protect(this);847 Ref<AudioContext> protect(*this); 847 848 { 848 849 AutoLocker locker(this); -
trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
r148696 r154962 37 37 #include "ScriptExecutionContext.h" 38 38 #include <runtime/JSLock.h> 39 #include <wtf/Ref.h> 39 40 40 41 namespace WebCore { … … 47 48 return true; 48 49 49 Ref Ptr<JSSQLStatementErrorCallback> protect(this);50 Ref<JSSQLStatementErrorCallback> protect(*this); 50 51 51 52 JSC::JSLockHolder lock(m_data->globalObject()->vm()); -
trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
r153872 r154962 36 36 #include "SecurityOrigin.h" 37 37 #include <runtime/JSLock.h> 38 #include <wtf/Ref.h> 38 39 39 40 namespace WebCore { … … 87 88 } 88 89 89 Ref Ptr<JSCustomXPathNSResolver> selfProtector(this);90 Ref<JSCustomXPathNSResolver> selfProtector(*this); 90 91 91 92 MarkedArgumentBuffer args; -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp
r154629 r154962 30 30 #include "JSMainThreadExecState.h" 31 31 #include <heap/StrongInlines.h> 32 #include <wtf/Ref.h> 32 33 33 34 using namespace JSC; … … 47 48 return; 48 49 49 Ref Ptr<JSGlobalObjectCallback> protect(this);50 Ref<JSGlobalObjectCallback> protect(*this); 50 51 JSLockHolder lock(m_globalObject->vm()); 51 52 -
trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp
r153480 r154962 39 39 #include "JSMainThreadExecState.h" 40 40 #include <runtime/JSLock.h> 41 #include <wtf/Ref.h> 41 42 42 43 using namespace JSC; … … 80 81 81 82 if (callType != CallTypeNone) { 82 Ref Ptr<JSErrorHandler> protectedctor(this);83 Ref<JSErrorHandler> protectedctor(*this); 83 84 84 85 Event* savedEvent = globalObject->currentEvent(); -
trunk/Source/WebCore/bindings/js/JSEventListener.cpp
r154192 r154962 31 31 #include <runtime/ExceptionHelpers.h> 32 32 #include <runtime/JSLock.h> 33 #include <wtf/Ref.h> 33 34 #include <wtf/RefCountedLeakCounter.h> 34 35 … … 112 113 113 114 if (callType != CallTypeNone) { 114 Ref Ptr<JSEventListener> protect(this);115 Ref<JSEventListener> protect(*this); 115 116 116 117 MarkedArgumentBuffer args; -
trunk/Source/WebCore/bindings/js/JSEventListener.h
r148696 r154962 27 27 #include <heap/Weak.h> 28 28 #include <heap/WeakInlines.h> 29 #include <wtf/Ref.h> 29 30 30 31 namespace WebCore { … … 80 81 // initializeJSFunction can trigger code that deletes this event listener 81 82 // before we're done. It should always return 0 in this case. 82 Ref Ptr<JSEventListener> protect(const_cast<JSEventListener*>(this));83 Ref<JSEventListener> protect(const_cast<JSEventListener&>(*this)); 83 84 JSC::Strong<JSC::JSObject> wrapper(*m_isolatedWorld->vm(), m_wrapper.get()); 84 85 -
trunk/Source/WebCore/bridge/runtime_root.cpp
r148696 r154962 35 35 #include <wtf/HashCountedSet.h> 36 36 #include <wtf/HashSet.h> 37 #include <wtf/Ref.h> 37 38 #include <wtf/StdLibExtras.h> 38 39 … … 202 203 RuntimeObject* object = static_cast<RuntimeObject*>(handle.get().asCell()); 203 204 204 Ref Ptr<RootObject> protect(this);205 Ref<RootObject> protect(*this); 205 206 object->invalidate(); 206 207 weakRemove(m_runtimeObjects, object, object); -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r154219 r154962 51 51 #include "StyleRule.h" 52 52 #include "WebKitFontFamilyNames.h" 53 #include <wtf/Ref.h> 53 54 #include <wtf/text/AtomicString.h> 54 55 … … 599 600 600 601 // CSSFontSelector could get deleted via beginLoadIfNeeded() or loadDone() unless protected. 601 Ref Ptr<CSSFontSelector> protect(this);602 Ref<CSSFontSelector> protect(*this); 602 603 603 604 CachedResourceLoader* cachedResourceLoader = m_document->cachedResourceLoader(); -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r154877 r154962 35 35 #include "StyleRuleImport.h" 36 36 #include <wtf/Deque.h> 37 #include <wtf/Ref.h> 37 38 38 39 namespace WebCore { … … 342 343 return; 343 344 344 RefPtr<StyleSheetContents> protect(this);345 346 345 // Avoid |this| being deleted by scripts that run via 347 346 // ScriptableDocumentParser::executeScriptsWaitingForStylesheets(). 348 347 // See <rdar://problem/6622300>. 349 Ref Ptr<StyleSheetContents> protector(this);348 Ref<StyleSheetContents> protect(*this); 350 349 StyleSheetContents* parentSheet = parentStyleSheet(); 351 350 if (parentSheet) { -
trunk/Source/WebCore/dom/CharacterData.cpp
r154957 r154962 36 36 #include "Text.h" 37 37 #include "TextBreakIterator.h" 38 #include <wtf/Ref.h> 38 39 39 40 using namespace std; … … 47 48 return; 48 49 49 Ref Ptr<CharacterData> protect = this;50 Ref<CharacterData> protect(*this); 50 51 51 52 unsigned oldLength = length(); -
trunk/Source/WebCore/dom/ContainerNode.cpp
r154957 r154962 56 56 #include "Text.h" 57 57 #include <wtf/CurrentTime.h> 58 #include <wtf/Ref.h> 58 59 #include <wtf/Vector.h> 59 60 … … 263 264 ASSERT(refCount() || parentOrShadowHostNode()); 264 265 265 Ref Ptr<Node> protect(this);266 Ref<ContainerNode> protect(*this); 266 267 267 268 ec = 0; … … 404 405 ASSERT(refCount() || parentOrShadowHostNode()); 405 406 406 Ref Ptr<Node> protect(this);407 Ref<ContainerNode> protect(*this); 407 408 408 409 ec = 0; … … 527 528 ASSERT(refCount() || parentOrShadowHostNode()); 528 529 529 Ref Ptr<Node> protect(this);530 Ref<ContainerNode> protect(*this); 530 531 531 532 ec = 0; … … 638 639 639 640 // The container node can be removed from event handlers. 640 Ref Ptr<ContainerNode> protect(this);641 Ref<ContainerNode> protect(*this); 641 642 642 643 // exclude this node when looking for removed focusedNode since only children will be removed … … 649 650 // Do any prep work needed before actually starting to detach 650 651 // and remove... e.g. stop loading frames, fire unload events. 651 willRemoveChildren( protect.get());652 willRemoveChildren(this); 652 653 653 654 NodeVector removedChildren; … … 675 676 bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior) 676 677 { 677 Ref Ptr<ContainerNode> protect(this);678 Ref<ContainerNode> protect(*this); 678 679 679 680 // Check that this node is not "floating". … … 778 779 { 779 780 if (s_attachDepth == 1) { 780 Ref Ptr<ContainerNode> protect(this);781 Ref<ContainerNode> protect(*this); 781 782 782 783 if (s_postAttachCallbackQueue) -
trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h
r154877 r154962 31 31 #include "ShadowRoot.h" 32 32 #include <wtf/Assertions.h> 33 #include <wtf/Ref.h> 33 34 34 35 namespace WebCore { … … 184 185 tail = n; 185 186 } else { 186 Ref Ptr<GenericNode> protect(n); // removedFromDocument may remove remove all references to this node.187 Ref<GenericNode> protect(*n); // removedFromDocument may remove remove all references to this node. 187 188 NodeRemovalDispatcher<GenericNode, GenericNodeContainer, ShouldDispatchRemovalNotification<GenericNode>::value>::dispatch(n, container); 188 189 } … … 197 198 { 198 199 ASSERT(m_insertionPoint->inDocument()); 199 Ref Ptr<Node> protect(node);200 Ref<Node> protect(*node); 200 201 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInto(m_insertionPoint)) 201 202 m_postInsertionNotificationTargets.append(node); … … 222 223 #endif 223 224 224 Ref Ptr<Document> protectDocument(&node->document());225 Ref Ptr<Node> protectNode(node);225 Ref<Document> protectDocument(node->document()); 226 Ref<Node> protectNode(*node); 226 227 227 228 if (m_insertionPoint->inDocument()) -
trunk/Source/WebCore/dom/Document.cpp
r154961 r154962 166 166 #include <wtf/MainThread.h> 167 167 #include <wtf/PassRefPtr.h> 168 #include <wtf/Ref.h> 168 169 #include <wtf/TemporaryChange.h> 169 170 #include <wtf/text/StringBuffer.h> … … 2373 2374 2374 2375 // Call to dispatchWindowLoadEvent can blow us from underneath. 2375 Ref Ptr<Document> protect(this);2376 Ref<Document> protect(*this); 2376 2377 2377 2378 m_processingLoadEvent = true; … … 5323 5324 // document will be detached and GC'd. We protect it here to make sure we 5324 5325 // can finish the function successfully. 5325 Ref Ptr<Document> protectDocument(this);5326 Ref<Document> protect(*this); 5326 5327 Deque<RefPtr<Node> > changeQueue; 5327 5328 m_fullScreenChangeEventTargetQueue.swap(changeQueue); -
trunk/Source/WebCore/dom/DocumentEventQueue.cpp
r154877 r154962 35 35 #include "ScriptExecutionContext.h" 36 36 #include "SuspendableTimer.h" 37 #include <wtf/Ref.h> 37 38 38 39 namespace WebCore { … … 136 137 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list. 137 138 138 Ref Ptr<DocumentEventQueue> protector(this);139 Ref<DocumentEventQueue> protect(*this); 139 140 140 141 while (!m_queuedEvents.isEmpty()) { -
trunk/Source/WebCore/dom/EventTarget.cpp
r154673 r154962 39 39 #include "WebKitTransitionEvent.h" 40 40 #include <wtf/MainThread.h> 41 #include <wtf/Ref.h> 41 42 #include <wtf/StdLibExtras.h> 42 43 #include <wtf/Vector.h> … … 241 242 void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventListenerVector& entry) 242 243 { 243 Ref Ptr<EventTarget> protect = this;244 Ref<EventTarget> protect(*this); 244 245 245 246 // Fire all listeners registered for this event. Don't fire listeners removed during event dispatch. -
trunk/Source/WebCore/dom/Node.cpp
r154928 r154962 2181 2181 return true; 2182 2182 2183 Ref Ptr<Node> protector(this);2183 Ref<Node> protect(*this); 2184 2184 RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL); 2185 2185 dispatchEvent(beforeLoadEvent.get()); -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r153480 r154962 39 39 #include "WorkerThread.h" 40 40 #include <wtf/MainThread.h> 41 #include <wtf/Ref.h> 41 42 42 43 // FIXME: This is a layering violation. … … 124 125 void ScriptExecutionContext::dispatchMessagePortEvents() 125 126 { 126 Ref Ptr<ScriptExecutionContext> protect(this);127 Ref<ScriptExecutionContext> protect(*this); 127 128 128 129 // Make a frozen copy. -
trunk/Source/WebCore/dom/ScriptedAnimationController.cpp
r154754 r154962 35 35 #include "RequestAnimationFrameCallback.h" 36 36 #include "Settings.h" 37 #include <wtf/Ref.h> 37 38 38 39 #if USE(REQUEST_ANIMATION_FRAME_TIMER) … … 141 142 // Invoking callbacks may detach elements from our document, which clears the document's 142 143 // reference to us, so take a defensive reference. 143 Ref Ptr<ScriptedAnimationController> protector(this);144 Ref<ScriptedAnimationController> protect(*this); 144 145 145 146 for (size_t i = 0; i < callbacks.size(); ++i) { -
trunk/Source/WebCore/html/HTMLEmbedElement.cpp
r154877 r154962 38 38 #include "RenderWidget.h" 39 39 #include "Settings.h" 40 #include <wtf/Ref.h> 40 41 41 42 namespace WebCore { … … 155 156 parametersForPlugin(paramNames, paramValues); 156 157 157 Ref Ptr<HTMLEmbedElement> protect(this); // Loading the plugin might remove us from the document.158 Ref<HTMLEmbedElement> protect(*this); // Loading the plugin might remove us from the document. 158 159 bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(m_url); 159 160 if (!beforeLoadAllowedLoad) { -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r154877 r154962 42 42 #include "ValidationMessage.h" 43 43 #include "ValidityState.h" 44 #include <wtf/Ref.h> 44 45 #include <wtf/Vector.h> 45 46 … … 414 415 return true; 415 416 // An event handler can deref this object. 416 Ref Ptr<HTMLFormControlElement> protector(this);417 Ref Ptr<Document> originalDocument(&document());417 Ref<HTMLFormControlElement> protect(*this); 418 Ref<Document> originalDocument(document()); 418 419 bool needsDefaultAction = dispatchEvent(Event::create(eventNames().invalidEvent, false, true)); 419 if (needsDefaultAction && unhandledInvalidControls && inDocument() && originalDocument== &document())420 if (needsDefaultAction && unhandledInvalidControls && inDocument() && &originalDocument.get() == &document()) 420 421 unhandledInvalidControls->append(this); 421 422 return false; -
trunk/Source/WebCore/html/HTMLFormElement.cpp
r154877 r154962 48 48 #include "Settings.h" 49 49 #include <limits> 50 #include <wtf/Ref.h> 50 51 51 52 using namespace std; … … 228 229 document().updateLayoutIgnorePendingStylesheets(); 229 230 230 Ref Ptr<HTMLFormElement> protector(this);231 Ref<HTMLFormElement> protect(*this); 231 232 // Focus on the first focusable control and show a validation message. 232 233 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { … … 596 597 bool HTMLFormElement::checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedElement> >& unhandledInvalidControls) 597 598 { 598 Ref Ptr<HTMLFormElement> protector(this);599 Ref<HTMLFormElement> protect(*this); 599 600 // Copy m_associatedElements because event handlers called from 600 601 // HTMLFormControlElement::checkValidity() might change m_associatedElements. -
trunk/Source/WebCore/html/HTMLFrameOwnerElement.cpp
r154165 r154962 27 27 #include "RenderPart.h" 28 28 #include "ShadowRoot.h" 29 #include <wtf/Ref.h> 29 30 30 31 #if ENABLE(SVG) … … 82 83 // see if this behavior is really needed as Gecko does not allow this. 83 84 if (Frame* frame = contentFrame()) { 84 Ref Ptr<Frame> protect(frame);85 Ref<Frame> protect(*frame); 85 86 frame->loader().frameDetached(); 86 87 frame->disconnectOwnerElement(); -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r154903 r154962 69 69 #include "StyleResolver.h" 70 70 #include <wtf/MathExtras.h> 71 #include <wtf/Ref.h> 71 72 72 73 #if ENABLE(INPUT_TYPE_COLOR) … … 1035 1036 return; 1036 1037 1037 Ref Ptr<HTMLInputElement> protector(this);1038 Ref<HTMLInputElement> protect(*this); 1038 1039 EventQueueScope scope; 1039 1040 String sanitizedValue = sanitizeValue(value); -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r154901 r154962 52 52 #include "StyleResolveForDocument.h" 53 53 #include "StyleSheetContents.h" 54 #include <wtf/Ref.h> 54 55 #include <wtf/StdLibExtras.h> 55 56 … … 299 300 } 300 301 // Completing the sheet load may cause scripts to execute. 301 Ref Ptr<Node> protector(this);302 Ref<HTMLLinkElement> protect(*this); 302 303 303 304 CSSParserContext parserContext(&document(), baseURL, charset); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r154937 r154962 84 84 #include <wtf/MathExtras.h> 85 85 #include <wtf/NonCopyingSort.h> 86 #include <wtf/Ref.h> 86 87 #include <wtf/text/CString.h> 87 88 … … 709 710 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 710 711 { 711 Ref Ptr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'beforeload', which can make arbitrary DOM mutations.712 Ref<HTMLMediaElement> protect(*this); // loadNextSourceChild may fire 'beforeload', which can make arbitrary DOM mutations. 712 713 713 714 #if ENABLE(VIDEO_TRACK) … … 772 773 void HTMLMediaElement::load() 773 774 { 774 Ref Ptr<HTMLMediaElement> protect(this); // loadInternal may result in a 'beforeload' event, which can make arbitrary DOM mutations.775 Ref<HTMLMediaElement> protect(*this); // loadInternal may result in a 'beforeload' event, which can make arbitrary DOM mutations. 775 776 776 777 LOG(Media, "HTMLMediaElement::load()"); … … 4309 4310 void HTMLMediaElement::getPluginProxyParams(KURL& url, Vector<String>& names, Vector<String>& values) 4310 4311 { 4311 Ref Ptr<HTMLMediaElement> protect(this); // selectNextSourceChild may fire 'beforeload', which can make arbitrary DOM mutations.4312 Ref<HTMLMediaElement> protect(*this); // selectNextSourceChild may fire 'beforeload', which can make arbitrary DOM mutations. 4312 4313 4313 4314 Frame* frame = document().frame(); -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r154957 r154962 53 53 #include "Text.h" 54 54 #include "Widget.h" 55 #include <wtf/Ref.h> 55 56 56 57 namespace WebCore { … … 311 312 } 312 313 313 Ref Ptr<HTMLObjectElement> protect(this); // beforeload and plugin loading can make arbitrary DOM mutations.314 Ref<HTMLObjectElement> protect(*this); // beforeload and plugin loading can make arbitrary DOM mutations. 314 315 bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url); 315 316 if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer. -
trunk/Source/WebCore/html/HTMLOptionElement.cpp
r154957 r154962 43 43 #include "StyleResolver.h" 44 44 #include "Text.h" 45 #include <wtf/Ref.h> 45 46 #include <wtf/Vector.h> 46 47 #include <wtf/text/StringBuilder.h> … … 131 132 void HTMLOptionElement::setText(const String &text, ExceptionCode& ec) 132 133 { 133 Ref Ptr<Node> protectFromMutationEvents(this);134 Ref<HTMLOptionElement> protectFromMutationEvents(*this); 134 135 135 136 // Changing the text causes a recalc of a select's items, which will reset the selected -
trunk/Source/WebCore/html/HTMLScriptElement.cpp
r154957 r154962 31 31 #include "ScriptEventListener.h" 32 32 #include "Text.h" 33 #include <wtf/Ref.h> 33 34 34 35 namespace WebCore { … … 80 81 void HTMLScriptElement::setText(const String &value) 81 82 { 82 Ref Ptr<Node> protectFromMutationEvents(this);83 Ref<HTMLScriptElement> protectFromMutationEvents(*this); 83 84 84 85 int numChildren = childNodeCount(); -
trunk/Source/WebCore/html/HTMLTableElement.cpp
r154877 r154962 41 41 #include "RenderTable.h" 42 42 #include "StylePropertySet.h" 43 #include <wtf/Ref.h> 43 44 44 45 namespace WebCore { … … 190 191 } 191 192 192 Ref Ptr<Node> protectFromMutationEvents(this);193 Ref<HTMLTableElement> protectFromMutationEvents(*this); 193 194 194 195 RefPtr<HTMLTableRowElement> lastRow = 0; -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r154957 r154962 49 49 #include "TextIterator.h" 50 50 #include "TextNodeTraversal.h" 51 #include <wtf/Ref.h> 51 52 #include <wtf/StdLibExtras.h> 52 53 #include <wtf/text/StringBuilder.h> … … 407 408 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) 408 409 { 409 Ref Ptr<Node> protectFromMutationEvents(this);410 Ref<HTMLTextAreaElement> protectFromMutationEvents(*this); 410 411 411 412 // To preserve comments, remove only the text nodes, then add a single text node. -
trunk/Source/WebCore/html/HTMLTitleElement.cpp
r154957 r154962 30 30 #include "Text.h" 31 31 #include "TextNodeTraversal.h" 32 #include <wtf/Ref.h> 32 33 #include <wtf/text/StringBuilder.h> 33 34 … … 91 92 void HTMLTitleElement::setText(const String &value) 92 93 { 93 Ref Ptr<Node> protectFromMutationEvents(this);94 Ref<HTMLTitleElement> protectFromMutationEvents(*this); 94 95 95 96 int numChildren = childNodeCount(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r154877 r154962 48 48 #include "Settings.h" 49 49 #include <wtf/Functional.h> 50 #include <wtf/Ref.h> 50 51 51 52 namespace WebCore { … … 182 183 // pumpTokenizer can cause this parser to be detached from the Document, 183 184 // but we need to ensure it isn't deleted yet. 184 Ref Ptr<HTMLDocumentParser> protect(this);185 Ref<HTMLDocumentParser> protect(*this); 185 186 186 187 // NOTE: This pump should only ever emit buffered character tokens, … … 246 247 // pumpTokenizer can cause this parser to be detached from the Document, 247 248 // but we need to ensure it isn't deleted yet. 248 Ref Ptr<HTMLDocumentParser> protect(this);249 Ref<HTMLDocumentParser> protect(*this); 249 250 250 251 #if ENABLE(THREADED_HTML_PARSER) … … 321 322 // processParsedChunkFromBackgroundParser can cause this parser to be detached from the Document, 322 323 // but we need to ensure it isn't deleted yet. 323 Ref Ptr<HTMLDocumentParser> protect(this);324 Ref<HTMLDocumentParser> protect(*this); 324 325 325 326 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), lineNumber().zeroBasedInt()); … … 630 631 // pumpTokenizer can cause this parser to be detached from the Document, 631 632 // but we need to ensure it isn't deleted yet. 632 Ref Ptr<HTMLDocumentParser> protect(this);633 Ref<HTMLDocumentParser> protect(*this); 633 634 634 635 #if ENABLE(THREADED_HTML_PARSER) … … 721 722 // pumpTokenizer can cause this parser to be detached from the Document, 722 723 // but we need to ensure it isn't deleted yet. 723 Ref Ptr<HTMLDocumentParser> protect(this);724 Ref<HTMLDocumentParser> protect(*this); 724 725 String source(inputSource); 725 726 … … 894 895 // processParsedChunkFromBackgroundParser can cause this parser to be detached from the Document, 895 896 // but we need to ensure it isn't deleted yet. 896 Ref Ptr<HTMLDocumentParser> protect(this);897 Ref<HTMLDocumentParser> protect(*this); 897 898 pumpPendingSpeculations(); 898 899 return; … … 930 931 // pumpTokenizer can cause this parser to be detached from the Document, 931 932 // but we need to ensure it isn't deleted yet. 932 Ref Ptr<HTMLDocumentParser> protect(this);933 Ref<HTMLDocumentParser> protect(*this); 933 934 934 935 ASSERT(m_scriptRunner); … … 957 958 // pumpTokenizer can cause this parser to be detached from the Document, 958 959 // but we need to ensure it isn't deleted yet. 959 Ref Ptr<HTMLDocumentParser> protect(this);960 Ref<HTMLDocumentParser> protect(*this); 960 961 m_scriptRunner->executeScriptsWaitingForStylesheets(); 961 962 if (!isWaitingForScripts()) -
trunk/Source/WebCore/html/shadow/SpinButtonElement.cpp
r154877 r154962 38 38 #include "ScrollbarTheme.h" 39 39 #include "WheelEvent.h" 40 #include <wtf/Ref.h> 40 41 41 42 namespace WebCore { … … 98 99 // code which detaches this shadow node. We need to take a reference 99 100 // and check renderer() after such function calls. 100 Ref Ptr<Node> protector(this);101 Ref<SpinButtonElement> protect(*this); 101 102 if (m_spinButtonOwner) 102 103 m_spinButtonOwner->focusAndSelectSpinButtonOwner(); -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp
r154877 r154962 43 43 #include "TextEvent.h" 44 44 #include "TextEventInputType.h" 45 #include <wtf/Ref.h> 45 46 46 47 namespace WebCore { … … 309 310 } 310 311 } 311 Ref Ptr<InputFieldSpeechButtonElement> holdRefButton(this);312 Ref<InputFieldSpeechButtonElement> protect(*this); 312 313 input->focus(); 313 314 input->select(); … … 386 387 return; 387 388 388 Ref Ptr<InputFieldSpeechButtonElement> holdRefButton(this);389 Ref<InputFieldSpeechButtonElement> protect(*this); 389 390 if (document().domWindow()) { 390 391 // Call selectionChanged, causing the element to cache the selection, -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r154887 r154962 62 62 #include <wtf/CurrentTime.h> 63 63 #include <wtf/HashSet.h> 64 #include <wtf/Ref.h> 64 65 #include <wtf/Vector.h> 65 66 #include <wtf/text/CString.h> … … 748 749 749 750 ErrorString errorString; 750 Ref Ptr<WebKitNamedFlow> protector(namedFlow);751 Ref<WebKitNamedFlow> protect(*namedFlow); 751 752 752 753 m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId)); … … 770 771 771 772 ErrorString errorString; 772 Ref Ptr<WebKitNamedFlow> protector(namedFlow);773 Ref<WebKitNamedFlow> protect(*namedFlow); 773 774 774 775 m_frontend->regionOversetChanged(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId)); -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r154558 r154962 63 63 #include "TextResourceDecoder.h" 64 64 #include <wtf/Assertions.h> 65 #include <wtf/Ref.h> 65 66 #include <wtf/text/CString.h> 66 67 #include <wtf/text/WTFString.h> … … 250 251 { 251 252 RefPtr<Frame> protectFrame(m_frame); 252 Ref Ptr<DocumentLoader> protectLoader(this);253 Ref<DocumentLoader> protectLoader(*this); 253 254 254 255 // In some rare cases, calling FrameLoader::stopLoading could cause isLoading() to return false. … … 362 363 #endif 363 364 364 Ref Ptr<DocumentLoader> protect(this);365 Ref<DocumentLoader> protect(*this); 365 366 366 367 if (m_identifierForLoadWithoutResourceLoader) { … … 562 563 { 563 564 ASSERT_UNUSED(resource, m_mainResource == resource); 564 Ref Ptr<DocumentLoader> protect(this);565 Ref<DocumentLoader> protect(*this); 565 566 bool willLoadFallback = m_applicationCacheHost->maybeLoadFallbackForMainResponse(request(), response); 566 567 … … 732 733 // by starting a new load, so retain temporarily. 733 734 RefPtr<Frame> protectFrame(m_frame); 734 Ref Ptr<DocumentLoader> protectLoader(this);735 Ref<DocumentLoader> protectLoader(*this); 735 736 736 737 commitIfReady(); … … 915 916 ASSERT(m_frame); 916 917 RefPtr<Frame> protectFrame(m_frame); 917 Ref Ptr<DocumentLoader> protectLoader(this);918 Ref<DocumentLoader> protectLoader(*this); 918 919 919 920 // It never makes sense to have a document loader that is detached from its … … 1420 1421 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) 1421 1422 { 1422 Ref Ptr<DocumentLoader> protect(this);1423 Ref<DocumentLoader> protect(*this); 1423 1424 ResourceError error = resourceError.isNull() ? frameLoader()->cancelledError(m_request) : resourceError; 1424 1425 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r154142 r154962 49 49 #include "ThreadableLoaderClient.h" 50 50 #include <wtf/Assertions.h> 51 #include <wtf/Ref.h> 51 52 52 53 #if ENABLE(INSPECTOR) … … 145 146 void DocumentThreadableLoader::cancel() 146 147 { 147 Ref Ptr<DocumentThreadableLoader> protect(this);148 Ref<DocumentThreadableLoader> protect(*this); 148 149 149 150 // Cancel can re-enter and m_resource might be null here as a result. … … 181 182 ASSERT_UNUSED(resource, resource == m_resource); 182 183 183 Ref Ptr<DocumentThreadableLoader> protect(this);184 Ref<DocumentThreadableLoader> protect(*this); 184 185 // Allow same origin requests to continue after allowing clients to audit the redirect. 185 186 if (isAllowedRedirect(request.url())) { -
trunk/Source/WebCore/loader/DocumentWriter.cpp
r154558 r154962 47 47 #include "SinkDocument.h" 48 48 #include "TextResourceDecoder.h" 49 #include <wtf/Ref.h> 49 50 50 51 namespace WebCore { … … 234 235 // The frame's last ref may be removed and it can be deleted by checkCompleted(), 235 236 // so we'll add a protective refcount 236 Ref Ptr<Frame> protector(m_frame);237 Ref<Frame> protect(*m_frame); 237 238 238 239 if (!m_parser) -
trunk/Source/WebCore/loader/FrameLoader.cpp
r154715 r154962 109 109 #include "XMLDocumentParser.h" 110 110 #include <wtf/CurrentTime.h> 111 #include <wtf/Ref.h> 111 112 #include <wtf/StdLibExtras.h> 112 113 #include <wtf/text/CString.h> … … 304 305 ASSERT(!m_suppressOpenerInNewFrame); 305 306 306 Ref Ptr<Frame> protect(&m_frame);307 Ref<Frame> protect(m_frame); 307 308 FrameLoadRequest frameRequest(passedRequest); 308 309 … … 477 478 // http://bugs.webkit.org/show_bug.cgi?id=10854 478 479 // The frame's last ref may be removed and it will be deleted by checkCompleted(). 479 Ref Ptr<Frame> protector(&m_frame);480 Ref<Frame> protect(m_frame); 480 481 481 482 if (DocumentParser* parser = m_frame.document()->parser()) { … … 758 759 void FrameLoader::checkCompleted() 759 760 { 760 Ref Ptr<Frame> protect(&m_frame);761 Ref<Frame> protect(m_frame); 761 762 m_shouldCallCheckCompleted = false; 762 763 … … 803 804 void FrameLoader::checkTimerFired(Timer<FrameLoader>*) 804 805 { 805 Ref Ptr<Frame> protect(&m_frame);806 Ref<Frame> protect(m_frame); 806 807 807 808 if (Page* page = m_frame.page()) { … … 1090 1091 void FrameLoader::completed() 1091 1092 { 1092 Ref Ptr<Frame> protect(&m_frame);1093 Ref<Frame> protect(m_frame); 1093 1094 1094 1095 for (Frame* descendant = m_frame.tree().traverseNext(&m_frame); descendant; descendant = descendant->tree().traverseNext(&m_frame)) … … 1155 1156 { 1156 1157 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in loadWithDocumentLoader. 1157 Ref Ptr<Frame> protect(&m_frame);1158 Ref<Frame> protect(m_frame); 1158 1159 1159 1160 KURL url = request.resourceRequest().url(); … … 1366 1367 { 1367 1368 // Retain because dispatchBeforeLoadEvent may release the last reference to it. 1368 Ref Ptr<Frame> protect(&m_frame);1369 Ref<Frame> protect(m_frame); 1369 1370 1370 1371 ASSERT(m_client.hasWebView()); … … 1563 1564 // Calling stopLoading() on the provisional document loader can blow away 1564 1565 // the frame from underneath. 1565 Ref Ptr<Frame> protect(&m_frame);1566 Ref<Frame> protect(m_frame); 1566 1567 1567 1568 m_inStopAllLoaders = true; … … 1701 1702 RefPtr<CachedPage> cachedPage = m_loadingFromCachedPage ? pageCache()->get(history().provisionalItem()) : 0; 1702 1703 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; 1703 Ref Ptr<Frame> protect(&m_frame);1704 Ref<Frame> protect(m_frame); 1704 1705 1705 1706 LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from previous URL '%s' to new URL '%s'", m_frame.tree().uniqueName().string().utf8().data(), … … 2615 2616 { 2616 2617 // Retain because the stop may release the last reference to it. 2617 Ref Ptr<Frame> protect(&m_frame);2618 Ref<Frame> protect(m_frame); 2618 2619 2619 2620 RefPtr<DocumentLoader> loader = activeDocumentLoader(); -
trunk/Source/WebCore/loader/NavigationScheduler.cpp
r154558 r154962 51 51 #include "UserGestureIndicator.h" 52 52 #include <wtf/CurrentTime.h> 53 #include <wtf/Ref.h> 53 54 54 55 namespace WebCore { … … 421 422 } 422 423 423 Ref Ptr<Frame> protect(m_frame);424 Ref<Frame> protect(*m_frame); 424 425 425 426 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); … … 432 433 ASSERT(m_frame->page()); 433 434 434 Ref Ptr<Frame> protect(m_frame);435 Ref<Frame> protect(*m_frame); 435 436 436 437 // If a redirect was scheduled during a load, then stop the current load. -
trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
r154449 r154962 33 33 #include "FrameLoader.h" 34 34 #include "FrameLoaderClient.h" 35 #include <wtf/Ref.h> 35 36 36 37 namespace WebCore { … … 69 70 void NetscapePlugInStreamLoader::didReceiveResponse(const ResourceResponse& response) 70 71 { 71 Ref Ptr<NetscapePlugInStreamLoader> protect(this);72 Ref<NetscapePlugInStreamLoader> protect(*this); 72 73 73 74 m_client->didReceiveResponse(this, response); … … 106 107 void NetscapePlugInStreamLoader::didReceiveDataOrBuffer(const char* data, int length, PassRefPtr<SharedBuffer> buffer, long long encodedDataLength, DataPayloadType dataPayloadType) 107 108 { 108 Ref Ptr<NetscapePlugInStreamLoader> protect(this);109 Ref<NetscapePlugInStreamLoader> protect(*this); 109 110 110 111 m_client->didReceiveData(this, buffer ? buffer->data() : data, buffer ? buffer->size() : length); … … 115 116 void NetscapePlugInStreamLoader::didFinishLoading(double finishTime) 116 117 { 117 Ref Ptr<NetscapePlugInStreamLoader> protect(this);118 Ref<NetscapePlugInStreamLoader> protect(*this); 118 119 119 120 m_documentLoader->removePlugInStreamLoader(this); … … 124 125 void NetscapePlugInStreamLoader::didFail(const ResourceError& error) 125 126 { 126 Ref Ptr<NetscapePlugInStreamLoader> protect(this);127 Ref<NetscapePlugInStreamLoader> protect(*this); 127 128 128 129 m_documentLoader->removePlugInStreamLoader(this); -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r154449 r154962 50 50 #include "Settings.h" 51 51 #include "SharedBuffer.h" 52 #include <wtf/Ref.h> 52 53 53 54 namespace WebCore { … … 78 79 // We need to retain to avoid accessing the object after it 79 80 // has been deallocated and also to avoid reentering this method. 80 Ref Ptr<ResourceLoader> protector(this);81 Ref<ResourceLoader> protect(*this); 81 82 82 83 m_frame = 0; … … 225 226 // Protect this in this delegate method since the additional processing can do 226 227 // anything including possibly derefing this; one example of this is Radar 3266216. 227 Ref Ptr<ResourceLoader> protector(this);228 Ref<ResourceLoader> protect(*this); 228 229 229 230 ASSERT(!m_reachedTerminalState); … … 266 267 // Protect this in this delegate method since the additional processing can do 267 268 // anything including possibly derefing this; one example of this is Radar 3266216. 268 Ref Ptr<ResourceLoader> protector(this);269 Ref<ResourceLoader> protect(*this); 269 270 270 271 m_response = r; … … 300 301 // Protect this in this delegate method since the additional processing can do 301 302 // anything including possibly derefing this; one example of this is Radar 3266216. 302 Ref Ptr<ResourceLoader> protector(this);303 Ref<ResourceLoader> protect(*this); 303 304 RefPtr<SharedBuffer> buffer = prpBuffer; 304 305 … … 355 356 // Protect this in this delegate method since the additional processing can do 356 357 // anything including possibly derefing this; one example of this is Radar 3266216. 357 Ref Ptr<ResourceLoader> protector(this);358 Ref<ResourceLoader> protect(*this); 358 359 359 360 cleanupForError(error); … … 396 397 // willCancel() and didFailToLoad() both call out to clients that might do 397 398 // something causing the last reference to this object to go away. 398 Ref Ptr<ResourceLoader> protector(this);399 Ref<ResourceLoader> protect(*this); 399 400 400 401 // If we re-enter cancel() from inside willCancel(), we want to pick up from where we left … … 511 512 return false; 512 513 513 Ref Ptr<ResourceLoader> protector(this);514 Ref<ResourceLoader> protect(*this); 514 515 return frameLoader()->client().shouldUseCredentialStorage(documentLoader(), identifier()); 515 516 } … … 521 522 // Protect this in this delegate method since the additional processing can do 522 523 // anything including possibly derefing this; one example of this is Radar 3266216. 523 Ref Ptr<ResourceLoader> protector(this);524 Ref<ResourceLoader> protect(*this); 524 525 525 526 if (m_options.allowCredentials == AllowStoredCredentials) { … … 543 544 // Protect this in this delegate method since the additional processing can do 544 545 // anything including possibly derefing this; one example of this is Radar 3266216. 545 Ref Ptr<ResourceLoader> protector(this);546 Ref<ResourceLoader> protect(*this); 546 547 frameLoader()->notifier()->didCancelAuthenticationChallenge(this, challenge); 547 548 } … … 550 551 bool ResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) 551 552 { 552 Ref Ptr<ResourceLoader> protector(this);553 Ref<ResourceLoader> protect(*this); 553 554 return frameLoader()->client().canAuthenticateAgainstProtectionSpace(documentLoader(), identifier(), protectionSpace); 554 555 } -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r153072 r154962 40 40 #include "PageActivityAssertionToken.h" 41 41 #include "ResourceBuffer.h" 42 #include <wtf/Ref.h> 42 43 #include <wtf/RefCountedLeakCounter.h> 43 44 #include <wtf/StdLibExtras.h> … … 124 125 // Store the previous URL because the call to ResourceLoader::willSendRequest will modify it. 125 126 KURL previousURL = request().url(); 126 Ref Ptr<SubresourceLoader> protect(this);127 Ref<SubresourceLoader> protect(*this); 127 128 128 129 ASSERT(!newRequest.isNull()); … … 159 160 { 160 161 ASSERT(m_state == Initialized); 161 Ref Ptr<SubresourceLoader> protect(this);162 Ref<SubresourceLoader> protect(*this); 162 163 m_resource->didSendData(bytesSent, totalBytesToBeSent); 163 164 } … … 170 171 // Reference the object in this method since the additional processing can do 171 172 // anything including removing the last reference to this object; one example of this is 3266216. 172 Ref Ptr<SubresourceLoader> protect(this);173 Ref<SubresourceLoader> protect(*this); 173 174 174 175 if (m_resource->resourceToRevalidate()) { … … 241 242 // Reference the object in this method since the additional processing can do 242 243 // anything including removing the last reference to this object; one example of this is 3266216. 243 Ref Ptr<SubresourceLoader> protect(this);244 Ref<SubresourceLoader> protect(*this); 244 245 RefPtr<SharedBuffer> buffer = prpBuffer; 245 246 … … 275 276 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data()); 276 277 277 Ref Ptr<SubresourceLoader> protect(this);278 Ref<SubresourceLoader> protect(*this); 278 279 CachedResourceHandle<CachedResource> protectResource(m_resource); 279 280 m_state = Finishing; … … 300 301 LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data()); 301 302 302 Ref Ptr<SubresourceLoader> protect(this);303 Ref<SubresourceLoader> protect(*this); 303 304 CachedResourceHandle<CachedResource> protectResource(m_resource); 304 305 m_state = Finishing; … … 324 325 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string().latin1().data()); 325 326 326 Ref Ptr<SubresourceLoader> protect(this);327 Ref<SubresourceLoader> protect(*this); 327 328 m_state = Finishing; 328 329 m_activityAssertion.clear(); -
trunk/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp
r133233 r154962 26 26 #include "SubresourceLoader.h" 27 27 28 #include <wtf/Ref.h> 29 28 30 namespace WebCore { 29 31 … … 33 35 // Reference the object in this method since the additional processing can do 34 36 // anything including removing the last reference to this object; one example of this is 3266216. 35 Ref Ptr<SubresourceLoader> protect(this);37 Ref<SubresourceLoader> protect(*this); 36 38 37 39 ResourceLoader::didReceiveDataArray(dataArray); -
trunk/Source/WebCore/page/DOMWindow.cpp
r154715 r154962 106 106 #include <wtf/MainThread.h> 107 107 #include <wtf/MathExtras.h> 108 #include <wtf/Ref.h> 108 109 #include <wtf/text/Base64.h> 109 110 #include <wtf/text/WTFString.h> … … 1719 1720 bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget) 1720 1721 { 1721 Ref Ptr<EventTarget> protect = this;1722 Ref<EventTarget> protect(*this); 1722 1723 RefPtr<Event> event = prpEvent; 1723 1724 -
trunk/Source/WebCore/page/DOMWindowExtension.cpp
r154449 r154962 32 32 #include "FrameLoader.h" 33 33 #include "FrameLoaderClient.h" 34 #include <wtf/Ref.h> 34 35 35 36 namespace WebCore { … … 48 49 // Calling out to the client might result in this DOMWindowExtension being destroyed 49 50 // while there is still work to do. 50 Ref Ptr<DOMWindowExtension> protector = this;51 Ref<DOMWindowExtension> protect(*this); 51 52 52 53 Frame* frame = this->frame(); … … 74 75 // Calling out to the client might result in this DOMWindowExtension being destroyed 75 76 // while there is still work to do. 76 Ref Ptr<DOMWindowExtension> protector = this;77 77 Ref<DOMWindowExtension> protect(*this); 78 78 79 m_disconnectedFrame->loader().client().dispatchWillDestroyGlobalObjectForDOMWindowExtension(this); 79 80 m_disconnectedFrame = 0; … … 88 89 // Calling out to the client might result in this DOMWindowExtension being destroyed 89 90 // while there is still work to do. 90 Ref Ptr<DOMWindowExtension> protector = this;91 Ref<DOMWindowExtension> protect(*this); 91 92 92 93 if (!m_wasDetached) { … … 106 107 // Calling out to the client might result in this DOMWindowExtension being destroyed 107 108 // while there is still work to do. 108 Ref Ptr<DOMWindowExtension> protector = this;109 Ref<DOMWindowExtension> protect(*this); 109 110 110 111 Frame* frame = this->frame(); -
trunk/Source/WebCore/page/FocusController.cpp
r154877 r154962 62 62 #include "htmlediting.h" // For firstPositionInOrBeforeNode 63 63 #include <limits> 64 #include <wtf/Ref.h> 64 65 65 66 namespace WebCore { … … 632 633 setFocusedFrame(newFocusedFrame); 633 634 634 Ref Ptr<Element> protect(element);635 Ref<Element> protect(*element); 635 636 if (newDocument) { 636 637 bool successfullyFocused = newDocument->setFocusedElement(element, direction); -
trunk/Source/WebCore/page/FrameView.cpp
r154937 r154962 79 79 80 80 #include <wtf/CurrentTime.h> 81 #include <wtf/Ref.h> 81 82 #include <wtf/TemporaryChange.h> 82 83 … … 1116 1117 1117 1118 // Protect the view from being deleted during layout (in recalcStyle) 1118 Ref Ptr<FrameView> protector(this);1119 Ref<FrameView> protect(*this); 1119 1120 1120 1121 // Every scroll that happens during layout is programmatic. … … 1184 1185 // If there is only one ref to this view left, then its going to be destroyed as soon as we exit, 1185 1186 // so there's no point to continuing to layout 1186 if ( protector->hasOneRef())1187 if (hasOneRef()) 1187 1188 return; 1188 1189 … … 2760 2761 // layout() protects FrameView, but it still can get destroyed when updateWidgets() 2761 2762 // is called through the post layout timer. 2762 Ref Ptr<FrameView> protector(this);2763 Ref<FrameView> protect(*this); 2763 2764 for (unsigned i = 0; i < maxUpdateWidgetsIterations; i++) { 2764 2765 if (updateWidgets()) -
trunk/Source/WebCore/page/animation/AnimationBase.cpp
r154877 r154962 43 43 #include <algorithm> 44 44 #include <wtf/CurrentTime.h> 45 #include <wtf/Ref.h> 45 46 46 47 using namespace std; … … 454 455 // and it ref counts this object, we will keep a ref to that instead. That way the AnimationBase 455 456 // can still access the resources of its CompositeAnimation as needed. 456 Ref Ptr<AnimationBase> protector(this);457 Ref Ptr<CompositeAnimation> compProtector(m_compAnim);457 Ref<AnimationBase> protect(*this); 458 Ref<CompositeAnimation> protectCompositeAnimation(*m_compAnim); 458 459 459 460 // Check for start timeout -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp
r131131 r154962 31 31 32 32 #include <wtf/CurrentTime.h> 33 #include <wtf/Ref.h> 33 34 34 35 namespace WebCore { … … 106 107 // The call back can cause all our clients to be unregistered, so we need to protect 107 108 // against deletion until the end of the method. 108 Ref Ptr<DisplayRefreshMonitor> protector(this);109 Ref<DisplayRefreshMonitor> protect(*this); 109 110 110 111 Vector<DisplayRefreshMonitorClient*> clients; -
trunk/Source/WebCore/platform/mac/WidgetMac.mm
r153917 r154962 41 41 #import "WebCoreFrameView.h" 42 42 #import "WebCoreView.h" 43 #import <wtf/Ref.h> 43 44 #import <wtf/RetainPtr.h> 44 45 … … 171 172 // Take a reference to this Widget, because sending messages to outerView can invoke arbitrary 172 173 // code, which can deref it. 173 Ref Ptr<Widget> protectedThis(this);174 Ref<Widget> protect(*this); 174 175 175 176 NSRect visibleRect = [outerView visibleRect]; … … 213 214 // Take a reference to this Widget, because sending messages to the views can invoke arbitrary 214 215 // code, which can deref it. 215 Ref Ptr<Widget> protectedThis(this);216 Ref<Widget> protect(*this); 216 217 217 218 NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; -
trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp
r148068 r154962 47 47 #include "SharedBuffer.h" 48 48 #include <wtf/MainThread.h> 49 #include <wtf/Ref.h> 49 50 50 51 namespace WebCore { … … 246 247 getSizeForNext(); 247 248 else { 248 Ref Ptr<BlobResourceHandle> protect(this); // getSizeForNext calls the client249 Ref<BlobResourceHandle> protect(*this); // getSizeForNext calls the client 249 250 for (size_t i = 0; i < m_blobData->items().size() && !m_aborted && !m_errorCode; ++i) 250 251 getSizeForNext(); … … 261 262 // Start reading if in asynchronous mode. 262 263 if (m_async) { 263 Ref Ptr<BlobResourceHandle> protect(this);264 Ref<BlobResourceHandle> protect(*this); 264 265 notifyResponse(); 265 266 m_buffer.resize(bufferSize); … … 346 347 { 347 348 ASSERT(!m_async); 348 Ref Ptr<BlobResourceHandle> protect(this);349 Ref<BlobResourceHandle> protect(*this); 349 350 350 351 int offset = 0; … … 468 469 { 469 470 ASSERT(m_async); 470 Ref Ptr<BlobResourceHandle> protect(this);471 Ref<BlobResourceHandle> protect(*this); 471 472 472 473 long long bytesToRead = item.length - m_currentItemReadSize; … … 520 521 { 521 522 ASSERT(m_async); 522 Ref Ptr<BlobResourceHandle> protect(this);523 Ref<BlobResourceHandle> protect(*this); 523 524 524 525 m_totalRemainingSize -= bytesRead; … … 550 551 { 551 552 ASSERT(m_async); 552 Ref Ptr<BlobResourceHandle> protect(this);553 Ref<BlobResourceHandle> protect(*this); 553 554 554 555 // Notify the client. … … 568 569 569 570 if (m_errorCode) { 570 Ref Ptr<BlobResourceHandle> protect(this);571 Ref<BlobResourceHandle> protect(*this); 571 572 notifyResponseOnError(); 572 573 notifyFinish(); -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r149255 r154962 48 48 #include <sys/types.h> 49 49 #include <wtf/HashMap.h> 50 #include <wtf/Ref.h> 50 51 #include <wtf/Threading.h> 51 52 #include <wtf/text/Base64.h> … … 503 504 } 504 505 505 Ref Ptr<ResourceHandle> protect(this);506 Ref<ResourceHandle> protect(*this); 506 507 client()->willSendRequest(this, request, redirectResponse); 507 508 -
trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
r154314 r154962 52 52 #import "WebCoreSystemInterface.h" 53 53 #import "WebCoreURLResponse.h" 54 #import <wtf/Ref.h> 54 55 #import <wtf/SchedulePair.h> 55 56 #import <wtf/text/Base64.h> … … 390 391 client()->willSendRequestAsync(this, request, redirectResponse); 391 392 } else { 392 Ref Ptr<ResourceHandle> protect(this);393 Ref<ResourceHandle> protect(*this); 393 394 client()->willSendRequest(this, request, redirectResponse); 394 395 -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r154877 r154962 34 34 #include "RenderWidgetProtector.h" 35 35 #include <wtf/StackStats.h> 36 #include <wtf/Ref.h> 36 37 37 38 #if USE(ACCELERATED_COMPOSITING) … … 154 155 155 156 RenderWidgetProtector protector(this); 156 Ref Ptr<Node> protectedNode(node());157 Ref<Node> protectNode(*node()); 157 158 m_widget->setFrameRect(newFrame); 158 159 -
trunk/Source/WebCore/workers/WorkerScriptLoader.cpp
r152080 r154962 41 41 #include "WorkerThreadableLoader.h" 42 42 #include <wtf/OwnPtr.h> 43 #include <wtf/Ref.h> 43 44 #include <wtf/RefPtr.h> 44 45 … … 91 92 92 93 // During create, callbacks may happen which remove the last reference to this object. 93 Ref Ptr<WorkerScriptLoader> protect(this);94 Ref<WorkerScriptLoader> protect(*this); 94 95 m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, options); 95 96 } -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r154800 r154962 63 63 #include <runtime/JSLock.h> 64 64 #include <runtime/Operations.h> 65 #include <wtf/Ref.h> 65 66 #include <wtf/RefCountedLeakCounter.h> 66 67 #include <wtf/StdLibExtras.h> … … 823 824 { 824 825 // internalAbort() calls dropProtection(), which may release the last reference. 825 Ref Ptr<XMLHttpRequest> protect(this);826 Ref<XMLHttpRequest> protect(*this); 826 827 827 828 bool sendFlag = m_loader; … … 1242 1243 { 1243 1244 // internalAbort() calls dropProtection(), which may release the last reference. 1244 Ref Ptr<XMLHttpRequest> protect(this);1245 Ref<XMLHttpRequest> protect(*this); 1245 1246 internalAbort(); 1246 1247 -
trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp
r154877 r154962 51 51 #include "TreeDepthLimit.h" 52 52 #include "XMLErrors.h" 53 #include <wtf/Ref.h> 53 54 #include <wtf/StringExtras.h> 54 55 #include <wtf/Threading.h> … … 257 258 258 259 // JavaScript can detach this parser, make sure it's kept alive even if detached. 259 Ref Ptr<XMLDocumentParser> protect(this);260 Ref<XMLDocumentParser> protect(*this); 260 261 261 262 if (errorOccurred) -
trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
r154903 r154962 62 62 #include <libxml/parser.h> 63 63 #include <libxml/parserInternals.h> 64 #include <wtf/ text/CString.h>64 #include <wtf/Ref.h> 65 65 #include <wtf/StringExtras.h> 66 66 #include <wtf/Threading.h> 67 67 #include <wtf/Vector.h> 68 #include <wtf/text/CString.h> 68 69 #include <wtf/unicode/UTF8.h> 69 70 … … 685 686 // JavaScript may cause the parser to detach during xmlParseChunk 686 687 // keep this alive until this function is done. 687 Ref Ptr<XMLDocumentParser> protect(this);688 Ref<XMLDocumentParser> protect(*this); 688 689 689 690 switchToUTF16(context->context()); … … 884 885 // JavaScript can detach the parser. Make sure this is not released 885 886 // before the end of this method. 886 Ref Ptr<XMLDocumentParser> protect(this);887 Ref<XMLDocumentParser> protect(*this); 887 888 888 889 exitText();
Note: See TracChangeset
for help on using the changeset viewer.