本文整理汇总了C++中WillBeHeapVector类的典型用法代码示例。如果您正苦于以下问题:C++ WillBeHeapVector类的具体用法?C++ WillBeHeapVector怎么用?C++ WillBeHeapVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WillBeHeapVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ASSERT
void MutationObserver::deliver()
{
ASSERT(!shouldBeSuspended());
// Calling clearTransientRegistrations() can modify m_registrations, so it's necessary
// to make a copy of the transient registrations before operating on them.
WillBeHeapVector<RawPtrWillBeMember<MutationObserverRegistration>, 1> transientRegistrations;
for (auto& registration : m_registrations) {
if (registration->hasTransientRegistrations())
transientRegistrations.append(registration);
}
for (size_t i = 0; i < transientRegistrations.size(); ++i)
transientRegistrations[i]->clearTransientRegistrations();
if (m_records.isEmpty())
return;
MutationRecordVector records;
records.swap(m_records);
InspectorInstrumentation::willDeliverMutationRecords(m_callback->executionContext(), this);
m_callback->call(records, this);
InspectorInstrumentation::didDeliverMutationRecords(m_callback->executionContext());
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:24,代码来源:MutationObserver.cpp
示例2: getNamedItems
static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name, const CallbackInfo& info)
{
WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems;
collection->namedItems(name, namedItems);
if (!namedItems.size())
return v8Undefined();
if (namedItems.size() == 1)
return toV8(namedItems.at(0).release(), info.Holder(), info.GetIsolate());
// FIXME: HTML5 specification says this should be a HTMLCollection.
// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
//
// FIXME: Oilpan: explicitly convert adopt()'s result so as to
// disambiguate the (implicit) conversion of its
// PassRefPtrWillBeRawPtr<StaticElementList> result -- the
// other toV8() overload that introduces the ambiguity is
// toV8(NodeList*, ...).
//
// When adopt() no longer uses transition types, the conversion
// can be removed.
return toV8(PassRefPtrWillBeRawPtr<NodeList>(StaticElementList::adopt(namedItems)), info.Holder(), info.GetIsolate());
}
开发者ID:335969568,项目名称:Blink-1,代码行数:24,代码来源:V8HTMLAllCollectionCustom.cpp
示例3: interpolateLists
bool AnimatableRepeatable::interpolateLists(const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& fromValues, const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& toValues, double fraction, WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& interpolatedValues)
{
// Interpolation behaviour spec: http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list
ASSERT(interpolatedValues.isEmpty());
ASSERT(!fromValues.isEmpty() && !toValues.isEmpty());
size_t size = lowestCommonMultiple(fromValues.size(), toValues.size());
ASSERT(size > 0);
for (size_t i = 0; i < size; ++i) {
const AnimatableValue* from = fromValues[i % fromValues.size()].get();
const AnimatableValue* to = toValues[i % toValues.size()].get();
// Spec: If a pair of values cannot be interpolated, then the lists are not interpolable.
if (AnimatableValue::usesDefaultInterpolation(from, to))
return false;
interpolatedValues.append(interpolate(from, to, fraction));
}
return true;
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:17,代码来源:AnimatableRepeatable.cpp
示例4: activeLoadingStyleSheetLoaded
bool TreeScopeStyleSheetCollection::activeLoadingStyleSheetLoaded(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>>& newStyleSheets)
{
// StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
bool hasActiveLoadingStylesheet = false;
unsigned newStylesheetCount = newStyleSheets.size();
for (unsigned i = 0; i < newStylesheetCount; ++i) {
if (newStyleSheets[i]->isLoading())
hasActiveLoadingStylesheet = true;
}
if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
m_hadActiveLoadingStylesheet = false;
return true;
}
m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
return false;
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:16,代码来源:TreeScopeStyleSheetCollection.cpp
示例5: collectDestinationInsertionPoints
void collectDestinationInsertionPoints(const Node& node, WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8>& results)
{
const Node* current = &node;
ElementShadow* lastElementShadow = 0;
while (true) {
ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*current);
if (!shadow || shadow == lastElementShadow)
return;
lastElementShadow = shadow;
const DestinationInsertionPoints* insertionPoints = shadow->destinationInsertionPointsFor(&node);
if (!insertionPoints)
return;
for (size_t i = 0; i < insertionPoints->size(); ++i)
results.append(insertionPoints->at(i).get());
ASSERT(current != insertionPoints->last().get());
current = insertionPoints->last().get();
}
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:18,代码来源:InsertionPoint.cpp
示例6: adjustTouchList
void EventPath::adjustTouchList(const TouchList* touchList, WillBeHeapVector<RawPtrWillBeMember<TouchList>> adjustedTouchList, const WillBeHeapVector<RawPtrWillBeMember<TreeScope>>& treeScopes)
{
if (!touchList)
return;
for (size_t i = 0; i < touchList->length(); ++i) {
const Touch& touch = *touchList->item(i);
if (!touch.target())
continue;
Node* targetNode = touch.target()->toNode();
if (!targetNode)
continue;
RelatedTargetMap relatedNodeMap;
buildRelatedNodeMap(*targetNode, relatedNodeMap);
for (size_t j = 0; j < treeScopes.size(); ++j) {
adjustedTouchList[j]->append(touch.cloneWithNewTarget(findRelatedNode(*treeScopes[j], relatedNodeMap)));
}
}
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:20,代码来源:EventPath.cpp
示例7: ASSERT
void IdTargetObserverRegistry::notifyObserversInternal(const AtomicString& id)
{
ASSERT(!id.isEmpty());
ASSERT(!m_registry.isEmpty());
m_notifyingObserversInSet = m_registry.get(id.impl());
if (!m_notifyingObserversInSet)
return;
WillBeHeapVector<RawPtrWillBeMember<IdTargetObserver> > copy;
copyToVector(*m_notifyingObserversInSet, copy);
for (WillBeHeapVector<RawPtrWillBeMember<IdTargetObserver> >::const_iterator it = copy.begin(); it != copy.end(); ++it) {
if (m_notifyingObserversInSet->contains(*it))
(*it)->idTargetChanged();
}
if (m_notifyingObserversInSet->isEmpty())
m_registry.remove(id.impl());
m_notifyingObserversInSet = nullptr;
}
开发者ID:335969568,项目名称:Blink-1,代码行数:21,代码来源:IdTargetObserverRegistry.cpp
示例8: getNamedElements
void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, RadioNodeListOrElement& returnValue)
{
// Call getNamedElements twice, first time check if it has a value
// and let HTMLFormElement update its cache.
// See issue: 867404
{
WillBeHeapVector<RefPtrWillBeMember<Element>> elements;
getNamedElements(name, elements);
if (elements.isEmpty())
return;
}
// Second call may return different results from the first call,
// but if the first the size cannot be zero.
WillBeHeapVector<RefPtrWillBeMember<Element>> elements;
getNamedElements(name, elements);
ASSERT(!elements.isEmpty());
bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.first());
if (onlyMatchImg) {
UseCounter::count(document(), UseCounter::FormNameAccessForImageElement);
// The following code has performance impact, but it should be small
// because <img> access via <form> name getter is rarely used.
for (auto& element : elements) {
if (isHTMLImageElement(*element) && !element->isDescendantOf(this)) {
UseCounter::count(document(), UseCounter::FormNameAccessForNonDescendantImageElement);
break;
}
}
}
if (elements.size() == 1) {
returnValue.setElement(elements.at(0));
return;
}
returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg));
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:37,代码来源:HTMLFormElement.cpp
示例9: pruneSubsequentAncestorsToRemove
int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<RefPtrWillBeMember<ContainerNode>>& nodesToRemove, size_t startNodeIndex)
{
size_t pastLastNodeToRemove = startNodeIndex + 1;
for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove) {
if (nodesToRemove[pastLastNodeToRemove - 1]->parentNode() != nodesToRemove[pastLastNodeToRemove])
break;
ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemove[pastLastNodeToRemove]->lastChild());
}
ContainerNode* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove - 1].get();
RefPtrWillBeRawPtr<ContainerNode> parent = highestAncestorToRemove->parentNode();
if (!parent) // Parent has already been removed.
return -1;
if (pastLastNodeToRemove == startNodeIndex + 1)
return 0;
removeNode(nodesToRemove[startNodeIndex], AssumeContentIsAlwaysEditable);
insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, AssumeContentIsAlwaysEditable);
removeNode(highestAncestorToRemove, AssumeContentIsAlwaysEditable);
return pastLastNodeToRemove - startNodeIndex - 1;
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:23,代码来源:SimplifyMarkupCommand.cpp
示例10: updateIdNameCache
Element* HTMLCollection::namedItem(const AtomicString& name) const
{
// http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp
// This method first searches for an object with a matching id
// attribute. If a match is not found, the method then searches for an
// object with a matching name attribute, but only on those elements
// that are allowed a name attribute.
updateIdNameCache();
const NamedItemCache& cache = namedItemCache();
WillBeHeapVector<RawPtrWillBeMember<Element>>* idResults = cache.getElementsById(name);
if (idResults && !idResults->isEmpty())
return idResults->first();
WillBeHeapVector<RawPtrWillBeMember<Element>>* nameResults = cache.getElementsByName(name);
if (nameResults && !nameResults->isEmpty())
return nameResults->first();
return nullptr;
}
开发者ID:OctiumBrowser,项目名称:octium-main,代码行数:20,代码来源:HTMLCollection.cpp
示例11: protector
void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime)
{
RefPtrWillBeRawPtr<PageAnimator> protector(this);
m_animationFramePending = false;
TemporaryChange<bool> servicing(m_servicingAnimations, true);
WillBeHeapVector<RefPtrWillBeMember<Document>> documents;
for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->isLocalFrame())
documents.append(toLocalFrame(frame)->document());
}
for (size_t i = 0; i < documents.size(); ++i) {
if (documents[i]->frame()) {
documents[i]->view()->serviceScrollAnimations(monotonicAnimationStartTime);
if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = documents[i]->view()->animatingScrollableAreas()) {
// Iterate over a copy, since ScrollableAreas may deregister
// themselves during the iteration.
Vector<ScrollableArea*> animatingScrollableAreasCopy;
copyToVector(*animatingScrollableAreas, animatingScrollableAreasCopy);
for (ScrollableArea* scrollableArea : animatingScrollableAreasCopy)
scrollableArea->serviceScrollAnimations(monotonicAnimationStartTime);
}
}
}
for (size_t i = 0; i < documents.size(); ++i) {
DocumentAnimations::updateAnimationTimingForAnimationFrame(*documents[i], monotonicAnimationStartTime);
SVGDocumentExtensions::serviceOnAnimationFrame(*documents[i], monotonicAnimationStartTime);
}
for (size_t i = 0; i < documents.size(); ++i)
documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
#if ENABLE(OILPAN)
documents.clear();
#endif
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:39,代码来源:PageAnimator.cpp
示例12: ASSERT
void EventPath::calculatePath()
{
ASSERT(m_node);
ASSERT(m_nodeEventContexts.isEmpty());
m_node->updateDistribution();
// For performance and memory usage reasons we want to store the
// path using as few bytes as possible and with as few allocations
// as possible which is why we gather the data on the stack before
// storing it in a perfectly sized m_nodeEventContexts Vector.
WillBeHeapVector<RawPtrWillBeMember<Node>, 64> nodesInPath;
Node* current = m_node;
nodesInPath.append(current);
while (current) {
if (m_event && current->keepEventInNode(m_event))
break;
WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);
if (!insertionPoints.isEmpty()) {
for (const auto& insertionPoint : insertionPoints) {
if (insertionPoint->isShadowInsertionPoint()) {
ShadowRoot* containingShadowRoot = insertionPoint->containingShadowRoot();
ASSERT(containingShadowRoot);
if (!containingShadowRoot->isOldest())
nodesInPath.append(containingShadowRoot->olderShadowRoot());
}
nodesInPath.append(insertionPoint);
}
current = insertionPoints.last();
continue;
}
if (current->isShadowRoot()) {
if (m_event && shouldStopAtShadowRoot(*m_event, *toShadowRoot(current), *m_node))
break;
current = current->shadowHost();
#if !ENABLE(OILPAN)
// TODO(kochi): crbug.com/507413 This check is necessary when some asynchronous event
// is queued while its shadow host is removed and the shadow root gets the event
// immediately after it. When Oilpan is enabled, this situation does not happen.
// Except this case, shadow root's host is assumed to be non-null.
if (current)
nodesInPath.append(current);
#else
nodesInPath.append(current);
#endif
} else {
current = current->parentNode();
if (current)
nodesInPath.append(current);
}
}
m_nodeEventContexts.reserveCapacity(nodesInPath.size());
for (Node* nodeInPath : nodesInPath) {
m_nodeEventContexts.append(NodeEventContext(nodeInPath, eventTargetRespectingTargetRules(*nodeInPath)));
}
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:57,代码来源:EventPath.cpp
示例13: ASSERT
void AutomaticTrackSelection::performAutomaticTextTrackSelection(const TrackGroup& group)
{
ASSERT(group.tracks.size());
// First, find the track in the group that should be enabled (if any).
WillBeHeapVector<RefPtrWillBeMember<TextTrack>> currentlyEnabledTracks;
RefPtrWillBeRawPtr<TextTrack> trackToEnable = nullptr;
RefPtrWillBeRawPtr<TextTrack> defaultTrack = nullptr;
RefPtrWillBeRawPtr<TextTrack> preferredTrack = nullptr;
RefPtrWillBeRawPtr<TextTrack> fallbackTrack = nullptr;
int highestTrackScore = 0;
for (size_t i = 0; i < group.tracks.size(); ++i) {
RefPtrWillBeRawPtr<TextTrack> textTrack = group.tracks[i];
if (m_configuration.disableCurrentlyEnabledTracks && textTrack->mode() == TextTrack::showingKeyword())
currentlyEnabledTracks.append(textTrack);
int trackScore = textTrackSelectionScore(*textTrack);
if (textTrack->kind() == preferredTrackKind())
trackScore += 1;
if (trackScore) {
// * If the text track kind is subtitles or captions and the user has indicated an interest in having a
// track with this text track kind, text track language, and text track label enabled, and there is no
// other text track in the media element's list of text tracks with a text track kind of either subtitles
// or captions whose text track mode is showing
// Let the text track mode be showing.
if (trackScore > highestTrackScore) {
preferredTrack = textTrack;
highestTrackScore = trackScore;
}
if (!defaultTrack && textTrack->isDefault())
defaultTrack = textTrack;
if (!fallbackTrack)
fallbackTrack = textTrack;
} else if (!group.visibleTrack && !defaultTrack && textTrack->isDefault()) {
// * If the track element has a default attribute specified, and there is no other text track in the media
// element's list of text tracks whose text track mode is showing or showing by default
// Let the text track mode be showing by default.
defaultTrack = textTrack;
}
}
if (m_configuration.textTrackKindUserPreference != TextTrackKindUserPreference::Default)
trackToEnable = preferredTrack;
if (!trackToEnable && defaultTrack)
trackToEnable = defaultTrack;
if (!trackToEnable && m_configuration.forceEnableSubtitleOrCaptionTrack && group.kind == TrackGroup::CaptionsAndSubtitles)
trackToEnable = fallbackTrack ? fallbackTrack : group.tracks[0];
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
RefPtrWillBeRawPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
if (textTrack != trackToEnable)
textTrack->setMode(TextTrack::disabledKeyword());
}
}
if (trackToEnable)
trackToEnable->setMode(TextTrack::showingKeyword());
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:66,代码来源:AutomaticTrackSelection.cpp
示例14: deleteSelection
void BreakBlockquoteCommand::doApply()
{
if (endingSelection().isNone())
return;
// Delete the current selection.
if (endingSelection().isRange())
deleteSelection(false, false);
// This is a scenario that should never happen, but we want to
// make sure we don't dereference a null pointer below.
ASSERT(!endingSelection().isNone());
if (endingSelection().isNone())
return;
VisiblePosition visiblePos = endingSelection().visibleStart();
// pos is a position equivalent to the caret. We use downstream() so that pos will
// be in the first node that we need to move (there are a few exceptions to this, see below).
Position pos = mostForwardCaretPosition(endingSelection().start());
// Find the top-most blockquote from the start.
HTMLQuoteElement* topBlockquote = toHTMLQuoteElement(highestEnclosingNodeOfType(pos, isMailHTMLBlockquoteElement));
if (!topBlockquote || !topBlockquote->parentNode())
return;
RefPtrWillBeRawPtr<HTMLBRElement> breakElement = createBreakElement(document());
bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockquote);
// If the position is at the beginning of the top quoted content, we don't need to break the quote.
// Instead, insert the break before the blockquote, unless the position is as the end of the the quoted content.
if (isFirstVisiblePositionInNode(visiblePos, topBlockquote) && !isLastVisPosInNode) {
insertNodeBefore(breakElement.get(), topBlockquote);
setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()), TextAffinity::Downstream, endingSelection().isDirectional()));
rebalanceWhitespace();
return;
}
// Insert a break after the top blockquote.
insertNodeAfter(breakElement.get(), topBlockquote);
// If we're inserting the break at the end of the quoted content, we don't need to break the quote.
if (isLastVisPosInNode) {
setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()), TextAffinity::Downstream, endingSelection().isDirectional()));
rebalanceWhitespace();
return;
}
// Don't move a line break just after the caret. Doing so would create an extra, empty paragraph
// in the new blockquote.
if (lineBreakExistsAtVisiblePosition(visiblePos)) {
// TODO(yosin) We should use |PositionMoveType::Character| for
// |nextPositionOf()| to avoid editing middle of character.
pos = nextPositionOf(pos, PositionMoveType::CodePoint);
}
// Adjust the position so we don't split at the beginning of a quote.
while (isFirstVisiblePositionInNode(createVisiblePosition(pos), toHTMLQuoteElement(enclosingNodeOfType(pos, isMailHTMLBlockquoteElement)))) {
// TODO(yosin) We should use |PositionMoveType::Character| for
// |previousPositionOf()| to avoid editing middle character.
pos = previousPositionOf(pos, PositionMoveType::CodePoint);
}
// startNode is the first node that we need to move to the new blockquote.
Node* startNode = pos.anchorNode();
ASSERT(startNode);
// Split at pos if in the middle of a text node.
if (startNode->isTextNode()) {
Text* textNode = toText(startNode);
int textOffset = pos.computeOffsetInContainerNode();
if ((unsigned)textOffset >= textNode->length()) {
startNode = NodeTraversal::next(*startNode);
ASSERT(startNode);
} else if (textOffset > 0) {
splitTextNode(textNode, textOffset);
}
} else if (pos.computeEditingOffset() > 0) {
Node* childAtOffset = NodeTraversal::childAt(*startNode, pos.computeEditingOffset());
startNode = childAtOffset ? childAtOffset : NodeTraversal::next(*startNode);
ASSERT(startNode);
}
// If there's nothing inside topBlockquote to move, we're finished.
if (!startNode->isDescendantOf(topBlockquote)) {
setEndingSelection(VisibleSelection(createVisiblePosition(firstPositionInOrBeforeNode(startNode)), endingSelection().isDirectional()));
return;
}
// Build up list of ancestors in between the start node and the top blockquote.
WillBeHeapVector<RefPtrWillBeMember<Element>> ancestors;
for (Element* node = startNode->parentElement(); node && node != topBlockquote; node = node->parentElement())
ancestors.append(node);
// Insert a clone of the top blockquote after the break.
RefPtrWillBeRawPtr<Element> clonedBlockquote = topBlockquote->cloneElementWithoutChildren();
insertNodeAfter(clonedBlockquote.get(), breakElement.get());
//.........这里部分代码省略.........
开发者ID:howardroark2018,项目名称:chromium,代码行数:101,代码来源:BreakBlockquoteCommand.cpp
示例15: analyzeStyleSheet
StyleSheetInvalidationAnalysis::StyleSheetInvalidationAnalysis(const TreeScope& treeScope, const WillBeHeapVector<RawPtrWillBeMember<StyleSheetContents>>& sheets)
: m_treeScope(&treeScope)
{
for (unsigned i = 0; i < sheets.size() && !m_dirtiesAllStyle; ++i)
analyzeStyleSheet(sheets[i]);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:6,代码来源:StyleSheetInvalidationAnalysis.cpp
示例16: addKeyframeRules
void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet)
{
const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes>> keyframesRules = ruleSet.keyframesRules();
for (unsigned i = 0; i < keyframesRules.size(); ++i)
addKeyframeStyle(keyframesRules[i]);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:6,代码来源:ScopedStyleResolver.cpp
示例17: IDB_TRACE
bool IDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
{
IDB_TRACE("IDBRequest::dispatchEvent");
if (m_contextStopped || !executionContext())
return false;
ASSERT(m_readyState == PENDING);
ASSERT(m_hasPendingActivity);
ASSERT(m_enqueuedEvents.size());
ASSERT(event->target() == this);
ScriptState::Scope scope(m_scriptState.get());
if (event->type() != EventTypeNames::blocked)
m_readyState = DONE;
dequeueEvent(event.get());
WillBeHeapVector<RefPtrWillBeMember<EventTarget> > targets;
targets.append(this);
if (m_transaction && !m_preventPropagation) {
targets.append(m_transaction);
// If there ever are events that are associated with a database but
// that do not have a transaction, then this will not work and we need
// this object to actually hold a reference to the database (to ensure
// it stays alive).
targets.append(m_transaction->db());
}
// Cursor properties should not be updated until the success event is being dispatched.
IDBCursor* cursorToNotify = 0;
if (event->type() == EventTypeNames::success) {
cursorToNotify = getResultCursor();
if (cursorToNotify) {
if (m_blobInfo && m_blobInfo->size() > 0)
V8PerIsolateData::from(scriptState()->isolate())->ensureIDBPendingTransactionMonitor()->unregisterRequest(*this);
cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue.release(), m_blobInfo.release());
}
}
if (event->type() == EventTypeNames::upgradeneeded) {
ASSERT(!m_didFireUpgradeNeededEvent);
m_didFireUpgradeNeededEvent = true;
}
// FIXME: When we allow custom event dispatching, this will probably need to change.
ASSERT_WITH_MESSAGE(event->type() == EventTypeNames::success || event->type() == EventTypeNames::error || event->type() == EventTypeNames::blocked || event->type() == EventTypeNames::upgradeneeded, "event type was %s", event->type().utf8().data());
const bool setTransactionActive = m_transaction && (event->type() == EventTypeNames::success || event->type() == EventTypeNames::upgradeneeded || (event->type() == EventTypeNames::error && !m_requestAborted));
if (setTransactionActive)
m_transaction->setActive(true);
bool dontPreventDefault = IDBEventDispatcher::dispatch(event.get(), targets);
if (m_transaction) {
if (m_readyState == DONE)
m_transaction->unregisterRequest(this);
// Possibly abort the transaction. This must occur after unregistering (so this request
// doesn't receive a second error) and before deactivating (which might trigger commit).
if (event->type() == EventTypeNames::error && dontPreventDefault && !m_requestAborted) {
m_transaction->setError(m_error);
m_transaction->abort(IGNORE_EXCEPTION);
}
// If this was the last request in the transaction's list, it may commit here.
if (setTransactionActive)
m_transaction->setActive(false);
}
if (cursorToNotify)
cursorToNotify->postSuccessHandlerCallback();
// An upgradeneeded event will always be followed by a success or error event, so must
// be kept alive.
if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded)
m_hasPendingActivity = false;
return dontPreventDefault;
}
开发者ID:335969568,项目名称:Blink-1,代码行数:78,代码来源:IDBRequest.cpp
示例18: addParsedProperties
void MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProperty, 256>& properties)
{
m_propertyVector.reserveCapacity(m_propertyVector.size() + properties.size());
for (unsigned i = 0; i < properties.size(); ++i)
addParsedProperty(properties[i]);
}
开发者ID:jeremyroman,项目名称:blink,代码行数:6,代码来源:StylePropertySet.cpp
示例19: commonAncestorTreeScope
const TreeScope* TreeScope::commonAncestorTreeScope(const TreeScope& other) const
{
WillBeHeapVector<RawPtrWillBeMember<const TreeScope>, 16> thisChain;
for (const TreeScope* tree = this; tree; tree = tree->parentTreeScope())
thisChain.append(tree);
WillBeHeapVector<RawPtrWillBeMember<const TreeScope>, 16> otherChain;
for (const TreeScope* tree = &other; tree; tree = tree->parentTreeScope())
otherChain.append(tree);
// Keep popping out the last elements of these chains until a mismatched pair is found. If |this| and |other|
// belong to different documents, null will be returned.
const TreeScope* lastAncestor = nullptr;
while (!thisChain.isEmpty() && !otherChain.isEmpty() && thisChain.last() == otherChain.last()) {
lastAncestor = thisChain.last();
thisChain.removeLast();
otherChain.removeLast();
}
return lastAncestor;
}
开发者ID:JulienIsorce,项目名称:ChromiumGStreamerBackend,代码行数:20,代码来源:TreeScope.cpp
示例20: run
void run(LocalFrame* frame) override
{
if (m_running)
return;
m_running = true;
// 0. Flush pending frontend messages.
WebLocalFrameImpl* frameImpl = WebLocalFrameImpl::fromFrame(frame);
WebDevToolsAgentImpl* agent = frameImpl->devToolsAgentImpl();
agent->flushPendingProtocolNotifications();
Vector<WebViewImpl*> views;
WillBeHeapVector<RawPtrWillBeMember<WebFrameWidgetImpl>> widgets;
// 1. Disable input events.
const HashSet<WebViewImpl*>& viewImpls = WebViewImpl::allInstances();
HashSet<WebViewImpl*>::const_iterator viewImplsEnd = viewImpls.end();
for (HashSet<WebViewImpl*>::const_iterator it = viewImpls.begin(); it != viewImplsEnd; ++it) {
WebViewImpl* view = *it;
m_frozenViews.add(view);
views.append(view);
view->setIgnoreInputEvents(true);
}
const WebFrameWidgetsSet& widgetImpls = WebFrameWidgetImpl::allInstances();
WebFrameWidgetsSet::const_iterator widgetImplsEnd = widgetImpls.end();
for (WebFrameWidgetsSet::const_iterator it = widgetImpls.begin(); it != widgetImplsEnd; ++it) {
WebFrameWidgetImpl* widget = *it;
m_frozenWidgets.add(widget);
widgets.append(widget);
widget->setIgnoreInputEvents(true);
}
// 2. Notify embedder about pausing.
agent->client()->willEnterDebugLoop();
// 3. Disable active objects
WebView::willEnterModalLoop();
// 4. Process messages until quitNow is called.
m_messageLoop->run();
// 5. Resume active objects
WebView::didExitModalLoop();
// 6. Resume input events.
for (Vector<WebViewImpl*>::iterator it = views.begin(); it != views.end(); ++it) {
if (m_frozenViews.contains(*it)) {
// The view was not closed during the dispatch.
(*it)->setIgnoreInputEvents(false);
}
}
for (WillBeHeapVector<RawPtrWillBeMember<WebFrameWidgetImpl>>::iterator it = widgets.begin(); it != widgets.end(); ++it) {
if (m_frozenWidgets.contains(*it)) {
// The widget was not closed during the dispatch.
(*it)->setIgnoreInputEvents(false);
}
}
// 7. Notify embedder about resuming.
agent->client()->didExitDebugLoop();
// 8. All views have been resumed, clear the set.
m_frozenViews.clear();
m_frozenWidgets.clear();
m_running = false;
}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:68,代码来源:WebDevToolsAgentImpl.cpp
注:本文中的WillBeHeapVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论