Chromium Code Reviews| Index: third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp |
| diff --git a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp |
| index 1a24a8d4c1e963a7a8db4cb48ffeeb9937c0ece1..16af4617659bae77eee9c3cb878141128eedc2b9 100644 |
| --- a/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp |
| +++ b/third_party/WebKit/Source/modules/fetch/CompositeDataConsumerHandle.cpp |
| @@ -37,16 +37,20 @@ public: |
| static PassRefPtr<Context> create(std::unique_ptr<WebDataConsumerHandle> handle) { return adoptRef(new Context(std::move(handle))); } |
| ~Context() |
| { |
| - ASSERT(!m_readerThread); |
| - ASSERT(!m_reader); |
| - ASSERT(!m_client); |
| +#if DCHECK_IS_ON() |
|
yhirano
2016/07/26 09:28:46
I'm not sure what this #if directive is doing. Can
tzik
2016/07/26 09:36:06
Oops, no it's not needed. Removed.
|
| + DCHECK(!m_readerThread); |
| +#endif |
| + DCHECK(!m_reader); |
| + DCHECK(!m_client); |
| } |
| std::unique_ptr<ReaderImpl> obtainReader(Client* client) |
| { |
| MutexLocker locker(m_mutex); |
| - ASSERT(!m_readerThread); |
| - ASSERT(!m_reader); |
| - ASSERT(!m_client); |
| +#if DCHECK_IS_ON() |
| + DCHECK(!m_readerThread); |
| +#endif |
| + DCHECK(!m_reader); |
| + DCHECK(!m_client); |
| ++m_token; |
| m_client = client; |
| m_readerThread = Platform::current()->currentThread(); |
| @@ -56,11 +60,13 @@ public: |
| void detachReader() |
| { |
| MutexLocker locker(m_mutex); |
| - ASSERT(m_readerThread); |
| - ASSERT(m_readerThread->isCurrentThread()); |
| - ASSERT(m_reader); |
| - ASSERT(!m_isInTwoPhaseRead); |
| - ASSERT(!m_isUpdateWaitingForEndRead); |
| +#if DCHECK_IS_ON() |
| + DCHECK(m_readerThread); |
| + DCHECK(m_readerThread->isCurrentThread()); |
| +#endif |
| + DCHECK(m_reader); |
| + DCHECK(!m_isInTwoPhaseRead); |
| + DCHECK(!m_isUpdateWaitingForEndRead); |
| ++m_token; |
| m_reader = nullptr; |
| m_readerThread = nullptr; |
| @@ -80,21 +86,21 @@ public: |
| Result read(void* data, size_t size, Flags flags, size_t* readSize) |
| { |
| - ASSERT(m_readerThread && m_readerThread->isCurrentThread()); |
| + DCHECK(m_readerThread && m_readerThread->isCurrentThread()); |
| return m_reader->read(data, size, flags, readSize); |
| } |
| Result beginRead(const void** buffer, Flags flags, size_t* available) |
| { |
| - ASSERT(m_readerThread && m_readerThread->isCurrentThread()); |
| - ASSERT(!m_isInTwoPhaseRead); |
| + DCHECK(m_readerThread && m_readerThread->isCurrentThread()); |
| + DCHECK(!m_isInTwoPhaseRead); |
| Result r = m_reader->beginRead(buffer, flags, available); |
| m_isInTwoPhaseRead = (r == Ok); |
| return r; |
| } |
| Result endRead(size_t readSize) |
| { |
| - ASSERT(m_readerThread && m_readerThread->isCurrentThread()); |
| - ASSERT(m_isInTwoPhaseRead); |
| + DCHECK(m_readerThread && m_readerThread->isCurrentThread()); |
| + DCHECK(m_isInTwoPhaseRead); |
| Result r = m_reader->endRead(readSize); |
| m_isInTwoPhaseRead = false; |
| if (m_isUpdateWaitingForEndRead) { |
| @@ -128,8 +134,10 @@ private: |
| // This request is not fresh. Ignore it. |
| return; |
| } |
| - ASSERT(m_readerThread); |
| - ASSERT(m_reader); |
| +#if DCHECK_IS_ON() |
| + DCHECK(m_readerThread); |
| +#endif |
| + DCHECK(m_reader); |
| if (m_readerThread->isCurrentThread()) { |
| if (m_isInTwoPhaseRead) { |
| // We are waiting for the two-phase read completion. |
| @@ -186,7 +194,7 @@ Result CompositeDataConsumerHandle::ReaderImpl::endRead(size_t readSize) |
| CompositeDataConsumerHandle::Updater::Updater(PassRefPtr<Context> context) |
| : m_context(context) |
| -#if ENABLE(ASSERT) |
| +#if DCHECK_IS_ON() |
| , m_thread(Platform::current()->currentThread()) |
| #endif |
| { |
| @@ -196,8 +204,10 @@ CompositeDataConsumerHandle::Updater::~Updater() {} |
| void CompositeDataConsumerHandle::Updater::update(std::unique_ptr<WebDataConsumerHandle> handle) |
| { |
| - ASSERT(handle); |
| - ASSERT(m_thread->isCurrentThread()); |
| + DCHECK(handle); |
| +#if DCHECK_IS_ON() |
|
yhirano
2016/07/26 09:28:46
I'm not sure what this #if directive is doing. Can
tzik
2016/07/26 09:36:06
DCHECK requires the statement be well-formed, whil
|
| + DCHECK(m_thread->isCurrentThread()); |
| +#endif |
| m_context->update(std::move(handle)); |
| } |