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


C++ DCHECK_EQ函数代码示例

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


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

示例1: CHECK

Range<AsyncIO::Op**> AsyncIO::pollCompleted() {
  CHECK(ctx_);
  CHECK_NE(pollFd_, -1) << "pollCompleted() only allowed on pollable object";
  uint64_t numEvents;
  // This sets the eventFd counter to 0, see
  // http://www.kernel.org/doc/man-pages/online/pages/man2/eventfd.2.html
  ssize_t rc;
  do {
    rc = ::read(pollFd_, &numEvents, 8);
  } while (rc == -1 && errno == EINTR);
  if (UNLIKELY(rc == -1 && errno == EAGAIN)) {
    return Range<Op**>();  // nothing completed
  }
  checkUnixError(rc, "AsyncIO: read from event fd failed");
  DCHECK_EQ(rc, 8);

  DCHECK_GT(numEvents, 0);
  DCHECK_LE(numEvents, pending_);

  // Don't reap more than numEvents, as we've just reset the counter to 0.
  return doWait(numEvents, numEvents);
}
开发者ID:zunc,项目名称:folly,代码行数:22,代码来源:AsyncIO.cpp

示例2: hexDumpLine

size_t hexDumpLine(const void* ptr, size_t offset, size_t size,
                   std::string& line) {
  // Line layout:
  // 8: address
  // 1: space
  // (1+2)*16: hex bytes, each preceded by a space
  // 1: space separating the two halves
  // 3: "  |"
  // 16: characters
  // 1: "|"
  // Total: 78
  line.clear();
  line.reserve(78);
  const uint8_t* p = reinterpret_cast<const uint8_t*>(ptr) + offset;
  size_t n = std::min(size - offset, size_t(16));
  format("{:08x} ", offset).appendTo(line);

  for (size_t i = 0; i < n; i++) {
    if (i == 8) {
      line.push_back(' ');
    }
    format(" {:02x}", p[i]).appendTo(line);
  }

  // 3 spaces for each byte we're not printing, one separating the halves
  // if necessary
  line.append(3 * (16 - n) + (n <= 8), ' ');
  line.append("  |");

  for (size_t i = 0; i < n; i++) {
    char c = (p[i] >= 32 && p[i] <= 126 ? static_cast<char>(p[i]) : '.');
    line.push_back(c);
  }
  line.append(16 - n, ' ');
  line.push_back('|');
  DCHECK_EQ(line.size(), 78);

  return n;
}
开发者ID:Aliced3645,项目名称:folly,代码行数:39,代码来源:String.cpp

示例3: acquire_reply

 void acquire_reply( size_t offset, void * payload, size_t payload_size ) { 
   DVLOG(5) << "Worker " << Grappa::current_worker() 
            << " copying reply payload of " << payload_size
            << " and waking Worker " << thread_;
   memcpy( ((char*)(*pointer_)) + offset, payload, payload_size );
   ++response_count_;
   total_reply_payload_ += payload_size;
   if ( response_count_ == num_messages_ ) {
     DCHECK_EQ( total_reply_payload_, expected_reply_payload_ ) << "Got back the wrong amount of data "
                                                                << "(with base = " << *request_address_
                                                                << " and sizeof(T) = " << sizeof(T) 
                                                                << " and count = " << *count_;
     acquired_ = true;
     if( thread_ != NULL ) {
       Grappa::wake( thread_ );
     }
     if( start_time_ != 0 ) {
       network_time_ = Grappa::timestamp();
       IAMetrics::record_network_latency( start_time_ );
     }
   }
 }
开发者ID:HPCProjectsTry,项目名称:grappa,代码行数:22,代码来源:IncoherentAcquirer.hpp

示例4: composite

  PassRefPtr<CSSTransformNonInterpolableValue> composite(
      const CSSTransformNonInterpolableValue& other,
      double otherProgress) {
    DCHECK(!isAdditive());
    if (other.m_isSingle) {
      DCHECK_EQ(otherProgress, 0);
      DCHECK(other.isAdditive());
      TransformOperations result;
      result.operations() = concat(transform(), other.transform());
      return create(std::move(result));
    }

    DCHECK(other.m_isStartAdditive || other.m_isEndAdditive);
    TransformOperations start;
    start.operations() = other.m_isStartAdditive
                             ? concat(transform(), other.m_start)
                             : other.m_start.operations();
    TransformOperations end;
    end.operations() = other.m_isEndAdditive ? concat(transform(), other.m_end)
                                             : other.m_end.operations();
    return create(end.blend(start, otherProgress));
  }
