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

Side by Side Diff: Source/core/dom/custom/CustomElementMicrotaskQueue.cpp

Issue 296703009: Oilpan: move custom element objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compilation issue pointed out by clang Created 6 years, 7 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 CustomElementMicrotaskQueue* m_queue; 68 CustomElementMicrotaskQueue* m_queue;
69 69
70 static MicrotaskQueueInvocationScope* s_top; 70 static MicrotaskQueueInvocationScope* s_top;
71 #endif 71 #endif
72 }; 72 };
73 73
74 #if !defined(NDEBUG) 74 #if !defined(NDEBUG)
75 MicrotaskQueueInvocationScope* MicrotaskQueueInvocationScope::s_top = 0; 75 MicrotaskQueueInvocationScope* MicrotaskQueueInvocationScope::s_top = 0;
76 #endif 76 #endif
77 77
78 void CustomElementMicrotaskQueue::enqueue(PassOwnPtr<CustomElementMicrotaskStep> step) 78 void CustomElementMicrotaskQueue::enqueue(PassOwnPtrWillBeRawPtr<CustomElementMi crotaskStep> step)
79 { 79 {
80 m_queue.append(step); 80 m_queue.append(step);
81 } 81 }
82 82
83 CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch() 83 CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch()
84 { 84 {
85 MicrotaskQueueInvocationScope scope(this); 85 MicrotaskQueueInvocationScope scope(this);
86 Vector<OwnPtr<CustomElementMicrotaskStep> > remaining; 86 WillBeHeapVector<OwnPtrWillBeMember<CustomElementMicrotaskStep> > remaining;
87 Result accumulatedResult = CustomElementMicrotaskStep::ContinueWithRemoving; 87 Result accumulatedResult = CustomElementMicrotaskStep::ContinueWithRemoving;
88 88
89 unsigned i; 89 unsigned i;
90 for (i = 0; i < m_queue.size(); ++i) { 90 for (i = 0; i < m_queue.size(); ++i) {
91 Result result = m_queue[i]->process(); 91 Result result = m_queue[i]->process();
92 accumulatedResult = CustomElementMicrotaskStep::Result(result | accumula tedResult); 92 accumulatedResult = CustomElementMicrotaskStep::Result(result | accumula tedResult);
93 if (result & CustomElementMicrotaskStep::ShouldRemain) 93 if (result & CustomElementMicrotaskStep::ShouldRemain)
94 remaining.append(m_queue[i].release()); 94 remaining.append(m_queue[i].release());
95 if (result & CustomElementMicrotaskStep::ShouldStop) 95 if (result & CustomElementMicrotaskStep::ShouldStop)
96 break; 96 break;
97 } 97 }
98 98
99 for (++i; i < m_queue.size(); ++i) 99 for (++i; i < m_queue.size(); ++i)
100 remaining.append(m_queue[i].release()); 100 remaining.append(m_queue[i].release());
101 m_queue.swap(remaining); 101 m_queue.swap(remaining);
102 102
103 return accumulatedResult; 103 return accumulatedResult;
104 } 104 }
105 105
106 bool CustomElementMicrotaskQueue::needsProcessOrStop() const 106 bool CustomElementMicrotaskQueue::needsProcessOrStop() const
107 { 107 {
108 for (size_t i = 0; i < m_queue.size(); ++i) { 108 for (size_t i = 0; i < m_queue.size(); ++i) {
109 if (m_queue[i]->needsProcessOrStop()) 109 if (m_queue[i]->needsProcessOrStop())
110 return true; 110 return true;
111 } 111 }
112 112
113 return false; 113 return false;
114 } 114 }
115 115
116 void CustomElementMicrotaskQueue::trace(Visitor* visitor)
117 {
118 visitor->trace(m_queue);
119 }
120
116 #if !defined(NDEBUG) 121 #if !defined(NDEBUG)
117 void CustomElementMicrotaskQueue::show(unsigned indent) 122 void CustomElementMicrotaskQueue::show(unsigned indent)
118 { 123 {
119 for (unsigned q = 0; q < m_queue.size(); ++q) { 124 for (unsigned q = 0; q < m_queue.size(); ++q) {
120 if (m_queue[q]) 125 if (m_queue[q])
121 m_queue[q]->show(indent); 126 m_queue[q]->show(indent);
122 else 127 else
123 fprintf(stderr, "%*snull\n", indent, ""); 128 fprintf(stderr, "%*snull\n", indent, "");
124 } 129 }
125 } 130 }
126 #endif 131 #endif
127 132
128 } // namespace WebCore 133 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElementMicrotaskQueue.h ('k') | Source/core/dom/custom/CustomElementMicrotaskResolutionStep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698