当前位置: 首页>>代码示例>>C++>>正文


C++ DCHECK函数代码示例

本文整理汇总了C++中DCHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ DCHECK函数的具体用法?C++ DCHECK怎么用?C++ DCHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DCHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillWithNulls

 /**
  * @brief Fill this entire ColumnVector with NULLs.
  **/
 inline void fillWithNulls() {
   DCHECK(null_bitmap_);
   null_bitmap_->setBitRange(0, reserved_length_, true);
   actual_length_ = reserved_length_;
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:8,代码来源:ColumnVector.hpp

示例2: BoxPainter

void BlockPainter::paintObject(const PaintInfo& paintInfo,
                               const LayoutPoint& paintOffset) {
  const PaintPhase paintPhase = paintInfo.phase;

  if (shouldPaintSelfBlockBackground(paintPhase)) {
    if (m_layoutBlock.style()->visibility() == EVisibility::Visible &&
        m_layoutBlock.hasBoxDecorationBackground())
      m_layoutBlock.paintBoxDecorationBackground(paintInfo, paintOffset);
    // We're done. We don't bother painting any children.
    if (paintPhase == PaintPhaseSelfBlockBackgroundOnly)
      return;
  }

  if (paintInfo.paintRootBackgroundOnly())
    return;

  if (paintPhase == PaintPhaseMask &&
      m_layoutBlock.style()->visibility() == EVisibility::Visible) {
    m_layoutBlock.paintMask(paintInfo, paintOffset);
    return;
  }

  if (paintPhase == PaintPhaseClippingMask &&
      m_layoutBlock.style()->visibility() == EVisibility::Visible) {
    BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset);
    return;
  }

  if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting())
    ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffset);

  if (paintPhase != PaintPhaseSelfOutlineOnly) {
    Optional<ScopedPaintChunkProperties> m_scopedScrollProperty;
    Optional<ScrollRecorder> scrollRecorder;
    Optional<PaintInfo> scrolledPaintInfo;
    if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
      const auto* objectProperties = m_layoutBlock.paintProperties();
      if (auto* scroll =
              objectProperties ? objectProperties->scroll() : nullptr) {
        PaintChunkProperties properties(paintInfo.context.getPaintController()
                                            .currentPaintChunkProperties());
        auto* scrollTranslation = objectProperties->scrollTranslation();
        DCHECK(scrollTranslation);
        properties.transform = scrollTranslation;
        properties.scroll = scroll;
        m_scopedScrollProperty.emplace(
            paintInfo.context.getPaintController(), m_layoutBlock,
            DisplayItem::paintPhaseToDrawingType(paintPhase), properties);
        scrolledPaintInfo.emplace(paintInfo);
        scrolledPaintInfo->updateCullRect(
            scrollTranslation->matrix().toAffineTransform());
      }
    } else if (m_layoutBlock.hasOverflowClip()) {
      IntSize scrollOffset = m_layoutBlock.scrolledContentOffset();
      if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero()) {
        scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPhase,
                               scrollOffset);
        scrolledPaintInfo.emplace(paintInfo);
        AffineTransform transform;
        transform.translate(-scrollOffset.width(), -scrollOffset.height());
        scrolledPaintInfo->updateCullRect(transform);
      }
    }

    const PaintInfo& contentsPaintInfo =
        scrolledPaintInfo ? *scrolledPaintInfo : paintInfo;

    if (m_layoutBlock.isLayoutBlockFlow()) {
      BlockFlowPainter blockFlowPainter(toLayoutBlockFlow(m_layoutBlock));
      blockFlowPainter.paintContents(contentsPaintInfo, paintOffset);
      if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection ||
          paintPhase == PaintPhaseTextClip)
        blockFlowPainter.paintFloats(contentsPaintInfo, paintOffset);
    } else {
      paintContents(contentsPaintInfo, paintOffset);
    }
  }

  if (shouldPaintSelfOutline(paintPhase))
    ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset);

  // If the caret's node's layout object's containing block is this block, and
  // the paint action is PaintPhaseForeground, then paint the caret.
  if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret())
    paintCarets(paintInfo, paintOffset);
}
开发者ID:mirror,项目名称:chromium,代码行数:86,代码来源:BlockPainter.cpp

示例3: DCHECK

// static
bool HTMLIFrameElementPayments::fastHasAttribute(
    const QualifiedName& name,
    const HTMLIFrameElement& element) {
  DCHECK(name == HTMLNames::allowpaymentrequestAttr);
  return element.fastHasAttribute(name);
}
开发者ID:mirror,项目名称:chromium,代码行数:7,代码来源:HTMLIFrameElementPayments.cpp