开发者ID:ollie314,项目名称:chromium,代码行数:22,代码来源:CSSTransformInterpolationType.cpp

示例5: DCHECK

bool FileManagerWindows::writeBlockOrBlob(const block_id block,
                                          const void *buffer,
                                          const size_t length) {
  DCHECK(buffer != nullptr);
  DCHECK_EQ(0u, length % kSlotSizeBytes);

  const string filename(blockFilename(block));

  FILE *file = fopen(filename.c_str(), "wb");
  if (file == nullptr) {
    // Note: On most, but not all, library implementations, the errno variable
    //       is set to a system-specific error code on failure.
    LOG(ERROR) << "Failed to open file " << filename << " with error: " << strerror(errno);
    return false;
  }

  const size_t bytes = std::fwrite(buffer, sizeof(char), length, file);
  const bool result_is_ok = (bytes == length);
  if (!result_is_ok) {
    LOG(ERROR) << "Failed to write file " << filename << " with error: " << strerror(ferror(file));
    clearerr(file);
  }

  if (fflush(file)) {
    LOG(ERROR) << "Failed to flush file " << filename << " with error: " << strerror(ferror(file));
  }

  if (!FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(file))))) {
    LOG(ERROR) << "Failed to re-flush file " << filename << " with error: " << strerror(ferror(file));
  }

  if (fclose(file)) {
    // Note: fclose does not set errno on failure.
    LOG(ERROR) << "Failed to close file " << filename;
  }

  return result_is_ok;
}
开发者ID:apache,项目名称:incubator-quickstep,代码行数:38,代码来源:FileManagerWindows.cpp

示例6: DCHECK_EQ

char* Pickle::BeginWriteData(int length)
{
    DCHECK_EQ(variable_buffer_offset_, 0U) <<
        "There can only be one variable buffer in a Pickle";

    if(length<0 || !WriteInt(length))
    {
        return NULL;
    }

    char* data_ptr = BeginWrite(length);
    if(!data_ptr)
    {
        return NULL;
    }

    variable_buffer_offset_ = data_ptr -
        reinterpret_cast<char*>(header_) - sizeof(int);

    // 数据写入后不必要再调用EndWrite, 所以在这里调用进行数据对齐.
    EndWrite(data_ptr, length);
    return data_ptr;
}
开发者ID:noodle1983,项目名称:putty-nd3.x,代码行数:23,代码来源:pickle.cpp

示例7: isLegacySupportedJavaScriptLanguage

