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

Side by Side Diff: Source/core/dom/MutationObserver.cpp

Issue 85263006: Make IDL Callbacks non-refcounted by default (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refinements Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 static unsigned s_observerPriority = 0; 50 static unsigned s_observerPriority = 0;
51 51
52 struct MutationObserver::ObserverLessThan { 52 struct MutationObserver::ObserverLessThan {
53 bool operator()(const RefPtr<MutationObserver>& lhs, const RefPtr<MutationOb server>& rhs) 53 bool operator()(const RefPtr<MutationObserver>& lhs, const RefPtr<MutationOb server>& rhs)
54 { 54 {
55 return lhs->m_priority < rhs->m_priority; 55 return lhs->m_priority < rhs->m_priority;
56 } 56 }
57 }; 57 };
58 58
59 PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallbac k> callback) 59 PassRefPtr<MutationObserver> MutationObserver::create(PassOwnPtr<MutationCallbac k> callback)
60 { 60 {
61 ASSERT(isMainThread()); 61 ASSERT(isMainThread());
62 return adoptRef(new MutationObserver(callback)); 62 return adoptRef(new MutationObserver(callback));
63 } 63 }
64 64
65 MutationObserver::MutationObserver(PassRefPtr<MutationCallback> callback) 65 MutationObserver::MutationObserver(PassOwnPtr<MutationCallback> callback)
66 : m_callback(callback) 66 : m_callback(callback)
67 , m_priority(s_observerPriority++) 67 , m_priority(s_observerPriority++)
68 { 68 {
69 ScriptWrappable::init(this); 69 ScriptWrappable::init(this);
70 } 70 }
71 71
72 MutationObserver::~MutationObserver() 72 MutationObserver::~MutationObserver()
73 { 73 {
74 ASSERT(m_registrations.isEmpty()); 74 ASSERT(m_registrations.isEmpty());
75 } 75 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 observers[i]->deliver(); 259 observers[i]->deliver();
260 else 260 else
261 suspendedMutationObservers().add(observers[i]); 261 suspendedMutationObservers().add(observers[i]);
262 } 262 }
263 } 263 }
264 264
265 deliveryInProgress = false; 265 deliveryInProgress = false;
266 } 266 }
267 267
268 } // namespace WebCore 268 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698