示例4: DCHECK

bool WebImageDecoder::isFailed() const {
  DCHECK(m_private);
  return m_private->failed();
}
开发者ID:ollie314,项目名称:chromium,代码行数:4,代码来源:WebImageDecoder.cpp

示例5: DCHECK

bool SelectionModifier::modify(EAlteration alter,
                               SelectionDirection direction,
                               TextGranularity granularity) {
  DCHECK(!frame()->document()->needsLayoutTreeUpdate());
  DocumentLifecycle::DisallowTransitionScope disallowTransition(
      frame()->document()->lifecycle());

  willBeModified(alter, direction);

  bool wasRange = m_selection.isRange();
  VisiblePosition originalStartPosition = m_selection.visibleStart();
  VisiblePosition position;
  switch (direction) {
    case DirectionRight:
      if (alter == FrameSelection::AlterationMove)
        position = modifyMovingRight(granularity);
      else
        position = modifyExtendingRight(granularity);
      break;
    case DirectionForward:
      if (alter == FrameSelection::AlterationExtend)
        position = modifyExtendingForward(granularity);
      else
        position = modifyMovingForward(granularity);
      break;
    case DirectionLeft:
      if (alter == FrameSelection::AlterationMove)
        position = modifyMovingLeft(granularity);
      else
        position = modifyExtendingLeft(granularity);
      break;
    case DirectionBackward:
      if (alter == FrameSelection::AlterationExtend)
        position = modifyExtendingBackward(granularity);
      else
        position = modifyMovingBackward(granularity);
      break;
  }

  if (position.isNull())
    return false;

  if (isSpatialNavigationEnabled(frame())) {
    if (!wasRange && alter == FrameSelection::AlterationMove &&
        position.deepEquivalent() == originalStartPosition.deepEquivalent())
      return false;
  }

  // Some of the above operations set an xPosForVerticalArrowNavigation.
  // Setting a selection will clear it, so save it to possibly restore later.
  // Note: the START position type is arbitrary because it is unused, it would
  // be the requested position type if there were no
  // xPosForVerticalArrowNavigation set.
  LayoutUnit x = lineDirectionPointForBlockDirectionNavigation(START);
  m_selection.setIsDirectional(shouldAlwaysUseDirectionalSelection(frame()) ||
                               alter == FrameSelection::AlterationExtend);

  switch (alter) {
    case FrameSelection::AlterationMove:
      m_selection = createVisibleSelection(
          SelectionInDOMTree::Builder()
              .collapse(position.toPositionWithAffinity())
              .setIsDirectional(m_selection.isDirectional())
              .build());
      break;
    case FrameSelection::AlterationExtend:

      if (!m_selection.isCaret() && (granularity == WordGranularity ||
                                     granularity == ParagraphGranularity ||
                                     granularity == LineGranularity) &&
          frame() &&
          !frame()
               ->editor()
               .behavior()
               .shouldExtendSelectionByWordOrLineAcrossCaret()) {
        // Don't let the selection go across the base position directly. Needed
        // to match mac behavior when, for instance, word-selecting backwards
        // starting with the caret in the middle of a word and then
        // word-selecting forward, leaving the caret in the same place where it
        // was, instead of directly selecting to the end of the word.
        VisibleSelection newSelection = m_selection;
        newSelection.setExtent(position);
        if (m_selection.isBaseFirst() != newSelection.isBaseFirst())
          position = m_selection.visibleBase();
      }

      // Standard Mac behavior when extending to a boundary is grow the
      // selection rather than leaving the base in place and moving the
      // extent. Matches NSTextView.
      if (!frame() ||
          !frame()
               ->editor()
               .behavior()
               .shouldAlwaysGrowSelectionWhenExtendingToBoundary() ||
          m_selection.isCaret() || !isBoundary(granularity)) {
        m_selection.setExtent(position);
      } else {
        TextDirection textDirection = directionOfEnclosingBlock();
        if (direction == DirectionForward ||
            (textDirection == LTR && direction == DirectionRight) ||
//.........这里部分代码省略.........
开发者ID:mirror,项目名称:chromium,代码行数:101,代码来源:SelectionModifier.cpp

示例6: positionalWriteTypedValue

 /**
  * @brief Overwrite the value at the specified position with the supplied
  *        TypedValue.
  * @warning You must call prepareForPositionalWrites() BEFORE calling this
  *          method.
  * @warning Do NOT use positional writes in combination with appends.
  *
  * @param position The position of the value in this IndirectColumnVector to
  *        overwrite.
  * @param value A TypedValue to write into this IndirectColumnVector.
  **/
 inline void positionalWriteTypedValue(const std::size_t position,
                                       TypedValue &&value) {  // NOLINT(whitespace/operators)
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   DCHECK_LT(position, values_.size());
   values_[position] = std::move(value);
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:17,代码来源:ColumnVector.hpp

示例7: prepareForPositionalWrites

 /**
  * @brief Prepare this IndirectColumnVector for positional writes.
  *        Effectively "fills" this IndirectColumnVector with uninitialized
  *        values that will be overwritten with calls to
  *        positionalWriteTypedValue().
  * @warning Do NOT use positional writes in combination with appends.
  **/
 inline void prepareForPositionalWrites() {
   DCHECK(values_.empty());
   values_.resize(reserved_length_);
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:11,代码来源:ColumnVector.hpp

示例8: fillWithValue

 /**
  * @brief Fill this entire ColumnVector with copies of value.
  *
  * @param value A value to fill this ColumnVector with.
  **/
 inline void fillWithValue(const TypedValue &value) {
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   values_.assign(reserved_length_, value);
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:9,代码来源:ColumnVector.hpp

示例9: appendTypedValue

 /**
  * @brief Append a TypedValue to this IndirectColumnVector.
  *
  * @param value A value to append to this NativeColumnVector.
  **/
 inline void appendTypedValue(TypedValue &&value) {
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   DCHECK_LT(values_.size(), reserved_length_);
   values_.emplace_back(std::move(value));
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:10,代码来源:ColumnVector.hpp

示例10: positionalWriteNullValue

 /**
  * @brief Overwrite the value at the specified position with a NULL value.
  * @warning You must call prepareForPositionalWrites() BEFORE calling this
  *          method.
  * @warning Do NOT use positional writes in combination with appends.
  * @warning It is intended that this and other positional write methods
  *          should be called exactly once for each position (if this is
  *          violated, NULLs may not be tracked properly).
  *
  * @param position The position of the value in this NativeColumnVector to
  *        overwrite with a NULL value.
  **/
 inline void positionalWriteNullValue(const std::size_t position) {
   DCHECK_LT(position, actual_length_);
   DCHECK(null_bitmap_);
   null_bitmap_->setBit(position, true);
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:17,代码来源:ColumnVector.hpp

示例11: DCHECK

bool CSSStyleSheet::sheetLoaded() {
  DCHECK(m_ownerNode);
  setLoadCompleted(m_ownerNode->sheetLoaded());
  return m_loadCompleted;
}
开发者ID:mirror,项目名称:chromium,代码行数:5,代码来源:CSSStyleSheet.cpp

示例12: parseToNumberOrNaN

void RangeInputType::handleKeydownEvent(KeyboardEvent* event) {
  if (element().isDisabledOrReadOnly())
    return;

  const String& key = event->key();

  const Decimal current = parseToNumberOrNaN(element().value());
  DCHECK(current.isFinite());

  StepRange stepRange(createStepRange(RejectAny));

  // FIXME: We can't use stepUp() for the step value "any". So, we increase
  // or decrease the value by 1/100 of the value range. Is it reasonable?
  const Decimal step =
      equalIgnoringCase(element().fastGetAttribute(stepAttr), "any")
          ? (stepRange.maximum() - stepRange.minimum()) / 100
          : stepRange.step();
  const Decimal bigStep =
      std::max((stepRange.maximum() - stepRange.minimum()) / 10, step);

  TextDirection dir = LTR;
  bool isVertical = false;
  if (element().layoutObject()) {
    dir = computedTextDirection();
    ControlPart part = element().layoutObject()->style()->appearance();
    isVertical = part == SliderVerticalPart;
  }

  Decimal newValue;
  if (key == "ArrowUp")
    newValue = current + step;
  else if (key == "ArrowDown")
    newValue = current - step;
  else if (key == "ArrowLeft")
    newValue = (isVertical || dir == RTL) ? current + step : current - step;
  else if (key == "ArrowRight")
    newValue = (isVertical || dir == RTL) ? current - step : current + step;
  else if (key == "PageUp")
    newValue = current + bigStep;
  else if (key == "PageDown")
    newValue = current - bigStep;
  else if (key == "Home")
    newValue = isVertical ? stepRange.maximum() : stepRange.minimum();
  else if (key == "End")
    newValue = isVertical ? stepRange.minimum() : stepRange.maximum();
  else
    return;  // Did not match any key binding.

  newValue = stepRange.clampValue(newValue);

  if (newValue != current) {
    EventQueueScope scope;
    TextFieldEventBehavior eventBehavior = DispatchInputAndChangeEvent;
    setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION);

    if (AXObjectCache* cache = element().document().existingAXObjectCache())
      cache->handleValueChanged(&element());
  }

  event->setDefaultHandled();
}
开发者ID:ollie314,项目名称:chromium,代码行数:61,代码来源:RangeInputType.cpp

示例13: DCHECK

    void OutputWidget::addChild(FastoObject* child)
    {
        DCHECK(child->parent());

        FastoObjectCommand* command = dynamic_cast<FastoObjectCommand*>(child);
        if(command){
            return;
        }

        command = dynamic_cast<FastoObjectCommand*>(child->parent());
        if(command){

            void* parentinner = command->parent();

            QModelIndex parent;
            bool isFound = commonModel_->findItem(parentinner, parent);
            if(!isFound){
                return;
            }

            fastoredis::FastoCommonItem* par = NULL;
            if(!parent.isValid()){
                par = static_cast<fastoredis::FastoCommonItem*>(commonModel_->root());
            }
            else{
                par = common::utils_qt::item<fastoredis::FastoCommonItem*>(parent);
            }

            DCHECK(par);
            if(!par){
                return;
            }

            const QString key = common::convertFromString<QString>(command->inputArgs());

            fastoredis::FastoCommonItem* comChild = createItem(par, key, child);
            comChild->setChangeCommand(command->oppositeCommand());
            commonModel_->insertItem(parent, comChild);
        }
        else{
            FastoObjectArray* arr = dynamic_cast<FastoObjectArray*>(child->parent());
            if(arr){
                QModelIndex parent;
                bool isFound = commonModel_->findItem(arr, parent);
                if(!isFound){
                    return;
                }

                fastoredis::FastoCommonItem* par = NULL;
                if(!parent.isValid()){
                    par = static_cast<fastoredis::FastoCommonItem*>(commonModel_->root());
                }
                else{
                    par = common::utils_qt::item<fastoredis::FastoCommonItem*>(parent);
                }

                DCHECK(par);
                if(!par){
                    return;
                }

                fastoredis::FastoCommonItem* comChild = createItem(par, QString(), child);
                commonModel_->insertItem(parent, comChild);
            }
            else{
                NOTREACHED();
            }
        }
    }
开发者ID:TakedWind,项目名称:fastoredis,代码行数:69,代码来源:output_widget.cpp

示例14: sortBlock

static void sortBlock(unsigned from,
                      unsigned to,
                      HeapVector<NodeSetVector>& parentMatrix,
                      bool mayContainAttributeNodes) {
  // Should not call this function with less that two nodes to sort.
  DCHECK_LT(from + 1, to);
  unsigned minDepth = UINT_MAX;
  for (unsigned i = from; i < to; ++i) {
    unsigned depth = parentMatrix[i].size() - 1;
    if (minDepth > depth)
      minDepth = depth;
  }

  // Find the common ancestor.
  unsigned commonAncestorDepth = minDepth;
  Node* commonAncestor;
  while (true) {
    commonAncestor = parentWithDepth(commonAncestorDepth, parentMatrix[from]);
    if (commonAncestorDepth == 0)
      break;

    bool allEqual = true;
    for (unsigned i = from + 1; i < to; ++i) {
      if (commonAncestor !=
          parentWithDepth(commonAncestorDepth, parentMatrix[i])) {
        allEqual = false;
        break;
      }
    }
    if (allEqual)
      break;

    --commonAncestorDepth;
  }

  if (commonAncestorDepth == minDepth) {
    // One of the nodes is the common ancestor => it is the first in
    // document order. Find it and move it to the beginning.
    for (unsigned i = from; i < to; ++i) {
      if (commonAncestor == parentMatrix[i][0]) {
        parentMatrix[i].swap(parentMatrix[from]);
        if (from + 2 < to)
          sortBlock(from + 1, to, parentMatrix, mayContainAttributeNodes);
        return;
      }
    }
  }

  if (mayContainAttributeNodes && commonAncestor->isElementNode()) {
    // The attribute nodes and namespace nodes of an element occur before
    // the children of the element. The namespace nodes are defined to occur
    // before the attribute nodes. The relative order of namespace nodes is
    // implementation-dependent. The relative order of attribute nodes is
    // implementation-dependent.
    unsigned sortedEnd = from;
    // FIXME: namespace nodes are not implemented.
    for (unsigned i = sortedEnd; i < to; ++i) {
      Node* n = parentMatrix[i][0];
      if (n->isAttributeNode() && toAttr(n)->ownerElement() == commonAncestor)
        parentMatrix[i].swap(parentMatrix[sortedEnd++]);
    }
    if (sortedEnd != from) {
      if (to - sortedEnd > 1)
        sortBlock(sortedEnd, to, parentMatrix, mayContainAttributeNodes);
      return;
    }
  }

  // Children nodes of the common ancestor induce a subdivision of our
  // node-set. Sort it according to this subdivision, and recursively sort
  // each group.
  HeapHashSet<Member<Node>> parentNodes;
  for (unsigned i = from; i < to; ++i)
    parentNodes.add(parentWithDepth(commonAncestorDepth + 1, parentMatrix[i]));

  unsigned previousGroupEnd = from;
  unsigned groupEnd = from;
  for (Node* n = commonAncestor->firstChild(); n; n = n->nextSibling()) {
    // If parentNodes contains the node, perform a linear search to move its
    // children in the node-set to the beginning.
    if (parentNodes.contains(n)) {
      for (unsigned i = groupEnd; i < to; ++i) {
        if (parentWithDepth(commonAncestorDepth + 1, parentMatrix[i]) == n)
          parentMatrix[i].swap(parentMatrix[groupEnd++]);
      }

      if (groupEnd - previousGroupEnd > 1)
        sortBlock(previousGroupEnd, groupEnd, parentMatrix,
                  mayContainAttributeNodes);

      DCHECK_NE(previousGroupEnd, groupEnd);
      previousGroupEnd = groupEnd;
#if DCHECK_IS_ON()
      parentNodes.remove(n);
#endif
    }
  }

  DCHECK(parentNodes.isEmpty());
}
开发者ID:mirror,项目名称:chromium,代码行数:100,代码来源:XPathNodeSet.cpp

示例15: DCHECK

TypedValue TypedValue::ReconstructFromProto(const serialization::TypedValue &proto) {
  DCHECK(ProtoIsValid(proto))
      << "Attempted to create TypedValue from an invalid proto description:\n"
      << proto.DebugString();

  switch (proto.type_id()) {
    case serialization::Type::INT:
      return proto.has_int_value() ?
          TypedValue(static_cast<int>(proto.int_value())) :
          TypedValue(kInt);
    case serialization::Type::LONG:
      return proto.has_long_value() ?
          TypedValue(static_cast<std::int64_t>(proto.long_value())) :
          TypedValue(kLong);
    case serialization::Type::FLOAT:
      return proto.has_float_value() ?
          TypedValue(static_cast<float>(proto.float_value())) :
          TypedValue(kFloat);
    case serialization::Type::DOUBLE:
      return proto.has_double_value() ?
          TypedValue(static_cast<double>(proto.double_value())) :
          TypedValue(kDouble);
    case serialization::Type::DATETIME:
      if (proto.has_datetime_value()) {
        DatetimeLit datetime;
        datetime.ticks = proto.datetime_value();
        return TypedValue(datetime);
      } else {
        return TypedValue(kDatetime);
      }
    case serialization::Type::DATETIME_INTERVAL:
      if (proto.has_datetime_interval_value()) {
        DatetimeIntervalLit interval;
        interval.interval_ticks = proto.datetime_interval_value();
        return TypedValue(interval);
      } else {
        return TypedValue(kDatetimeInterval);
      }
    case serialization::Type::YEAR_MONTH_INTERVAL:
      if (proto.has_year_month_interval_value()) {
        YearMonthIntervalLit interval;
        interval.months = proto.year_month_interval_value();
        return TypedValue(interval);
      } else {
        return TypedValue(kYearMonthInterval);
      }
    case serialization::Type::CHAR:
      return proto.has_out_of_line_data() ?
          TypedValue(kChar,
                     static_cast<const void*>(proto.out_of_line_data().c_str()),
                     proto.out_of_line_data().size()).ensureNotReference() :
          TypedValue(kChar);
    case serialization::Type::VAR_CHAR:
      return proto.has_out_of_line_data() ?
          TypedValue(kVarChar,
                     static_cast<const void*>(proto.out_of_line_data().c_str()),
                     proto.out_of_line_data().size()).ensureNotReference() :
          TypedValue(kVarChar);
    case serialization::Type::NULL_TYPE:
      return TypedValue(kNullType);
    default:
      FATAL_ERROR("Unrecognized TypeID in TypedValue::ReconstructFromProto");
  }
}
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:64,代码来源:TypedValue.cpp


注:本文中的DCHECK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。