// Helper function. Must take a lowercase language as input.
static bool isLegacySupportedJavaScriptLanguage(const String& language)
{
    // Mozilla 1.8 accepts javascript1.0 - javascript1.7, but WinIE 7 accepts only javascript1.1 - javascript1.3.
    // Mozilla 1.8 and WinIE 7 both accept javascript and livescript.
    // WinIE 7 accepts ecmascript and jscript, but Mozilla 1.8 doesn't.
    // Neither Mozilla 1.8 nor WinIE 7 accept leading or trailing whitespace.
    // We want to accept all the values that either of these browsers accept, but not other values.

    // FIXME: This function is not HTML5 compliant. These belong in the MIME registry as "text/javascript<version>" entries.
    DCHECK_EQ(language, language.lower());
    return language == "javascript"
        || language == "javascript1.0"
        || language == "javascript1.1"
        || language == "javascript1.2"
        || language == "javascript1.3"
        || language == "javascript1.4"
        || language == "javascript1.5"
        || language == "javascript1.6"
        || language == "javascript1.7"
        || language == "livescript"
        || language == "ecmascript"
        || language == "jscript";
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:24,代码来源:ScriptLoader.cpp

示例8: DCHECK_EQ

void SVGFilterRecordingContext::endContent(FilterData* filterData) {
  DCHECK_EQ(filterData->m_state, FilterData::RecordingContent);

  Filter* filter = filterData->lastEffect->getFilter();
  SourceGraphic* sourceGraphic = filter->getSourceGraphic();
  DCHECK(sourceGraphic);

  // Use the context that contains the filtered content.
  DCHECK(m_paintController);
  DCHECK(m_context);
  m_context->beginRecording(filter->filterRegion());
  m_paintController->commitNewDisplayItems();
  m_paintController->paintArtifact().replay(*m_context);

  SkiaImageFilterBuilder::buildSourceGraphic(sourceGraphic,
                                             m_context->endRecording());

  // Content is cached by the source graphic so temporaries can be freed.
  m_paintController = nullptr;
  m_context = nullptr;

  filterData->m_state = FilterData::ReadyToPaint;
}
开发者ID:mirror,项目名称:chromium,代码行数:23,代码来源:SVGFilterPainter.cpp

示例9: DCHECK

void ReadableStreamOperations::tee(ScriptState* scriptState,
                                   ScriptValue stream,
                                   ScriptValue* newStream1,
                                   ScriptValue* newStream2) {
  DCHECK(isReadableStream(scriptState, stream));
  DCHECK(!isLocked(scriptState, stream));

  v8::Local<v8::Value> args[] = {stream.v8Value()};

  ScriptValue result(scriptState, V8ScriptRunner::callExtraOrCrash(
                                      scriptState, "ReadableStreamTee", args));
  DCHECK(result.v8Value()->IsArray());
  v8::Local<v8::Array> branches = result.v8Value().As<v8::Array>();
  DCHECK_EQ(2u, branches->Length());

  *newStream1 = ScriptValue(
      scriptState, branches->Get(scriptState->context(), 0).ToLocalChecked());
  *newStream2 = ScriptValue(
      scriptState, branches->Get(scriptState->context(), 1).ToLocalChecked());

  DCHECK(isReadableStream(scriptState, *newStream1));
  DCHECK(isReadableStream(scriptState, *newStream2));
}
开发者ID:mirror,项目名称:chromium,代码行数:23,代码来源:ReadableStreamOperations.cpp

示例10: DCHECK

// static
void BrowserList::AddBrowser(Browser* browser)
{
    DCHECK(browser);
    browsers_.push_back(browser);
	StartKeepAlive();

    //if(!activity_observer)
    //{
    //    activity_observer = new BrowserActivityObserver;
    //}

    //NotificationService::current()->Notify(
    //    chrome::NOTIFICATION_BROWSER_OPENED,
    //    Source<Browser>(browser),
    //    NotificationService::NoDetails());

    // Send out notifications after add has occurred. Do some basic checking to
    // try to catch evil observers that change the list from under us.
    size_t original_count = observers_.size();
    FOR_EACH_OBSERVER(Observer, observers_, OnBrowserAdded(browser));
    DCHECK_EQ(original_count, observers_.size())
        << "observer list modified during notification";
}
开发者ID:noodle1983,项目名称:putty-nd3.x,代码行数:24,代码来源:browser_list.cpp

示例11: CHECK_EQ

void AsyncIO::submit(Op* op) {
  CHECK_EQ(op->state(), Op::State::INITIALIZED);
  initializeContext();  // on demand

  // We can increment past capacity, but we'll clean up after ourselves.
  auto p = pending_.fetch_add(1, std::memory_order_acq_rel);
  if (p >= capacity_) {
    decrementPending();
    throw std::range_error("AsyncIO: too many pending requests");
  }
  iocb* cb = &op->iocb_;
  cb->data = nullptr;  // unused
  if (pollFd_ != -1) {
    io_set_eventfd(cb, pollFd_);
  }
  int rc = io_submit(ctx_, 1, &cb);
  if (rc < 0) {
    decrementPending();
    throwSystemErrorExplicit(-rc, "AsyncIO: io_submit failed");
  }
  submitted_++;
  DCHECK_EQ(rc, 1);
  op->start();
}
开发者ID:GYGit,项目名称:folly,代码行数:24,代码来源:AsyncIO.cpp

示例12: document

void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) {
  CharacterData::removedFrom(insertionPoint);
  if (!insertionPoint->isConnected())
    return;

  // No need to remove XSLStyleSheet from StyleEngine.
  if (!DocumentXSLT::processingInstructionRemovedFromDocument(document(), this))
    document().styleEngine().removeStyleSheetCandidateNode(*this);

  StyleSheet* removedSheet = m_sheet;
  if (m_sheet) {
    DCHECK_EQ(m_sheet->ownerNode(), this);
    clearSheet();
  }

  // No need to remove pending sheets.
  clearResource();

  // If we're in document teardown, then we don't need to do any notification of
  // our sheet's removal.
  if (document().isActive())
    document().styleEngine().setNeedsActiveStyleUpdate(removedSheet,
                                                       FullStyleUpdate);
}
开发者ID:mirror,项目名称:chromium,代码行数:24,代码来源:ProcessingInstruction.cpp

示例13: DCHECK_EQ

void RadioButtonGroupScope::addButton(HTMLInputElement* element) {
  DCHECK_EQ(element->type(), InputTypeNames::radio);
  if (element->name().isEmpty())
    return;

  if (!m_nameToGroupMap)
    m_nameToGroupMap = new NameToGroupMap;

  auto keyValue = m_nameToGroupMap->add(element->name(), nullptr).storedValue;
  if (!keyValue->value) {
    keyValue->value = RadioButtonGroup::create();
  } else {
    if (keyValue->key == element->name())
      UseCounter::count(element->document(),
                        UseCounter::RadioNameMatchingStrict);
    else if (equalIgnoringASCIICase(keyValue->key, element->name()))
      UseCounter::count(element->document(),
                        UseCounter::RadioNameMatchingASCIICaseless);
    else
      UseCounter::count(element->document(),
                        UseCounter::RadioNameMatchingCaseFolding);
  }
  keyValue->value->add(element);
}
开发者ID:mirror,项目名称:chromium,代码行数:24,代码来源:RadioButtonGroupScope.cpp

示例14: DCHECK

PositionTemplate<Strategy>
PositionIteratorAlgorithm<Strategy>::computePosition() const {
  DCHECK(isValid());
  // Assume that we have the following DOM tree:
  // A
  // |-B
  // | |-E
  // | +-F
  // |
  // |-C
  // +-D
  //   |-G
  //   +-H
  if (m_nodeAfterPositionInAnchor) {
    // For example, position is before E, F.
    DCHECK_EQ(Strategy::parent(*m_nodeAfterPositionInAnchor), m_anchorNode);
    DCHECK_NE(m_offsetsInAnchorNode[m_depthToAnchorNode], kInvalidOffset);
    // TODO(yoichio): This should be equivalent to
    // PositionTemplate<Strategy>(m_anchorNode,
    // PositionAnchorType::BeforeAnchor);
    return PositionTemplate<Strategy>(
        m_anchorNode, m_offsetsInAnchorNode[m_depthToAnchorNode]);
  }
  if (Strategy::hasChildren(*m_anchorNode))
    // For example, position is the end of B.
    return PositionTemplate<Strategy>::lastPositionInOrAfterNode(m_anchorNode);
  if (m_anchorNode->isTextNode())
    return PositionTemplate<Strategy>(m_anchorNode, m_offsetInAnchor);
  if (m_offsetInAnchor)
    // For example, position is after G.
    return PositionTemplate<Strategy>(m_anchorNode,
                                      PositionAnchorType::AfterAnchor);
  // For example, position is before G.
  return PositionTemplate<Strategy>(m_anchorNode,
                                    PositionAnchorType::BeforeAnchor);
}
开发者ID:mirror,项目名称:chromium,代码行数:36,代码来源:PositionIterator.cpp

示例15: DCHECK

DocumentWriter* DocumentLoader::createWriterFor(
    const DocumentInit& init,
    const AtomicString& mimeType,
    const AtomicString& encoding,
    bool dispatchWindowObjectAvailable,
    ParserSynchronizationPolicy parsingPolicy,
    const KURL& overridingURL) {
  LocalFrame* frame = init.frame();

  DCHECK(!frame->document() || !frame->document()->isActive());
  DCHECK_EQ(frame->tree().childCount(), 0u);

  if (!init.shouldReuseDefaultView())
    frame->setDOMWindow(LocalDOMWindow::create(*frame));

  Document* document =
      frame->localDOMWindow()->installNewDocument(mimeType, init);

  if (!init.shouldReuseDefaultView())
    frame->page()->chromeClient().installSupplements(*frame);

  // This should be set before receivedFirstData().
  if (!overridingURL.isEmpty())
    frame->document()->setBaseURLOverride(overridingURL);

  frame->loader().didInstallNewDocument(dispatchWindowObjectAvailable);

  // This must be called before DocumentWriter is created, otherwise HTML parser
  // will use stale values from HTMLParserOption.
  if (!dispatchWindowObjectAvailable)
    frame->loader().receivedFirstData();

  frame->loader().didBeginDocument();

  return DocumentWriter::create(document, parsingPolicy, mimeType, encoding);
}
开发者ID:ollie314,项目名称:chromium,代码行数:36,代码来源:DocumentLoader.cpp


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