diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 01:25:18 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 01:25:18 +0000 |
commit | e7f87cfba8e6f916dd88359ed9abf6ec6884d65d (patch) | |
tree | 289b3ec335cf58e6924f5a6fccd8e17ea1c6585a | |
parent | bc3847a1ba39db7adec20aa9e0565f6e868e8480 (diff) | |
download | chromium_src-e7f87cfba8e6f916dd88359ed9abf6ec6884d65d.zip chromium_src-e7f87cfba8e6f916dd88359ed9abf6ec6884d65d.tar.gz chromium_src-e7f87cfba8e6f916dd88359ed9abf6ec6884d65d.tar.bz2 |
Revert "cc: Switch to Chromium DCHECKs LOGs"
This reverts commit 162296. (https://chromiumcodereview.appspot.com/11048044)
TBR=danakj@chromium.org
Review URL: https://codereview.chromium.org/11196014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162297 0039d316-1c4b-4281-b951-d872f2087c98
98 files changed, 697 insertions, 760 deletions
@@ -21,8 +21,6 @@ include_rules = [ "+Source/WebCore/platform/graphics/IntPoint.h", "+Source/WebCore/platform/graphics/IntRect.h", "+Source/WebCore/platform/graphics/IntSize.h", - "+third_party/WebKit/Source/WTF/config.h", - "+Source/WTF/config.h", # http://crbug.com/144540 "+third_party/WebKit/Source/WebCore/platform/graphics/Region.h", "+Source/WebCore/platform/graphics/Region.h", diff --git a/cc/animation_curve.cc b/cc/animation_curve.cc index c2c3dc0..7cd0158 100644 --- a/cc/animation_curve.cc +++ b/cc/animation_curve.cc @@ -6,13 +6,11 @@ #include "CCAnimationCurve.h" -#include "base/logging.h" - namespace cc { const CCFloatAnimationCurve* CCAnimationCurve::toFloatAnimationCurve() const { - DCHECK(type() == CCAnimationCurve::Float); + ASSERT(type() == CCAnimationCurve::Float); return static_cast<const CCFloatAnimationCurve*>(this); } @@ -23,7 +21,7 @@ CCAnimationCurve::Type CCFloatAnimationCurve::type() const const CCTransformAnimationCurve* CCAnimationCurve::toTransformAnimationCurve() const { - DCHECK(type() == CCAnimationCurve::Transform); + ASSERT(type() == CCAnimationCurve::Transform); return static_cast<const CCTransformAnimationCurve*>(this); } diff --git a/cc/caching_bitmap_canvas_layer_texture_updater.cc b/cc/caching_bitmap_canvas_layer_texture_updater.cc index 6e82c24..a8a8483 100644 --- a/cc/caching_bitmap_canvas_layer_texture_updater.cc +++ b/cc/caching_bitmap_canvas_layer_texture_updater.cc @@ -45,7 +45,7 @@ void CachingBitmapCanvasLayerTextureUpdater::prepareToUpdate( const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false); SkAutoLockPixels lock(new_bitmap); - DCHECK(new_bitmap.bytesPerPixel() > 0); + ASSERT(new_bitmap.bytesPerPixel() > 0); pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || new_bitmap.height() != cached_bitmap_.height() || new_bitmap.width() != cached_bitmap_.width() || @@ -5,7 +5,6 @@ { 'variables': { 'cc_source_files': [ - 'dcheck.h', 'hash_pair.h', 'scoped_ptr_hash_map.h', 'scoped_ptr_vector.h', @@ -356,7 +355,6 @@ 'stubs/TraceEvent.h', 'stubs/UnitBezier.h', - 'stubs/config.h' 'stubs/extensions_3d_chromium.h', 'stubs/extensions_3d.h', 'stubs/float_point_3d.h', diff --git a/cc/checkerboard_draw_quad.cc b/cc/checkerboard_draw_quad.cc index cba8813..f1b34a3 100644 --- a/cc/checkerboard_draw_quad.cc +++ b/cc/checkerboard_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCCheckerboardDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) @@ -23,7 +21,7 @@ CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQu const CCCheckerboardDrawQuad* CCCheckerboardDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::Checkerboard); + ASSERT(quad->material() == CCDrawQuad::Checkerboard); return static_cast<const CCCheckerboardDrawQuad*>(quad); } diff --git a/cc/completion_event.h b/cc/completion_event.h index 8113fab..795b030 100644 --- a/cc/completion_event.h +++ b/cc/completion_event.h @@ -7,7 +7,6 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" -#include "cc/dcheck.h" namespace cc { @@ -20,7 +19,7 @@ public: CCCompletionEvent() : m_event(false /* manual_reset */, false /* initially_signaled */) { -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG m_waited = false; m_signaled = false; #endif @@ -28,14 +27,14 @@ public: ~CCCompletionEvent() { - DCHECK(m_waited); - DCHECK(m_signaled); + ASSERT(m_waited); + ASSERT(m_signaled); } void wait() { - DCHECK(!m_waited); -#if CC_DCHECK_ENABLED() + ASSERT(!m_waited); +#ifndef NDEBUG m_waited = true; #endif base::ThreadRestrictions::ScopedAllowWait allow_wait; @@ -44,8 +43,8 @@ public: void signal() { - DCHECK(!m_signaled); -#if CC_DCHECK_ENABLED() + ASSERT(!m_signaled); +#ifndef NDEBUG m_signaled = true; #endif m_event.Signal(); @@ -53,7 +52,7 @@ public: private: base::WaitableEvent m_event; -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG // Used to assert that wait() and signal() are each called exactly once. bool m_waited; bool m_signaled; diff --git a/cc/damage_tracker.cc b/cc/damage_tracker.cc index f6ad5fb..12901292 100644 --- a/cc/damage_tracker.cc +++ b/cc/damage_tracker.cc @@ -162,8 +162,8 @@ FloatRect CCDamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIs void CCDamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect) { // This layer should not yet exist in next frame's history. - DCHECK(layerID > 0); - DCHECK(m_nextRectHistory->find(layerID) == m_nextRectHistory->end()); + ASSERT(layerID > 0); + ASSERT(m_nextRectHistory->find(layerID) == m_nextRectHistory->end()); (*m_nextRectHistory)[layerID] = targetSpaceRect; } diff --git a/cc/dcheck.h b/cc/dcheck.h deleted file mode 100644 index acd3c90..0000000 --- a/cc/dcheck.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_DCHECK_H_ -#define CC_DCHECK_H_ - -#include "base/logging.h" - -// TODO(danakj): Move this into base/logging. - -#if !LOGGING_IS_OFFICIAL_BUILD -#define CC_DCHECK_ENABLED() 1 -#else -#define CC_DCHECK_ENABLED() 0 -#endif - -#endif // CC_DCHECK_H_ diff --git a/cc/debug_border_draw_quad.cc b/cc/debug_border_draw_quad.cc index a8b9d35..aabf9e2 100644 --- a/cc/debug_border_draw_quad.cc +++ b/cc/debug_border_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCDebugBorderDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) @@ -27,7 +25,7 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad const CCDebugBorderDrawQuad* CCDebugBorderDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::DebugBorder); + ASSERT(quad->material() == CCDrawQuad::DebugBorder); return static_cast<const CCDebugBorderDrawQuad*>(quad); } diff --git a/cc/debug_rect_history.cc b/cc/debug_rect_history.cc index 7ff9f75..17fda21 100644 --- a/cc/debug_rect_history.cc +++ b/cc/debug_rect_history.cc @@ -70,7 +70,7 @@ void CCDebugRectHistory::savePropertyChangedRects(const std::vector<CCLayerImpl* for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - DCHECK(renderSurface); + ASSERT(renderSurface); const std::vector<CCLayerImpl*>& layerList = renderSurface->layerList(); for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { @@ -93,7 +93,7 @@ void CCDebugRectHistory::saveSurfaceDamageRects(const std::vector<CCLayerImpl* > for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - DCHECK(renderSurface); + ASSERT(renderSurface); m_debugRects.append(CCDebugRect(SurfaceDamageRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()->currentDamageRect()))); } @@ -104,7 +104,7 @@ void CCDebugRectHistory::saveScreenSpaceRects(const std::vector<CCLayerImpl* >& for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - DCHECK(renderSurface); + ASSERT(renderSurface); m_debugRects.append(CCDebugRect(ScreenSpaceRectType, CCMathUtil::mapClippedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); diff --git a/cc/delay_based_time_source.cc b/cc/delay_based_time_source.cc index ca02564..be0b10b 100644 --- a/cc/delay_based_time_source.cc +++ b/cc/delay_based_time_source.cc @@ -6,7 +6,6 @@ #include "CCDelayBasedTimeSource.h" -#include "base/logging.h" #include "TraceEvent.h" #include <algorithm> #include <wtf/CurrentTime.h> @@ -92,7 +91,7 @@ base::TimeTicks CCDelayBasedTimeSource::nextTickTime() void CCDelayBasedTimeSource::onTimerFired() { - DCHECK(m_state != STATE_INACTIVE); + ASSERT(m_state != STATE_INACTIVE); base::TimeTicks now = this->now(); m_lastTickTime = now; @@ -204,7 +203,7 @@ base::TimeTicks CCDelayBasedTimeSource::nextTickTarget(base::TimeTicks now) int intervalsElapsed = static_cast<int>(floor((now - m_nextParameters.tickTarget).InSecondsF() / newInterval.InSecondsF())); base::TimeTicks lastEffectiveTick = m_nextParameters.tickTarget + newInterval * intervalsElapsed; base::TimeTicks newTickTarget = lastEffectiveTick + newInterval; - DCHECK(newTickTarget > now); + ASSERT(newTickTarget > now); // Avoid double ticks when: // 1) Turning off the timer and turning it right back on. @@ -221,7 +220,7 @@ void CCDelayBasedTimeSource::postNextTickTask(base::TimeTicks now) // Post another task *before* the tick and update state base::TimeDelta delay = newTickTarget - now; - DCHECK(delay.InMillisecondsF() <= + ASSERT(delay.InMillisecondsF() <= m_nextParameters.interval.InMillisecondsF() * (1.0 + doubleTickThreshold)); m_timer.startOneShot(delay.InSecondsF()); diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc index b6d1ab6..02d5698 100644 --- a/cc/delegated_renderer_layer_impl.cc +++ b/cc/delegated_renderer_layer_impl.cc @@ -90,20 +90,20 @@ CCRenderPass::Id CCDelegatedRendererLayerImpl::nextContributingRenderPassId(CCRe CCRenderPass::Id CCDelegatedRendererLayerImpl::convertDelegatedRenderPassId(CCRenderPass::Id delegatedRenderPassId) const { base::hash_map<CCRenderPass::Id, int>::const_iterator it = m_renderPassesIndexById.find(delegatedRenderPassId); - DCHECK(it != m_renderPassesIndexById.end()); + ASSERT(it != m_renderPassesIndexById.end()); unsigned delegatedRenderPassIndex = it->second; return CCRenderPass::Id(id(), indexToId(delegatedRenderPassIndex)); } void CCDelegatedRendererLayerImpl::appendContributingRenderPasses(CCRenderPassSink& renderPassSink) { - DCHECK(hasContributingDelegatedRenderPasses()); + ASSERT(hasContributingDelegatedRenderPasses()); for (size_t i = 0; i < m_renderPassesInDrawOrder.size() - 1; ++i) { CCRenderPass::Id outputRenderPassId = convertDelegatedRenderPassId(m_renderPassesInDrawOrder[i]->id()); // Don't clash with the RenderPass we generate if we own a RenderSurface. - DCHECK(outputRenderPassId.index > 0); + ASSERT(outputRenderPassId.index > 0); renderPassSink.appendRenderPass(m_renderPassesInDrawOrder[i]->copy(outputRenderPassId)); } @@ -123,13 +123,13 @@ void CCDelegatedRendererLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQua bool shouldMergeRootRenderPassWithTarget = !targetRenderPassId.index; if (shouldMergeRootRenderPassWithTarget) { // Verify that the renderPass we are appending to is created our renderTarget. - DCHECK(targetRenderPassId.layerId == renderTarget()->id()); + ASSERT(targetRenderPassId.layerId == renderTarget()->id()); CCRenderPass* rootDelegatedRenderPass = m_renderPassesInDrawOrder.last(); appendRenderPassQuads(quadSink, appendQuadsData, rootDelegatedRenderPass); } else { // Verify that the renderPass we are appending to was created by us. - DCHECK(targetRenderPassId.layerId == id()); + ASSERT(targetRenderPassId.layerId == id()); int renderPassIndex = idToIndex(targetRenderPassId.index); CCRenderPass* delegatedRenderPass = m_renderPassesInDrawOrder[renderPassIndex]; @@ -150,16 +150,16 @@ void CCDelegatedRendererLayerImpl::appendRenderPassQuads(CCQuadSink& quadSink, C bool targetIsFromDelegatedRendererLayer = appendQuadsData.renderPassId.layerId == id(); if (!targetIsFromDelegatedRendererLayer) { // Should be the root render pass. - DCHECK(delegatedRenderPass == m_renderPassesInDrawOrder.last()); + ASSERT(delegatedRenderPass == m_renderPassesInDrawOrder.last()); // This layer must be drawing to a renderTarget other than itself. - DCHECK(renderTarget() != this); + ASSERT(renderTarget() != this); copiedSharedQuadState->clippedRectInTarget = CCMathUtil::mapClippedRect(drawTransform(), copiedSharedQuadState->clippedRectInTarget); copiedSharedQuadState->quadTransform = copiedSharedQuadState->quadTransform * drawTransform(); copiedSharedQuadState->opacity *= drawOpacity(); } } - DCHECK(copiedSharedQuadState); + ASSERT(copiedSharedQuadState); scoped_ptr<CCDrawQuad> copyQuad; if (quad->material() != CCDrawQuad::RenderPass) @@ -167,11 +167,11 @@ void CCDelegatedRendererLayerImpl::appendRenderPassQuads(CCQuadSink& quadSink, C else { CCRenderPass::Id contributingDelegatedRenderPassId = CCRenderPassDrawQuad::materialCast(quad)->renderPassId(); CCRenderPass::Id contributingRenderPassId = convertDelegatedRenderPassId(contributingDelegatedRenderPassId); - DCHECK(contributingRenderPassId != appendQuadsData.renderPassId); + ASSERT(contributingRenderPassId != appendQuadsData.renderPassId); copyQuad = CCRenderPassDrawQuad::materialCast(quad)->copy(copiedSharedQuadState, contributingRenderPassId).PassAs<CCDrawQuad>(); } - DCHECK(copyQuad.get()); + ASSERT(copyQuad.get()); quadSink.append(copyQuad.Pass(), appendQuadsData); } diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc index 68deadb..23fa1d3 100644 --- a/cc/direct_renderer.cc +++ b/cc/direct_renderer.cc @@ -132,7 +132,7 @@ void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); CachedTexture* texture = passIterator->second; - DCHECK(texture); + ASSERT(texture); if (texture->id() && (texture->size() != requiredSize || texture->format() != requiredFormat)) texture->free(); @@ -153,7 +153,7 @@ void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis void CCDirectRenderer::drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) { const CCRenderPass* rootRenderPass = renderPassesInDrawOrder.back(); - DCHECK(rootRenderPass); + ASSERT(rootRenderPass); DrawingFrame frame; frame.renderPassesById = &renderPassesById; @@ -209,7 +209,7 @@ bool CCDirectRenderer::useRenderPass(DrawingFrame& frame, const CCRenderPass* re } CachedTexture* texture = m_renderPassTextures.get(renderPass->id()); - DCHECK(texture); + ASSERT(texture); if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, renderPassTextureSize(renderPass), renderPassTextureFormat(renderPass), CCResourceProvider::TextureUsageFramebuffer)) return false; diff --git a/cc/draw_quad.cc b/cc/draw_quad.cc index 999b0aa..b88eac6 100644 --- a/cc/draw_quad.cc +++ b/cc/draw_quad.cc @@ -5,7 +5,6 @@ #include "config.h" #include "CCDrawQuad.h" -#include "base/logging.h" #include "CCCheckerboardDrawQuad.h" #include "CCDebugBorderDrawQuad.h" #include "CCIOSurfaceDrawQuad.h" @@ -28,8 +27,8 @@ CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material materi , m_quadOpaque(true) , m_needsBlending(false) { - DCHECK(m_sharedQuadState); - DCHECK(m_material != Invalid); + ASSERT(m_sharedQuadState); + ASSERT(m_material != Invalid); } IntRect CCDrawQuad::opaqueRect() const @@ -80,10 +79,10 @@ unsigned CCDrawQuad::size() const scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState) const { // RenderPass quads have their own copy() method. - DCHECK(material() != RenderPass); + ASSERT(material() != RenderPass); unsigned bytes = size(); - DCHECK(bytes > 0); + ASSERT(bytes); scoped_ptr<CCDrawQuad> copyQuad(reinterpret_cast<CCDrawQuad*>(new char[bytes])); memcpy(copyQuad.get(), this, bytes); diff --git a/cc/font_atlas.cc b/cc/font_atlas.cc index 9a48300..20ed9df 100644 --- a/cc/font_atlas.cc +++ b/cc/font_atlas.cc @@ -31,7 +31,7 @@ CCFontAtlas::~CCFontAtlas() void CCFontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const std::string& text, const gfx::Point& destPosition, const IntSize& clip) const { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); std::vector<std::string> lines; base::SplitString(text, '\n', &lines); @@ -47,7 +47,7 @@ void CCFontAtlas::drawText(SkCanvas* canvas, const SkPaint& paint, const std::st void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint, const std::string& textLine, const gfx::Point& destPosition) const { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); gfx::Point position = destPosition; for (unsigned i = 0; i < textLine.length(); ++i) { @@ -62,7 +62,7 @@ void CCFontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& pai void CCFontAtlas::drawDebugAtlas(SkCanvas* canvas, const gfx::Point& destPosition) const { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); SkIRect source = SkIRect::MakeWH(m_atlas.width(), m_atlas.height()); canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(destPosition.x(), destPosition.y(), m_atlas.width(), m_atlas.height())); diff --git a/cc/frame_rate_controller.cc b/cc/frame_rate_controller.cc index c154226..c996ebd 100644 --- a/cc/frame_rate_controller.cc +++ b/cc/frame_rate_controller.cc @@ -6,7 +6,6 @@ #include "CCFrameRateController.h" -#include "base/logging.h" #include "CCDelayBasedTimeSource.h" #include "CCTimeSource.h" #include "TraceEvent.h" @@ -89,7 +88,7 @@ void CCFrameRateController::setActive(bool active) void CCFrameRateController::setMaxFramesPending(int maxFramesPending) { - DCHECK(maxFramesPending > 0); + ASSERT(maxFramesPending > 0); m_maxFramesPending = maxFramesPending; } @@ -106,7 +105,7 @@ void CCFrameRateController::setSwapBuffersCompleteSupported(bool supported) void CCFrameRateController::onTimerTick() { - DCHECK(m_active); + ASSERT(m_active); // Check if we have too many frames in flight. bool throttled = m_numFramesPending >= m_maxFramesPending; @@ -139,7 +138,7 @@ void CCFrameRateController::didBeginFrame() void CCFrameRateController::didFinishFrame() { - DCHECK(m_swapBuffersCompleteSupported); + ASSERT(m_swapBuffersCompleteSupported); m_numFramesPending--; if (!m_isTimeSourceThrottling) diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc index 898086c..a02486b 100644 --- a/cc/frame_rate_counter.cc +++ b/cc/frame_rate_counter.cc @@ -126,8 +126,7 @@ void CCFrameRateCounter::getAverageFPSAndStandardDeviation(double& averageFPS, d base::TimeTicks CCFrameRateCounter::timeStampOfRecentFrame(int n) { - DCHECK(n >= 0); - DCHECK(n < kTimeStampHistorySize); + ASSERT(n >= 0 && n < kTimeStampHistorySize); int desiredIndex = (frameIndex(m_currentFrameNumber) + n) % kTimeStampHistorySize; return m_timeStampHistory[desiredIndex]; } diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index 9755b27..f76863e 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -21,9 +21,11 @@ #include "GrTexture.h" #include "NotImplemented.h" #include "TraceEvent.h" +#ifdef LOG +#undef LOG +#endif #include "base/string_split.h" #include "base/string_util.h" -#include "cc/dcheck.h" #include "cc/geometry_binding.h" #include "cc/platform_color.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -77,7 +79,7 @@ CCRendererGL::CCRendererGL(CCRendererClient* client, , m_isUsingBindUniform(false) , m_visible(true) { - DCHECK(m_context); + ASSERT(m_context); } bool CCRendererGL::initialize() @@ -113,7 +115,7 @@ bool CCRendererGL::initialize() m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibility"); if (extensions.count("GL_CHROMIUM_iosurface")) - DCHECK(extensions.count("GL_ARB_texture_rectangle")); + ASSERT(extensions.count("GL_ARB_texture_rectangle")); m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_memory_manager"); if (m_capabilities.usingGpuMemoryManager) @@ -138,7 +140,7 @@ bool CCRendererGL::initialize() CCRendererGL::~CCRendererGL() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); m_context->setSwapBuffersCompleteCallbackCHROMIUM(0); m_context->setMemoryAllocationChangedCallbackCHROMIUM(0); m_context->setContextLostCallback(0); @@ -159,7 +161,7 @@ void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* comman { unsigned long error = context->getError(); if (error != GraphicsContext3D::NO_ERROR) - LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line << "\n\tcommand: " << command << ", error " << static_cast<int>(error) << "\n"; + LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error)); } void CCRendererGL::setVisible(bool visible) @@ -192,7 +194,7 @@ void CCRendererGL::clearFramebuffer(DrawingFrame& frame) else GLC(m_context, m_context->clearColor(0, 0, 1, 1)); -#if !CC_DCHECK_ENABLED() +#if defined(NDEBUG) if (frame.currentRenderPass->hasTransparentBackground()) #endif m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); @@ -241,7 +243,7 @@ void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) switch (quad->material()) { case CCDrawQuad::Invalid: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; case CCDrawQuad::Checkerboard: drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad)); @@ -276,7 +278,7 @@ void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad) { const TileCheckerboardProgram* program = tileCheckerboardProgram(); - DCHECK(program && program->initialized()); + ASSERT(program && program->initialized()); GLC(context(), context()->useProgram(program->program())); SkColor color = quad->color(); @@ -302,7 +304,7 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB { static float glMatrix[16]; const SolidColorProgram* program = solidColorProgram(); - DCHECK(program && program->initialized()); + ASSERT(program && program->initialized()); GLC(context(), context()->useProgram(program->program())); // Use the full quadRect for debug quads to not move the edges based on partial swaps. @@ -367,7 +369,7 @@ scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr // translucent pixels, and the contents behind those translucent pixels wouldn't have the filter applied. if (frame.currentRenderPass->hasTransparentBackground()) return scoped_ptr<CCScopedTexture>(); - DCHECK(!frame.currentTexture); + ASSERT(!frame.currentTexture); // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused). IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox())); @@ -420,7 +422,7 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra return; const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPassId()); - DCHECK(renderPass); + ASSERT(renderPass); if (!renderPass) return; @@ -449,14 +451,14 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra // Draw the background texture if there is one. if (backgroundTexture) { - DCHECK(backgroundTexture->size() == quad->quadRect().size()); + ASSERT(backgroundTexture->size() == quad->quadRect().size()); CCResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTexture->id()); copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad->quadTransform()); } bool clipped = false; FloatQuad deviceQuad = CCMathUtil::mapQuad(contentsDeviceTransform, sharedGeometryQuad(), clipped); - DCHECK(!clipped); + ASSERT(!clipped); CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox())); CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad); @@ -527,8 +529,8 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra } if (shaderMaskSamplerLocation != -1) { - DCHECK(shaderMaskTexCoordScaleLocation != 1); - DCHECK(shaderMaskTexCoordOffsetLocation != 1); + ASSERT(shaderMaskTexCoordScaleLocation != 1); + ASSERT(shaderMaskTexCoordOffsetLocation != 1); GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, quad->maskTexCoordScaleX(), quad->maskTexCoordScaleY())); @@ -546,7 +548,7 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); - DCHECK(!clipped); + ASSERT(!clipped); setShaderOpacity(quad->opacity(), shaderAlphaLocation); setShaderFloatQuad(surfaceQuad, shaderQuadLocation); @@ -634,7 +636,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* bool clipped = false; FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped); - DCHECK(!clipped); + ASSERT(!clipped); TileProgramUniforms uniforms; // For now, we simply skip anti-aliasing with the quad is clipped. This only happens @@ -689,13 +691,13 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* // Map points to device space. bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped); - DCHECK(!clipped); + ASSERT(!clipped); bottomLeft = CCMathUtil::mapPoint(deviceTransform, bottomLeft, clipped); - DCHECK(!clipped); + ASSERT(!clipped); topLeft = CCMathUtil::mapPoint(deviceTransform, topLeft, clipped); - DCHECK(!clipped); + ASSERT(!clipped); topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped); - DCHECK(!clipped); + ASSERT(!clipped); CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft); CCLayerQuad::Edge leftEdge(bottomLeft, topLeft); @@ -725,7 +727,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); - // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become + // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. } else { // Move fragment shader transform to vertex shader. We can do this while @@ -762,7 +764,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad) { const VideoYUVProgram* program = videoYUVProgram(); - DCHECK(program && program->initialized()); + ASSERT(program && program->initialized()); const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane(); const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); @@ -823,7 +825,7 @@ void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream { static float glMatrix[16]; - DCHECK(m_capabilities.usingEglImage); + ASSERT(m_capabilities.usingEglImage); const VideoStreamTextureProgram* program = videoStreamTextureProgram(); GLC(context(), context()->useProgram(program->program())); @@ -843,7 +845,7 @@ void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream struct TextureProgramBinding { template<class Program> void set(Program* program) { - DCHECK(program && program->initialized()); + ASSERT(program && program->initialized()); programId = program->program(); samplerLocation = program->fragmentShader().samplerLocation(); matrixLocation = program->vertexShader().matrixLocation(); @@ -866,7 +868,7 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding { void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TexTransformTextureProgramBinding binding; if (quad->flipped()) @@ -910,7 +912,7 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TexTransformTextureProgramBinding binding; binding.set(textureIOSurfaceProgram()); @@ -1023,8 +1025,8 @@ void CCRendererGL::finish() bool CCRendererGL::swapBuffers() { - DCHECK(m_visible); - DCHECK(!m_isFramebufferDiscarded); + ASSERT(m_visible); + ASSERT(!m_isFramebufferDiscarded); TRACE_EVENT0("cc", "CCRendererGL::swapBuffers"); // We're done! Time to swapbuffers! @@ -1054,11 +1056,11 @@ void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocat { // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread. if (!CCProxy::hasImplThread()) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); DebugScopedSetImplThread impl; onMemoryAllocationChangedOnImplThread(allocation); } else { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); onMemoryAllocationChangedOnImplThread(allocation); } } @@ -1115,8 +1117,7 @@ void CCRendererGL::onContextLost() void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) { - DCHECK(rect.maxX() <= viewportWidth()); - DCHECK(rect.maxY() <= viewportHeight()); + ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); if (!pixels) return; @@ -1147,7 +1148,7 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, temporaryFBO)); GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, temporaryTexture, 0)); - DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); + ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); } scoped_array<uint8_t> srcPixels(new uint8_t[rect.width() * rect.height() * 4]); @@ -1189,7 +1190,7 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) { - DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); + ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) return false; @@ -1203,7 +1204,7 @@ bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) { - DCHECK(texture->id()); + ASSERT(texture->id()); frame.currentRenderPass = 0; frame.currentTexture = texture; @@ -1218,14 +1219,19 @@ void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) { - DCHECK(texture->id()); + ASSERT(texture->id()); GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); m_currentFramebufferLock = make_scoped_ptr(new CCResourceProvider::ScopedWriteLockGL(m_resourceProvider, texture->id())); unsigned textureId = m_currentFramebufferLock->textureId(); GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId, 0)); - DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); +#if !defined ( NDEBUG ) + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { + ASSERT_NOT_REACHED(); + return false; + } +#endif initializeMatrices(frame, framebufferRect, false); setDrawViewportSize(framebufferRect.size()); @@ -1298,7 +1304,7 @@ const CCRendererGL::SolidColorProgram* CCRendererGL::solidColorProgram() const CCRendererGL::RenderPassProgram* CCRendererGL::renderPassProgram() { - DCHECK(m_renderPassProgram); + ASSERT(m_renderPassProgram); if (!m_renderPassProgram->initialized()) { TRACE_EVENT0("cc", "CCRendererGL::renderPassProgram::initialize"); m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); @@ -1341,7 +1347,7 @@ const CCRendererGL::RenderPassMaskProgramAA* CCRendererGL::renderPassMaskProgram const CCRendererGL::TileProgram* CCRendererGL::tileProgram() { - DCHECK(m_tileProgram); + ASSERT(m_tileProgram); if (!m_tileProgram->initialized()) { TRACE_EVENT0("cc", "CCRendererGL::tileProgram::initialize"); m_tileProgram->initialize(m_context, m_isUsingBindUniform); @@ -1351,7 +1357,7 @@ const CCRendererGL::TileProgram* CCRendererGL::tileProgram() const CCRendererGL::TileProgramOpaque* CCRendererGL::tileProgramOpaque() { - DCHECK(m_tileProgramOpaque); + ASSERT(m_tileProgramOpaque); if (!m_tileProgramOpaque->initialized()) { TRACE_EVENT0("cc", "CCRendererGL::tileProgramOpaque::initialize"); m_tileProgramOpaque->initialize(m_context, m_isUsingBindUniform); diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h index 58ba1f0..caf7495 100644 --- a/cc/gl_renderer.h +++ b/cc/gl_renderer.h @@ -223,7 +223,7 @@ private: // will significantly degrade performance. #define DEBUG_GL_CALLS 0 -#if DEBUG_GL_CALLS && !defined(NDEBUG) +#if DEBUG_GL_CALLS && !defined ( NDEBUG ) #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__)) #else #define GLC(context, x) (x) diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index af9ee7e..1b64595 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -43,7 +43,7 @@ public: int frameCount() { return m_frame; } void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); // In single threaded mode we expect this callback on main thread. DebugScopedSetMainThread main; m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation); @@ -251,7 +251,7 @@ public: // We allow querying the shader compilation and program link status in debug mode, but not release. virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) { -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG *value = 1; #else ADD_FAILURE(); @@ -260,7 +260,7 @@ public: virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) { -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG *value = 1; #else ADD_FAILURE(); @@ -403,7 +403,7 @@ TEST(CCRendererGLTest2, opaqueBackground) // On DEBUG builds, render passes with opaque background clear to blue to // easily see regions that were not drawn on the screen. -#if CC_DCHECK_ENABLED() +#if defined(NDEBUG) EXPECT_EQ(0, context->clearCount()); #else EXPECT_EQ(1, context->clearCount()); diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc index c6a46b8..4b64b1a 100644 --- a/cc/heads_up_display_layer_impl.cc +++ b/cc/heads_up_display_layer_impl.cc @@ -105,7 +105,7 @@ void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourcePro SkAutoLockPixels locker(*bitmap); IntRect layerRect(IntPoint(), bounds()); - DCHECK(bitmap->config() == SkBitmap::kARGB_8888_Config); + ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config); resourceProvider->upload(m_hudTexture->id(), static_cast<const uint8_t*>(bitmap->getPixels()), layerRect, layerRect, IntSize()); } @@ -119,7 +119,7 @@ void CCHeadsUpDisplayLayerImpl::didDraw(CCResourceProvider* resourceProvider) // FIXME: the following assert will not be true when sending resources to a // parent compositor. We will probably need to hold on to m_hudTexture for // longer, and have several HUD textures in the pipeline. - DCHECK(!resourceProvider->inUseByConsumer(m_hudTexture->id())); + ASSERT(!resourceProvider->inUseByConsumer(m_hudTexture->id())); } void CCHeadsUpDisplayLayerImpl::didLoseContext() diff --git a/cc/io_surface_draw_quad.cc b/cc/io_surface_draw_quad.cc index 2cd2ca6..5d50043 100644 --- a/cc/io_surface_draw_quad.cc +++ b/cc/io_surface_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCIOSurfaceDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCIOSurfaceDrawQuad> CCIOSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation) @@ -25,7 +23,7 @@ CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadStat const CCIOSurfaceDrawQuad* CCIOSurfaceDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::IOSurfaceContent); + ASSERT(quad->material() == CCDrawQuad::IOSurfaceContent); return static_cast<const CCIOSurfaceDrawQuad*>(quad); } diff --git a/cc/keyframed_animation_curve.cc b/cc/keyframed_animation_curve.cc index b536095..a6b368e 100644 --- a/cc/keyframed_animation_curve.cc +++ b/cc/keyframed_animation_curve.cc @@ -31,7 +31,7 @@ void insertKeyframe(scoped_ptr<Keyframe> keyframe, ScopedPtrVector<Keyframe>& ke scoped_ptr<CCTimingFunction> cloneTimingFunction(const CCTimingFunction* timingFunction) { - DCHECK(timingFunction); + ASSERT(timingFunction); scoped_ptr<CCAnimationCurve> curve(timingFunction->clone()); return scoped_ptr<CCTimingFunction>(static_cast<CCTimingFunction*>(curve.release())); } diff --git a/cc/layer.cc b/cc/layer.cc index 85a5221..a7b74c8 100644 --- a/cc/layer.cc +++ b/cc/layer.cc @@ -77,7 +77,7 @@ LayerChromium::~LayerChromium() { // Our parent should be holding a reference to us so there should be no // way for us to be destroyed while we still have a parent. - DCHECK(!parent()); + ASSERT(!parent()); // Remove the parent reference from all children. removeAllChildren(); @@ -125,7 +125,7 @@ IntRect LayerChromium::layerRectToContentRect(const WebKit::WebRect& layerRect) void LayerChromium::setParent(LayerChromium* layer) { - DCHECK(!layer || !layer->hasAncestor(this)); + ASSERT(!layer || !layer->hasAncestor(this)); m_parent = layer; setLayerTreeHost(m_parent ? m_parent->layerTreeHost() : 0); } @@ -186,7 +186,7 @@ void LayerChromium::replaceChild(LayerChromium* reference, scoped_refptr<LayerCh int referenceIndex = indexOfChild(reference); if (referenceIndex == -1) { - NOTREACHED(); + ASSERT_NOT_REACHED(); return; } @@ -234,7 +234,7 @@ void LayerChromium::removeAllChildren() { while (m_children.size()) { LayerChromium* layer = m_children[0].get(); - DCHECK(layer->parent()); + ASSERT(layer->parent()); layer->removeFromParent(); } } @@ -654,7 +654,7 @@ void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale) void LayerChromium::createRenderSurface() { - DCHECK(!m_renderSurface); + ASSERT(!m_renderSurface); m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this)); setRenderTarget(this); } @@ -202,7 +202,7 @@ public: bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } - LayerChromium* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } + LayerChromium* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } void setRenderTarget(LayerChromium* target) { m_renderTarget = target; } bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc index 20e4984..2025db8 100644 --- a/cc/layer_animation_controller.cc +++ b/cc/layer_animation_controller.cc @@ -184,7 +184,7 @@ void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationC CCActiveAnimation::RunState initialRunState = CCActiveAnimation::WaitingForTargetAvailability; double startTime = 0; scoped_ptr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndInitialize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); - DCHECK(!toAdd->needsSynchronizedStartTime()); + ASSERT(!toAdd->needsSynchronizedStartTime()); controllerImpl->addAnimation(toAdd.Pass()); } } @@ -397,7 +397,8 @@ void CCLayerAnimationController::tickAnimations(double monotonicTime) // Do nothing for sentinel value. case CCActiveAnimation::TargetPropertyEnumSize: - NOTREACHED(); + ASSERT_NOT_REACHED(); + } } } diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc index a7307a5..2b30363 100644 --- a/cc/layer_impl.cc +++ b/cc/layer_impl.cc @@ -54,19 +54,21 @@ CCLayerImpl::CCLayerImpl(int id) , m_debugBorderWidth(0) , m_drawTransformIsAnimating(false) , m_screenSpaceTransformIsAnimating(false) -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG , m_betweenWillDrawAndDidDraw(false) #endif , m_layerAnimationController(CCLayerAnimationController::create(this)) { - DCHECK(CCProxy::isImplThread()); - DCHECK(m_layerId > 0); + ASSERT(CCProxy::isImplThread()); + ASSERT(m_layerId > 0); } CCLayerImpl::~CCLayerImpl() { - DCHECK(CCProxy::isImplThread()); - DCHECK(!m_betweenWillDrawAndDidDraw); + ASSERT(CCProxy::isImplThread()); +#ifndef NDEBUG + ASSERT(!m_betweenWillDrawAndDidDraw); +#endif } void CCLayerImpl::addChild(scoped_ptr<CCLayerImpl> child) @@ -104,7 +106,7 @@ void CCLayerImpl::clearChildList() void CCLayerImpl::createRenderSurface() { - DCHECK(!m_renderSurface); + ASSERT(!m_renderSurface); m_renderSurface = make_scoped_ptr(new CCRenderSurface(this)); setRenderTarget(this); } @@ -125,17 +127,17 @@ scoped_ptr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const void CCLayerImpl::willDraw(CCResourceProvider*) { -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG // willDraw/didDraw must be matched. - DCHECK(!m_betweenWillDrawAndDidDraw); + ASSERT(!m_betweenWillDrawAndDidDraw); m_betweenWillDrawAndDidDraw = true; #endif } void CCLayerImpl::didDraw(CCResourceProvider*) { -#if CC_DCHECK_ENABLED() - DCHECK(m_betweenWillDrawAndDidDraw); +#ifndef NDEBUG + ASSERT(m_betweenWillDrawAndDidDraw); m_betweenWillDrawAndDidDraw = false; #endif } @@ -166,7 +168,7 @@ CCRenderPass::Id CCLayerImpl::nextContributingRenderPassId(CCRenderPass::Id) con CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const { - NOTREACHED(); + ASSERT_NOT_REACHED(); return 0; } diff --git a/cc/layer_impl.h b/cc/layer_impl.h index b2b5988..01ab13a 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -6,7 +6,6 @@ #define CCLayerImpl_h #include "base/memory/scoped_ptr.h" -#include "cc/dcheck.h" #include "cc/scoped_ptr_vector.h" #include "CCInputHandler.h" #include "CCLayerAnimationController.h" @@ -161,7 +160,7 @@ public: bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; } void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; } - CCLayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } + CCLayerImpl* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; } void setRenderTarget(CCLayerImpl* target) { m_renderTarget = target; } void setBounds(const IntSize&); @@ -368,7 +367,7 @@ private: bool m_drawTransformIsAnimating; bool m_screenSpaceTransformIsAnimating; -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG bool m_betweenWillDrawAndDidDraw; #endif diff --git a/cc/layer_iterator.h b/cc/layer_iterator.h index dbfac53..4d36080 100644 --- a/cc/layer_iterator.h +++ b/cc/layer_iterator.h @@ -125,7 +125,7 @@ private: { for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) { if (!(*renderSurfaceLayerList)[i]->renderSurface()) { - NOTREACHED(); + ASSERT_NOT_REACHED(); m_actions.end(*this); return; } diff --git a/cc/layer_quad.cc b/cc/layer_quad.cc index c7cc42c..08c16bb 100644 --- a/cc/layer_quad.cc +++ b/cc/layer_quad.cc @@ -7,13 +7,11 @@ #include "CCLayerQuad.h" -#include "base/logging.h" - namespace cc { CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) { - DCHECK(p != q); + ASSERT(p != q); FloatPoint tangent(p.y() - q.y(), q.x() - p.x()); float cross2 = p.x() * q.y() - q.x() * p.y(); diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc index f5aef04..cf85777 100644 --- a/cc/layer_sorter.cc +++ b/cc/layer_sorter.cc @@ -6,18 +6,25 @@ #include "CCLayerSorter.h" -#include <limits> - -#include "base/logging.h" #include "CCMathUtil.h" #include "CCRenderSurface.h" +#include <limits.h> #include <public/WebTransformationMatrix.h> #include <wtf/Deque.h> using namespace std; using WebKit::WebTransformationMatrix; -#define SHOW_DEBUG_LOG 0 && !defined(NDEBUG) +#define LOG_CHANNEL_PREFIX Log +#define SHOW_DEBUG_LOG 0 + +#if !defined( NDEBUG ) +#if SHOW_DEBUG_LOG +static WTFLogChannel LogCCLayerSorter = { 0x00000000, "", WTFLogChannelOn }; +#else +static WTFLogChannel LogCCLayerSorter = { 0x00000000, "", WTFLogChannelOff }; +#endif +#endif namespace cc { @@ -216,8 +223,8 @@ float CCLayerSorter::LayerShape::layerZFromProjectedPoint(const FloatPoint& p) c void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::iterator last) { -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Creating graph nodes:\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Creating graph nodes:\n"); #endif float minZ = FLT_MAX; float maxZ = -FLT_MAX; @@ -228,8 +235,8 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera if (!node.layer->drawsContent() && !renderSurface) continue; -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Layer " << node.layer->id() << " (" << node.layer->bounds().width() << " x " << node.layer->bounds().height() << ")\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Layer %d (%d x %d)\n", node.layer->id(), node.layer->bounds().width(), node.layer->bounds().height()); #endif WebTransformationMatrix drawTransform; @@ -255,8 +262,8 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera void CCLayerSorter::createGraphEdges() { -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Edges:\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Edges:\n"); #endif // Fraction of the total zRange below which z differences // are not considered reliable. @@ -284,8 +291,8 @@ void CCLayerSorter::createGraphEdges() } if (startNode) { -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: " << startNode->layer->id() << " -> " << endNode->layer->id() << "\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "%d -> %d\n", startNode->layer->id(), endNode->layer->id()); #endif m_edges.append(GraphEdge(startNode, endNode, weight)); } @@ -306,9 +313,9 @@ void CCLayerSorter::createGraphEdges() void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list) { size_t edgeIndex = list.find(edge); - DCHECK(edgeIndex != notFound); + ASSERT(edgeIndex != notFound); if (list.size() == 1) { - DCHECK(!edgeIndex); + ASSERT(!edgeIndex); list.clear(); return; } @@ -339,8 +346,8 @@ void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list // void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) { -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Sorting start ----\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Sorting start ----\n"); #endif createGraphNodes(first, last); @@ -355,8 +362,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) noIncomingEdgeNodeList.append(la); } -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Sorted list: "; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Sorted list: "); #endif while (m_activeEdges.size() || noIncomingEdgeNodeList.size()) { while (noIncomingEdgeNodeList.size()) { @@ -370,8 +377,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) // Add it to the final list. sortedList.append(fromNode); -#if SHOW_DEBUG_LOG - DLOG(INFO) << fromNode->layer->id() << ", "; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "%d, ", fromNode->layer->id()); #endif // Remove all its outgoing edges from the graph. @@ -404,7 +411,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) nextNode = &m_nodes[i]; } } - DCHECK(nextNode); + ASSERT(nextNode); // Remove all its incoming edges. for (unsigned e = 0; e < nextNode->incoming.size(); e++) { GraphEdge* incomingEdge = nextNode->incoming[e]; @@ -415,8 +422,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) nextNode->incoming.clear(); nextNode->incomingEdgeWeight = 0; noIncomingEdgeNodeList.append(nextNode); -#if SHOW_DEBUG_LOG - DLOG(INFO) << "Breaking cycle by cleaning up incoming edges from " << nextNode->layer->id() << " (weight = " << minIncomingEdgeWeight<< ")\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Breaking cycle by cleaning up incoming edges from %d (weight = %f)\n", nextNode->layer->id(), minIncomingEdgeWeight); #endif } @@ -426,8 +433,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last) for (LayerList::iterator it = first; it < last; it++) *it = sortedList[count++]->layer; -#if SHOW_DEBUG_LOG - DLOG(INFO) << "CCLayerSorter: Sorting end ----\n"; +#if !defined( NDEBUG ) + LOG(CCLayerSorter, "Sorting end ----\n"); #endif m_nodes.clear(); diff --git a/cc/layer_texture_sub_image.cc b/cc/layer_texture_sub_image.cc index fd48528..da27507 100644 --- a/cc/layer_texture_sub_image.cc +++ b/cc/layer_texture_sub_image.cc @@ -93,7 +93,7 @@ void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const componentsPerPixel = 1; break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); } unsigned int bytesPerComponent = 1; diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc index 63750b1..2e6eaab 100644 --- a/cc/layer_tiling_data.cc +++ b/cc/layer_tiling_data.cc @@ -7,8 +7,6 @@ #include "CCLayerTilingData.h" -#include "base/logging.h" - using namespace std; namespace cc { @@ -62,7 +60,7 @@ const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& t void CCLayerTilingData::addTile(scoped_ptr<Tile> tile, int i, int j) { - DCHECK(!tileAt(i, j)); + ASSERT(!tileAt(i, j)); tile->moveTo(i, j); m_tiles.add(make_pair(i, j), tile.Pass()); } @@ -87,7 +85,7 @@ void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int // An empty rect doesn't result in an empty set of tiles, so don't pass an empty rect. // FIXME: Possibly we should fill a vector of tiles instead, // since the normal use of this function is to enumerate some tiles. - DCHECK(!contentRect.isEmpty()); + ASSERT(!contentRect.isEmpty()); left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x()); top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y()); diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index c19f258..8d4d63b 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -111,7 +111,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre , m_hasTransparentBackground(false) , m_partialTextureUpdateRequests(0) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); numLayerTreeInstances++; } @@ -132,9 +132,9 @@ CCLayerTreeHost::~CCLayerTreeHost() { if (m_rootLayer) m_rootLayer->setLayerTreeHost(0); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); - DCHECK(m_proxy.get()); + ASSERT(m_proxy.get()); m_proxy->stop(); m_proxy.reset(); numLayerTreeInstances--; @@ -177,7 +177,7 @@ void CCLayerTreeHost::initializeRenderer() CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() { TRACE_EVENT0("cc", "CCLayerTreeHost::recreateContext"); - DCHECK(m_contextLost); + ASSERT(m_contextLost); bool recreated = false; if (!m_numTimesRecreateShouldFail) @@ -211,14 +211,14 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext() void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); if (m_rendererInitialized) m_contentsTextureManager->clearAllMemory(resourceProvider); } void CCLayerTreeHost::acquireLayerTextures() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_proxy->acquireLayerTextures(); } @@ -239,7 +239,7 @@ void CCLayerTreeHost::layout() void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TRACE_EVENT0("cc", "CCLayerTreeHost::commitTo"); } @@ -250,7 +250,7 @@ void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) // after the commit, but on the main thread. void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); m_contentsTextureManager->updateBackingsInDrawingImplTree(); m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); @@ -322,7 +322,7 @@ scoped_ptr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayer void CCLayerTreeHost::didLoseContext() { TRACE_EVENT0("cc", "CCLayerTreeHost::didLoseContext"); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_contextLost = true; m_numFailedRecreateAttempts = 0; setNeedsCommit(); @@ -356,7 +356,7 @@ const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const void CCLayerTreeHost::setNeedsAnimate() { - DCHECK(CCProxy::hasImplThread()); + ASSERT(CCProxy::hasImplThread()); m_proxy->setNeedsAnimate(); } @@ -379,7 +379,7 @@ bool CCLayerTreeHost::commitRequested() const void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) { - DCHECK(CCThreadProxy::isMainThread()); + ASSERT(CCThreadProxy::isMainThread()); setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime); } @@ -455,7 +455,7 @@ CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const void CCLayerTreeHost::composite() { - DCHECK(!CCThreadProxy::implThread()); + ASSERT(!CCThreadProxy::implThread()); static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); } @@ -481,8 +481,8 @@ bool CCLayerTreeHost::initializeRendererIfNeeded() void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes) { - DCHECK(m_rendererInitialized); - DCHECK(memoryAllocationLimitBytes); + ASSERT(m_rendererInitialized); + ASSERT(memoryAllocationLimitBytes); if (!rootLayer()) return; @@ -673,10 +673,10 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList occlusionTracker.enterLayer(it); if (it.representsTargetRenderSurface()) { - DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating()); + ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating()); needMoreUpdates |= paintMasksForRenderSurface(*it, queue); } else if (it.representsItself()) { - DCHECK(!it->bounds().isEmpty()); + ASSERT(!it->bounds().isEmpty()); it->update(queue, &occlusionTracker, m_renderingStats); needMoreUpdates |= it->needMoreUpdates(); } @@ -720,7 +720,7 @@ void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) if (m_animating) return; - DCHECK(context); + ASSERT(context); RateLimiterMap::iterator it = m_rateLimiters.find(context); if (it != m_rateLimiters.end()) it->second->start(); diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc index bf5ec34..1044930 100644 --- a/cc/layer_tree_host_common.cc +++ b/cc/layer_tree_host_common.cc @@ -111,7 +111,7 @@ static inline bool layerClipsSubtree(LayerType* layer) template<typename LayerType> static IntRect calculateVisibleContentRect(LayerType* layer) { - DCHECK(layer->renderTarget()); + ASSERT(layer->renderTarget()); // Nothing is visible if the layer bounds are empty. if (!layer->drawsContent() || layer->contentBounds().isEmpty() || layer->drawableContentRect().isEmpty()) @@ -186,8 +186,8 @@ static bool layerShouldBeSkipped(LayerType* layer) LayerType* backfaceTestLayer = layer; if (layer->useParentBackfaceVisibility()) { - DCHECK(layer->parent()); - DCHECK(!layer->parent()->useParentBackfaceVisibility()); + ASSERT(layer->parent()); + ASSERT(!layer->parent()->useParentBackfaceVisibility()); backfaceTestLayer = layer->parent(); } @@ -353,7 +353,7 @@ void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceViewportSize)); rootLayer->renderSurface()->clearLayerLists(); - DCHECK(renderSurfaceLayerList.empty()); + ASSERT(renderSurfaceLayerList.empty()); renderSurfaceLayerList.push_back(rootLayer); } @@ -598,7 +598,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating); if (layer != rootLayer) { - DCHECK(layer->parent()); + ASSERT(layer->parent()); layer->clearRenderSurface(); // Layers without renderSurfaces directly inherit the ancestor's clip status. @@ -610,9 +610,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay layer->setRenderTarget(layer->parent()->renderTarget()); } else { // FIXME: This root layer special case code should eventually go away. https://bugs.webkit.org/show_bug.cgi?id=92290 - DCHECK(!layer->parent()); - DCHECK(layer->renderSurface()); - DCHECK(ancestorClipsSubtree); + ASSERT(!layer->parent()); + ASSERT(layer->renderSurface()); + ASSERT(ancestorClipsSubtree); layer->renderSurface()->setClipRect(clipRectFromAncestor); subtreeShouldBeClipped = false; } @@ -736,7 +736,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay renderSurfaceLayerList.back()->clearRenderSurface(); renderSurfaceLayerList.pop_back(); } - DCHECK(renderSurfaceLayerList.back() == layer); + ASSERT(renderSurfaceLayerList.back() == layer); renderSurfaceLayerList.pop_back(); layer->clearRenderSurface(); return; diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc index cc7ae1c..7db514f 100644 --- a/cc/layer_tree_host_common_unittest.cc +++ b/cc/layer_tree_host_common_unittest.cc @@ -58,7 +58,7 @@ void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer, float IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); // We are probably not testing what is intended if the rootLayer bounds are empty. - DCHECK(!rootLayer->bounds().isEmpty()); + ASSERT(!rootLayer->bounds().isEmpty()); CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList); } @@ -72,7 +72,7 @@ void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer, float d IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); // We are probably not testing what is intended if the rootLayer bounds are empty. - DCHECK(!rootLayer->bounds().isEmpty()); + ASSERT(!rootLayer->bounds().isEmpty()); CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); } diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index 8f36fb1..6b984a7 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -83,7 +83,7 @@ void CCPinchZoomViewport::setPageScaleDelta(float delta) bool CCPinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) { - DCHECK(pageScaleFactor); + ASSERT(pageScaleFactor); if (m_sentPageScaleDelta == 1 && pageScaleFactor == m_pageScaleFactor && minPageScaleFactor == m_minPageScaleFactor && maxPageScaleFactor == m_maxPageScaleFactor) return false; @@ -233,13 +233,13 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC , m_numImplThreadScrolls(0) , m_numMainThreadScrolls(0) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); didVisibilityChange(this, m_visible); } CCLayerTreeHostImpl::~CCLayerTreeHostImpl() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TRACE_EVENT0("cc", "CCLayerTreeHostImpl::~CCLayerTreeHostImpl()"); if (m_rootLayerImpl) @@ -334,7 +334,7 @@ void CCLayerTreeHostImpl::trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - DCHECK(renderSurface); + ASSERT(renderSurface); renderSurface->damageTracker()->updateDamageTrackingState(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurface->surfacePropertyChangedOnlyFromDescendant(), renderSurface->contentRect(), renderSurfaceLayer->maskLayer(), renderSurfaceLayer->filters()); } } @@ -348,9 +348,9 @@ void CCLayerTreeHostImpl::updateRootScrollLayerImplTransform() void CCLayerTreeHostImpl::calculateRenderSurfaceLayerList(CCLayerList& renderSurfaceLayerList) { - DCHECK(renderSurfaceLayerList.empty()); - DCHECK(m_rootLayerImpl); - DCHECK(m_renderer); // For maxTextureSize. + ASSERT(renderSurfaceLayerList.empty()); + ASSERT(m_rootLayerImpl); + ASSERT(m_renderer); // For maxTextureSize. { updateRootScrollLayerImplTransform(); @@ -371,7 +371,7 @@ void CCLayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<CCRenderPass> r bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) { - DCHECK(frame.renderPasses.empty()); + ASSERT(frame.renderPasses.empty()); calculateRenderSurfaceLayerList(*frame.renderSurfaceLayerList); @@ -447,11 +447,11 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) occlusionTracker.leaveLayer(it); } -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED for (size_t i = 0; i < frame.renderPasses.size(); ++i) { - for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) - DCHECK(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0); - DCHECK(frame.renderPassesById.contains(frame.renderPasses[i]->id())); + for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) + ASSERT(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0); + ASSERT(frame.renderPassesById.contains(frame.renderPasses[i]->id())); } #endif @@ -519,7 +519,7 @@ IntSize CCLayerTreeHostImpl::contentSize() const static inline CCRenderPass* findRenderPassById(CCRenderPass::Id renderPassId, const CCLayerTreeHostImpl::FrameData& frame) { CCRenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId); - DCHECK(it != frame.renderPassesById.end()); + ASSERT(it != frame.renderPassesById.end()); return it->second; } @@ -611,7 +611,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& int positionFromEnd = frame.renderPasses.size() - it; removeRenderPassesRecursive(renderPassQuad->renderPassId(), frame); it = frame.renderPasses.size() - positionFromEnd; - DCHECK(it >= 0); + ASSERT(it >= 0); } } } @@ -619,7 +619,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::prepareToDraw"); - DCHECK(canDraw()); + ASSERT(canDraw()); frame.renderSurfaceLayerList = &m_renderSurfaceLayerList; frame.renderPasses.clear(); @@ -650,7 +650,7 @@ void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes) return; m_memoryAllocationLimitBytes = bytes; - DCHECK(bytes > 0); + ASSERT(bytes); m_client->setNeedsCommitOnImplThread(); } @@ -662,8 +662,8 @@ void CCLayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, dou void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::drawLayers"); - DCHECK(canDraw()); - DCHECK(!frame.renderPasses.empty()); + ASSERT(canDraw()); + ASSERT(!frame.renderPasses.empty()); // FIXME: use the frame begin time from the overall compositor scheduler. // This value is currently inaccessible because it is up in Chromium's @@ -719,7 +719,7 @@ const RendererCapabilities& CCLayerTreeHostImpl::rendererCapabilities() const bool CCLayerTreeHostImpl::swapBuffers() { - DCHECK(m_renderer); + ASSERT(m_renderer); m_fpsCounter->markEndOfFrame(); return m_renderer->swapBuffers(); @@ -747,7 +747,7 @@ void CCLayerTreeHostImpl::onSwapBuffersComplete() void CCLayerTreeHostImpl::readback(void* pixels, const IntRect& rect) { - DCHECK(m_renderer); + ASSERT(m_renderer); m_renderer->getFramebufferPixels(pixels, rect); } @@ -811,7 +811,7 @@ scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() void CCLayerTreeHostImpl::setVisible(bool visible) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); if (m_visible == visible) return; @@ -1016,7 +1016,7 @@ CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoi { TRACE_EVENT0("cc", "CCLayerTreeHostImpl::scrollBegin"); - DCHECK(!m_currentlyScrollingLayerImpl); + ASSERT(!m_currentlyScrollingLayerImpl); clearCurrentlyScrollingLayer(); if (!ensureRenderSurfaceLayerList()) @@ -1070,7 +1070,7 @@ static FloatSize scrollLayerWithScreenSpaceDelta(CCPinchZoomViewport* viewport, { // Layers with non-invertible screen space transforms should not have passed the scroll hit // test in the first place. - DCHECK(layerImpl.screenSpaceTransform().isInvertible()); + ASSERT(layerImpl.screenSpaceTransform().isInvertible()); WebTransformationMatrix inverseScreenSpaceTransform = layerImpl.screenSpaceTransform().inverse(); // First project the scroll start and end points to local layer space to find the scroll delta @@ -1081,8 +1081,8 @@ static FloatSize scrollLayerWithScreenSpaceDelta(CCPinchZoomViewport* viewport, FloatPoint localEndPoint = CCMathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped); // In general scroll point coordinates should not get clipped. - DCHECK(!startClipped); - DCHECK(!endClipped); + ASSERT(!startClipped); + ASSERT(!endClipped); if (startClipped || endClipped) return FloatSize(); @@ -1096,7 +1096,7 @@ static FloatSize scrollLayerWithScreenSpaceDelta(CCPinchZoomViewport* viewport, // Calculate the applied scroll delta in screen space coordinates. FloatPoint actualLocalEndPoint = localStartPoint + layerImpl.scrollDelta() - previousDelta; FloatPoint actualScreenSpaceEndPoint = CCMathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalEndPoint, endClipped); - DCHECK(!endClipped); + ASSERT(!endClipped); if (endClipped) return FloatSize(); return actualScreenSpaceEndPoint - screenSpacePoint; @@ -1384,7 +1384,7 @@ base::TimeDelta CCLayerTreeHostImpl::lowFrequencyAnimationInterval() const void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current) { - DCHECK(current); + ASSERT(current); current->didLoseContext(); if (current->maskLayer()) sendDidLoseContextRecursive(current->maskLayer()); @@ -1396,7 +1396,7 @@ void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current) static void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* current) { - DCHECK(current); + ASSERT(current); for (size_t i = 0; i < current->children().size(); ++i) clearRenderSurfacesOnCCLayerImplRecursive(current->children()[i]); current->clearRenderSurface(); diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index f1f2747..9220e64 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -475,7 +475,7 @@ TEST_P(CCLayerTreeHostImplTest, implPinchZoom) initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); - DCHECK(scrollLayer); + ASSERT(scrollLayer); const float minPageScale = 1, maxPageScale = 4; const WebTransformationMatrix identityScaleTransform; @@ -528,7 +528,7 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture) initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); - DCHECK(scrollLayer); + ASSERT(scrollLayer); const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5; const float maxPageScale = 4; @@ -615,7 +615,7 @@ TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); - DCHECK(scrollLayer); + ASSERT(scrollLayer); const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5; const float maxPageScale = 4; @@ -667,7 +667,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); - DCHECK(scrollLayer); + ASSERT(scrollLayer); const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5; const float maxPageScale = 4; @@ -736,7 +736,7 @@ TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa initializeRendererAndDrawFrame(); CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); - DCHECK(scrollLayer); + ASSERT(scrollLayer); const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5; const float maxPageScale = 4; @@ -2601,7 +2601,7 @@ public: void createResources(CCResourceProvider* provider) { - DCHECK(provider); + ASSERT(provider); int pool = 0; IntSize size(10, 10); GC3Denum format = GraphicsContext3D::RGBA; diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 430e644..dcce06c 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -1429,7 +1429,7 @@ public: context->resetUsedTextures(); break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } } @@ -1551,7 +1551,7 @@ public: context->resetUsedTextures(); break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } } @@ -1596,7 +1596,7 @@ public: m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20)); break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } } @@ -2506,7 +2506,7 @@ public: virtual ~EvictTexturesTask() { } virtual void run() OVERRIDE { - DCHECK(m_test->m_implForEvictTextures); + ASSERT(m_test->m_implForEvictTextures); m_test->m_implForEvictTextures->releaseContentsTextures(); } @@ -2516,7 +2516,7 @@ public: void postEvictTextures() { - DCHECK(webThread()); + ASSERT(webThread()); webThread()->postTask(new EvictTexturesTask(this)); } @@ -2566,7 +2566,7 @@ public: endTest(); break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } } @@ -2599,7 +2599,7 @@ public: postEvictTextures(); break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } } @@ -2663,7 +2663,7 @@ public: void evictTexturesOnImplThread() { - DCHECK(m_implForEvictTextures); + ASSERT(m_implForEvictTextures); m_implForEvictTextures->releaseContentsTextures(); } diff --git a/cc/math_util.cc b/cc/math_util.cc index 417e0c9..d90eb09 100644 --- a/cc/math_util.cc +++ b/cc/math_util.cc @@ -66,9 +66,9 @@ static HomogeneousCoordinate computeClippedPointForEdge(const HomogeneousCoordin // Once paramter t is known, the rest of p can be computed via p = (1-t) h1 + (t) h2. // Technically this is a special case of the following assertion, but its a good idea to keep it an explicit sanity check here. - DCHECK(h2.w != h1.w); + ASSERT(h2.w != h1.w); // Exactly one of h1 or h2 (but not both) must be on the negative side of the w plane when this is called. - DCHECK(h1.shouldBeClipped() ^ h2.shouldBeClipped()); + ASSERT(h1.shouldBeClipped() ^ h2.shouldBeClipped()); double w = 0.00001; // or any positive non-zero small epsilon @@ -165,7 +165,7 @@ void CCMathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const if (h4.shouldBeClipped() ^ h1.shouldBeClipped()) addVertexToClippedQuad(computeClippedPointForEdge(h4, h1).cartesianPoint2d(), clippedQuad, numVerticesInClippedQuad); - DCHECK(numVerticesInClippedQuad <= 8); + ASSERT(numVerticesInClippedQuad <= 8); } FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices) diff --git a/cc/math_util.h b/cc/math_util.h index f0a36ab..ed3848e 100644 --- a/cc/math_util.h +++ b/cc/math_util.h @@ -5,7 +5,6 @@ #ifndef CCMathUtil_h #define CCMathUtil_h -#include "base/logging.h" #include "FloatPoint.h" #include "FloatPoint3D.h" @@ -39,7 +38,7 @@ struct HomogeneousCoordinate { return FloatPoint(x, y); // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. - DCHECK(w); + ASSERT(w); double invW = 1.0 / w; return FloatPoint(x * invW, y * invW); } @@ -50,7 +49,7 @@ struct HomogeneousCoordinate { return FloatPoint3D(x, y, z); // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case. - DCHECK(w); + ASSERT(w); double invW = 1.0 / w; return FloatPoint3D(x * invW, y * invW, z * invW); } diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc index 7d5640d..39d7efe 100644 --- a/cc/occlusion_tracker.cc +++ b/cc/occlusion_tracker.cc @@ -245,7 +245,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(c template<typename LayerType> static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& clipRectInTarget, const IntSize& minimumTrackingSize, Vector<IntRect>* occludingScreenSpaceRects) { - DCHECK(layer->visibleContentRect().contains(opaqueContents.bounds())); + ASSERT(layer->visibleContentRect().contains(opaqueContents.bounds())); bool clipped; FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped); @@ -269,8 +269,8 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye template<typename LayerType, typename RenderSurfaceType> void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer(const LayerType* layer) { - DCHECK(!m_stack.isEmpty()); - DCHECK(layer->renderTarget() == m_stack.last().target); + ASSERT(!m_stack.isEmpty()); + ASSERT(layer->renderTarget() == m_stack.last().target); if (m_stack.isEmpty()) return; @@ -317,13 +317,13 @@ bool CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerT if (hasOcclusionFromOutsideTargetSurface) *hasOcclusionFromOutsideTargetSurface = false; - DCHECK(!m_stack.isEmpty()); + ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) return false; if (contentRect.isEmpty()) return true; - DCHECK(layer->renderTarget() == m_stack.last().target); + ASSERT(layer->renderTarget() == m_stack.last().target); if (layerTransformsToTargetKnown(layer) && testContentRectOccluded(contentRect, layer->drawTransform(), layerClipRectInTarget(layer), m_stack.last().occlusionInTarget)) return true; @@ -362,13 +362,13 @@ static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, c template<typename LayerType, typename RenderSurfaceType> IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { - DCHECK(!m_stack.isEmpty()); + ASSERT(!m_stack.isEmpty()); if (m_stack.isEmpty()) return contentRect; if (contentRect.isEmpty()) return contentRect; - DCHECK(layer->renderTarget() == m_stack.last().target); + ASSERT(layer->renderTarget() == m_stack.last().target); // We want to return a rect that contains all the visible parts of |contentRect| in both screen space and in the target surface. // So we find the visible parts of |contentRect| in each space, and take the intersection. @@ -390,15 +390,15 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR template<typename LayerType, typename RenderSurfaceType> IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const { - DCHECK(!m_stack.isEmpty()); + ASSERT(!m_stack.isEmpty()); // The layer is a contributing renderTarget so it should have a surface. - DCHECK(layer->renderSurface()); + ASSERT(layer->renderSurface()); // The layer is a contributing renderTarget so its target should be itself. - DCHECK(layer->renderTarget() == layer); + ASSERT(layer->renderTarget() == layer); // The layer should not be the root, else what is is contributing to? - DCHECK(layer->parent()); + ASSERT(layer->parent()); // This should be called while the layer is still considered the current target in the occlusion tracker. - DCHECK(layer == m_stack.last().target); + ASSERT(layer == m_stack.last().target); if (contentRect.isEmpty()) return contentRect; diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc index 355c9ea..76306b8 100644 --- a/cc/occlusion_tracker_unittest.cc +++ b/cc/occlusion_tracker_unittest.cc @@ -192,7 +192,7 @@ protected: typename Types::ContentLayerType* layerPtr = layer.get(); setProperties(layerPtr, transform, position, bounds); - DCHECK(!m_root); + ASSERT(!m_root); m_root = Types::passLayerPtr(layer); return layerPtr; } @@ -264,11 +264,11 @@ protected: void calcDrawEtc(TestContentLayerImpl* root) { - DCHECK(root == m_root.get()); + ASSERT(root == m_root.get()); int dummyMaxTextureSize = 512; CCLayerSorter layerSorter; - DCHECK(!root->renderSurface()); + ASSERT(!root->renderSurface()); CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); @@ -277,10 +277,10 @@ protected: void calcDrawEtc(TestContentLayerChromium* root) { - DCHECK(root == m_root.get()); + ASSERT(root == m_root.get()); int dummyMaxTextureSize = 512; - DCHECK(!root->renderSurface()); + ASSERT(!root->renderSurface()); CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium); diff --git a/cc/platform_color.h b/cc/platform_color.h index a3f3f35..2149d1c 100644 --- a/cc/platform_color.h +++ b/cc/platform_color.h @@ -31,7 +31,7 @@ public: textureFormat = Extensions3D::BGRA_EXT; break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } return textureFormat; @@ -47,7 +47,7 @@ public: case GraphicsContext3D::SourceFormatBGRA8: return textureFormat == Extensions3D::BGRA_EXT; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); return false; } } diff --git a/cc/prioritized_texture.cc b/cc/prioritized_texture.cc index 9bb6b96..f1a7cf4 100644 --- a/cc/prioritized_texture.cc +++ b/cc/prioritized_texture.cc @@ -26,7 +26,7 @@ CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, , m_manager(0) { // m_manager is set in registerTexture() so validity can be checked. - DCHECK(format || size.isEmpty()); + ASSERT(format || size.isEmpty()); if (format) m_bytes = CCTexture::memorySizeBytes(size, format); if (manager) @@ -56,7 +56,7 @@ void CCPrioritizedTexture::setDimensions(IntSize size, GC3Denum format) m_format = format; m_size = size; m_bytes = CCTexture::memorySizeBytes(size, format); - DCHECK(m_manager || !m_backing); + ASSERT(m_manager || !m_backing); if (m_manager) m_manager->returnBackingTexture(this); } @@ -76,7 +76,7 @@ bool CCPrioritizedTexture::backingResourceWasEvicted() const void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider) { - DCHECK(m_isAbovePriorityCutoff); + ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); } @@ -92,18 +92,18 @@ void CCPrioritizedTexture::upload(CCResourceProvider* resourceProvider, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset) { - DCHECK(m_isAbovePriorityCutoff); + ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) acquireBackingTexture(resourceProvider); - DCHECK(m_backing); + ASSERT(m_backing); resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destOffset); } void CCPrioritizedTexture::link(Backing* backing) { - DCHECK(backing); - DCHECK(!backing->m_owner); - DCHECK(!m_backing); + ASSERT(backing); + ASSERT(!backing->m_owner); + ASSERT(!m_backing); m_backing = backing; m_backing->m_owner = this; @@ -111,8 +111,8 @@ void CCPrioritizedTexture::link(Backing* backing) void CCPrioritizedTexture::unlink() { - DCHECK(m_backing); - DCHECK(m_backing->m_owner == this); + ASSERT(m_backing); + ASSERT(m_backing->m_owner == this); m_backing->m_owner = 0; m_backing = 0; @@ -132,7 +132,7 @@ CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) , m_inDrawingImplTree(false) , m_resourceHasBeenDeleted(false) -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG , m_resourceProvider(resourceProvider) #endif { @@ -140,15 +140,17 @@ CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource CCPrioritizedTexture::Backing::~Backing() { - DCHECK(!m_owner); - DCHECK(m_resourceHasBeenDeleted); + ASSERT(!m_owner); + ASSERT(m_resourceHasBeenDeleted); } void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - DCHECK(!m_resourceHasBeenDeleted); - DCHECK(resourceProvider == m_resourceProvider); + ASSERT(CCProxy::isImplThread()); + ASSERT(!m_resourceHasBeenDeleted); +#ifndef NDEBUG + ASSERT(resourceProvider == m_resourceProvider); +#endif resourceProvider->deleteResource(id()); setId(0); @@ -157,19 +159,19 @@ void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceP bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); return m_resourceHasBeenDeleted; } bool CCPrioritizedTexture::Backing::canBeRecycled() const { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree; } void CCPrioritizedTexture::Backing::updatePriority() { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); if (m_owner) { m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityCutoff(); @@ -181,10 +183,10 @@ void CCPrioritizedTexture::Backing::updatePriority() void CCPrioritizedTexture::Backing::updateInDrawingImplTree() { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); m_inDrawingImplTree = !!owner(); if (!m_inDrawingImplTree) - DCHECK(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPriority()); + ASSERT(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPriority()); } } // namespace cc diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h index 24278db..242147c 100644 --- a/cc/prioritized_texture.h +++ b/cc/prioritized_texture.h @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "cc/dcheck.h" #include "CCPriorityCalculator.h" #include "CCResourceProvider.h" #include "CCTexture.h" @@ -112,7 +111,7 @@ private: bool m_inDrawingImplTree; bool m_resourceHasBeenDeleted; -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG CCResourceProvider* m_resourceProvider; #endif diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_texture_manager.cc index 55da5b3..06d6c8e 100644 --- a/cc/prioritized_texture_manager.cc +++ b/cc/prioritized_texture_manager.cc @@ -32,16 +32,16 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() unregisterTexture(*m_textures.begin()); deleteUnlinkedEvictedBackings(); - DCHECK(m_evictedBackings.isEmpty()); + ASSERT(m_evictedBackings.isEmpty()); // Each remaining backing is a leaked opengl texture. There should be none. - DCHECK(m_backings.isEmpty()); + ASSERT(m_backings.isEmpty()); } void CCPrioritizedTextureManager::prioritizeTextures() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures"); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); // Sorting textures in this function could be replaced by a slightly // modified O(n) quick-select to partition textures rather than @@ -94,14 +94,14 @@ void CCPrioritizedTextureManager::prioritizeTextures() } sortedTextures.clear(); - DCHECK(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes); - DCHECK(memoryAboveCutoffBytes() <= maxMemoryLimitBytes()); + ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes); + ASSERT(memoryAboveCutoffBytes() <= maxMemoryLimitBytes()); } void CCPrioritizedTextureManager::pushTexturePrioritiesToBackings() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::pushTexturePrioritiesToBackings"); - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) (*it)->updatePriority(); @@ -112,7 +112,7 @@ void CCPrioritizedTextureManager::pushTexturePrioritiesToBackings() void CCPrioritizedTextureManager::updateBackingsInDrawingImplTree() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::updateBackingsInDrawingImplTree"); - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { CCPrioritizedTexture::Backing* backing = (*it); @@ -125,7 +125,7 @@ void CCPrioritizedTextureManager::updateBackingsInDrawingImplTree() void CCPrioritizedTextureManager::sortBackings() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::updateBackingsPriorities"); - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); // Update backings' priorities and put backings in eviction/recycling order. BackingVector& sortedBackings = m_tempBackingVector; @@ -140,14 +140,14 @@ void CCPrioritizedTextureManager::sortBackings() } sortedBackings.clear(); -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED assertInvariants(); #endif } void CCPrioritizedTextureManager::clearPriorities() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { // FIXME: We should remove this and just set all priorities to // CCPriorityCalculator::lowestPriority() once we have priorities @@ -159,7 +159,7 @@ void CCPrioritizedTextureManager::clearPriorities() bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); // This is already above cutoff, so don't double count it's memory below. if (texture->isAbovePriorityCutoff()) @@ -179,9 +179,9 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); - DCHECK(!texture->isSelfManaged()); - DCHECK(texture->isAbovePriorityCutoff()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(!texture->isSelfManaged()); + ASSERT(texture->isAbovePriorityCutoff()); if (texture->backing() || !texture->isAbovePriorityCutoff()) return; @@ -217,7 +217,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex void CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy evictionPolicy, CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); if (memoryUseBytes() <= limitBytes) return; @@ -234,10 +234,10 @@ void CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); evictBackingsToReduceMemory(m_memoryAvailableBytes, RespectManagerPriorityCutoff, resourceProvider); - DCHECK(memoryUseBytes() <= maxMemoryLimitBytes()); + ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); // We currently collect backings from deleted textures for later recycling. // However, if we do that forever we will always use the max limit even if @@ -266,28 +266,28 @@ void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvi void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); - DCHECK(resourceProvider); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(resourceProvider); evictBackingsToReduceMemory(0, DoNotRespectManagerPriorityCutoff, resourceProvider); } void CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - DCHECK(resourceProvider); + ASSERT(CCProxy::isImplThread()); + ASSERT(resourceProvider); evictBackingsToReduceMemory(limitBytes, DoNotRespectManagerPriorityCutoff, resourceProvider); } void CCPrioritizedTextureManager::getEvictedBackings(BackingVector& evictedBackings) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); evictedBackings.clear(); evictedBackings.append(m_evictedBackings); } void CCPrioritizedTextureManager::unlinkEvictedBackings(const BackingVector& evictedBackings) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); for (BackingVector::const_iterator it = evictedBackings.begin(); it != evictedBackings.end(); ++it) { CCPrioritizedTexture::Backing* backing = (*it); if (backing->owner()) @@ -297,7 +297,7 @@ void CCPrioritizedTextureManager::unlinkEvictedBackings(const BackingVector& evi void CCPrioritizedTextureManager::deleteUnlinkedEvictedBackings() { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); BackingVector newEvictedBackings; for (BackingVector::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) { CCPrioritizedTexture::Backing* backing = (*it); @@ -320,11 +320,11 @@ bool CCPrioritizedTextureManager::linkedEvictedBackingsExist() const void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread()); - DCHECK(texture); - DCHECK(!texture->textureManager()); - DCHECK(!texture->backing()); - DCHECK(!ContainsKey(m_textures, texture)); + ASSERT(CCProxy::isMainThread()); + ASSERT(texture); + ASSERT(!texture->textureManager()); + ASSERT(!texture->backing()); + ASSERT(!ContainsKey(m_textures, texture)); texture->setManagerInternal(this); m_textures.insert(texture); @@ -333,9 +333,9 @@ void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); - DCHECK(texture); - DCHECK(ContainsKey(m_textures, texture)); + ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + ASSERT(texture); + ASSERT(ContainsKey(m_textures, texture)); returnBackingTexture(texture); texture->setManagerInternal(0); @@ -345,15 +345,15 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture) { - DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); + ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); if (texture->backing()) texture->unlink(); } CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); - DCHECK(resourceProvider); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(resourceProvider); CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny); CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, resourceProvider, size, format); m_memoryUseBytes += backing->bytes(); @@ -364,10 +364,10 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz void CCPrioritizedTextureManager::evictBackingResource(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - DCHECK(backing); - DCHECK(resourceProvider); - DCHECK(m_backings.find(backing) != m_backings.end()); + ASSERT(CCProxy::isImplThread()); + ASSERT(backing); + ASSERT(resourceProvider); + ASSERT(m_backings.find(backing) != m_backings.end()); // Note that we create a backing and its resource at the same time, but we // delete the backing structure and its resource in two steps. This is because @@ -379,10 +379,10 @@ void CCPrioritizedTextureManager::evictBackingResource(CCPrioritizedTexture::Bac m_evictedBackings.append(backing); } -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED void CCPrioritizedTextureManager::assertInvariants() { - DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); // If we hit any of these asserts, there is a bug in this class. To see // where the bug is, call this function at the beginning and end of @@ -391,8 +391,8 @@ void CCPrioritizedTextureManager::assertInvariants() // Backings/textures must be doubly-linked and only to other backings/textures in this manager. for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { if ((*it)->owner()) { - DCHECK(ContainsKey(m_textures, (*it)->owner())); - DCHECK((*it)->owner()->backing() == (*it)); + ASSERT(ContainsKey(m_textures, (*it)->owner())); + ASSERT((*it)->owner()->backing() == (*it)); } } for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { @@ -400,13 +400,13 @@ void CCPrioritizedTextureManager::assertInvariants() CCPrioritizedTexture::Backing* backing = texture->backing(); if (backing) { if (backing->resourceHasBeenDeleted()) { - DCHECK(m_backings.find(backing) == m_backings.end()); - DCHECK(m_evictedBackings.contains(backing)); + ASSERT(m_backings.find(backing) == m_backings.end()); + ASSERT(m_evictedBackings.contains(backing)); } else { - DCHECK(m_backings.find(backing) != m_backings.end()); - DCHECK(!m_evictedBackings.contains(backing)); + ASSERT(m_backings.find(backing) != m_backings.end()); + ASSERT(!m_evictedBackings.contains(backing)); } - DCHECK(backing->owner() == texture); + ASSERT(backing->owner() == texture); } } @@ -418,9 +418,9 @@ void CCPrioritizedTextureManager::assertInvariants() if (!(*it)->canBeRecycled()) reachedUnrecyclable = true; if (reachedUnrecyclable) - DCHECK(!(*it)->canBeRecycled()); + ASSERT(!(*it)->canBeRecycled()); else - DCHECK((*it)->canBeRecycled()); + ASSERT((*it)->canBeRecycled()); } } #endif diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h index 2daf783..e8998b0 100644 --- a/cc/prioritized_texture_manager.h +++ b/cc/prioritized_texture_manager.h @@ -140,7 +140,7 @@ private: void deleteUnlinkedEvictedBackings(); void sortBackings(); -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED void assertInvariants(); #endif diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 09312ec..25b677f 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -80,7 +80,7 @@ public: void textureManagerAssertInvariants(CCPrioritizedTextureManager* textureManager) { -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->assertInvariants(); #endif diff --git a/cc/program_binding.cc b/cc/program_binding.cc index 4cae7a0..094020b 100644 --- a/cc/program_binding.cc +++ b/cc/program_binding.cc @@ -27,10 +27,10 @@ ProgramBindingBase::ProgramBindingBase() ProgramBindingBase::~ProgramBindingBase() { // If you hit these asserts, you initialized but forgot to call cleanup(). - DCHECK(!m_program); - DCHECK(!m_vertexShaderId); - DCHECK(!m_fragmentShaderId); - DCHECK(!m_initialized); + ASSERT(!m_program); + ASSERT(!m_vertexShaderId); + ASSERT(!m_fragmentShaderId); + ASSERT(!m_initialized); } static bool contextLost(WebGraphicsContext3D* context) @@ -45,7 +45,7 @@ void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string& m_vertexShaderId = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShader); if (!m_vertexShaderId) { if (!contextLost(context)) - LOG(ERROR) << "Failed to create vertex shader"; + LOG_ERROR("Failed to create vertex shader"); return; } @@ -54,25 +54,26 @@ void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string& GLC(context, context->deleteShader(m_vertexShaderId)); m_vertexShaderId = 0; if (!contextLost(context)) - LOG(ERROR) << "Failed to create fragment shader"; + LOG_ERROR("Failed to create fragment shader"); return; } m_program = createShaderProgram(context, m_vertexShaderId, m_fragmentShaderId); - DCHECK(m_program || contextLost(context)); + ASSERT(m_program || contextLost(context)); } void ProgramBindingBase::link(WebGraphicsContext3D* context) { GLC(context, context->linkProgram(m_program)); cleanupShaders(context); -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG int linked = 0; GLC(context, context->getProgramiv(m_program, GraphicsContext3D::LINK_STATUS, &linked)); if (!linked) { if (!contextLost(context)) - LOG(ERROR) << "Failed to link shader program"; + LOG_ERROR("Failed to link shader program"); GLC(context, context->deleteProgram(m_program)); + return; } #endif } @@ -83,7 +84,7 @@ void ProgramBindingBase::cleanup(WebGraphicsContext3D* context) if (!m_program) return; - DCHECK(context); + ASSERT(context); GLC(context, context->deleteProgram(m_program)); m_program = 0; @@ -97,7 +98,7 @@ unsigned ProgramBindingBase::loadShader(WebGraphicsContext3D* context, unsigned return 0; GLC(context, context->shaderSource(shader, shaderSource.data())); GLC(context, context->compileShader(shader)); -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG int compiled = 0; GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled)); if (!compiled) { @@ -113,7 +114,7 @@ unsigned ProgramBindingBase::createShaderProgram(WebGraphicsContext3D* context, unsigned programObject = context->createProgram(); if (!programObject) { if (!contextLost(context)) - LOG(ERROR) << "Failed to create shader program"; + LOG_ERROR("Failed to create shader program"); return 0; } diff --git a/cc/program_binding.h b/cc/program_binding.h index 3ddc0b4..28f628c 100644 --- a/cc/program_binding.h +++ b/cc/program_binding.h @@ -7,8 +7,6 @@ #include <string> -#include "base/logging.h" - namespace WebKit { class WebGraphicsContext3D; } @@ -24,7 +22,7 @@ public: void link(WebKit::WebGraphicsContext3D*); void cleanup(WebKit::WebGraphicsContext3D*); - unsigned program() const { DCHECK(m_initialized); return m_program; } + unsigned program() const { ASSERT(m_initialized); return m_program; } bool initialized() const { return m_initialized; } protected: @@ -49,9 +47,9 @@ public: void initialize(WebKit::WebGraphicsContext3D* context, bool usingBindUniform) { - DCHECK(context); - DCHECK(m_program); - DCHECK(!m_initialized); + ASSERT(context); + ASSERT(m_program); + ASSERT(!m_initialized); // Need to bind uniforms before linking if (!usingBindUniform) diff --git a/cc/proxy.cc b/cc/proxy.cc index 10b4ed0..bc5ae69 100644 --- a/cc/proxy.cc +++ b/cc/proxy.cc @@ -13,7 +13,7 @@ using namespace WTF; namespace cc { namespace { -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG bool implThreadIsOverridden = false; bool s_isMainThreadBlocked = false; base::PlatformThreadId threadIDOverridenToBeImplThread; @@ -57,10 +57,10 @@ CCThread* CCProxy::currentThread() return 0; } -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG bool CCProxy::isMainThread() { - DCHECK(s_mainThread); + ASSERT(s_mainThread); if (implThreadIsOverridden && base::PlatformThread::CurrentId() == threadIDOverridenToBeImplThread) return false; return base::PlatformThread::CurrentId() == s_mainThread->threadID(); @@ -94,12 +94,12 @@ void CCProxy::setMainThreadBlocked(bool isMainThreadBlocked) CCProxy::CCProxy() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); } CCProxy::~CCProxy() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); } } @@ -6,7 +6,6 @@ #define CCProxy_h #include "base/basictypes.h" -#include "cc/dcheck.h" #include <public/WebCompositorOutputSurface.h> namespace cc { @@ -82,7 +81,7 @@ public: virtual void acquireLayerTextures() = 0; // Debug hooks -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG static bool isMainThread(); static bool isImplThread(); static bool isMainThreadBlocked(); @@ -92,7 +91,7 @@ public: // Testing hooks virtual void loseContext() = 0; -#if CC_DCHECK_ENABLED() +#ifndef NDEBUG static void setCurrentThreadIsImplThread(bool); #endif @@ -109,15 +108,15 @@ class DebugScopedSetMainThreadBlocked { public: DebugScopedSetMainThreadBlocked() { -#if CC_DCHECK_ENABLED() - DCHECK(!CCProxy::isMainThreadBlocked()); +#if !ASSERT_DISABLED + ASSERT(!CCProxy::isMainThreadBlocked()); CCProxy::setMainThreadBlocked(true); #endif } ~DebugScopedSetMainThreadBlocked() { -#if CC_DCHECK_ENABLED() - DCHECK(CCProxy::isMainThreadBlocked()); +#if !ASSERT_DISABLED + ASSERT(CCProxy::isMainThreadBlocked()); CCProxy::setMainThreadBlocked(false); #endif } diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc index 6733b31..3a7c96c 100644 --- a/cc/quad_culler.cc +++ b/cc/quad_culler.cc @@ -70,10 +70,10 @@ static inline bool appendQuadInternal(scoped_ptr<CCDrawQuad> drawQuad, const Int bool CCQuadCuller::append(scoped_ptr<CCDrawQuad> drawQuad, CCAppendQuadsData& appendQuadsData) { - DCHECK(drawQuad->sharedQuadState() == m_currentSharedQuadState); - DCHECK(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); - DCHECK(!m_sharedQuadStateList.isEmpty()); - DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState); + ASSERT(drawQuad->sharedQuadState() == m_currentSharedQuadState); + ASSERT(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id); + ASSERT(!m_sharedQuadStateList.isEmpty()); + ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState); IntRect culledRect; bool hasOcclusionFromOutsideTargetSurface; diff --git a/cc/rate_limiter.cc b/cc/rate_limiter.cc index d772e3e..b26959e 100644 --- a/cc/rate_limiter.cc +++ b/cc/rate_limiter.cc @@ -47,7 +47,7 @@ RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, RateLimiterClien , m_active(false) , m_client(client) { - DCHECK(context); + ASSERT(context); } RateLimiter::~RateLimiter() diff --git a/cc/render_pass.cc b/cc/render_pass.cc index d628c0d..513bd8b 100644 --- a/cc/render_pass.cc +++ b/cc/render_pass.cc @@ -29,8 +29,8 @@ CCRenderPass::CCRenderPass(Id id, IntRect outputRect, const WebKit::WebTransform , m_hasTransparentBackground(true) , m_hasOcclusionFromOutsideTargetSurface(false) { - DCHECK(id.layerId > 0); - DCHECK(id.index >= 0); + ASSERT(id.layerId > 0); + ASSERT(id.index >= 0); } CCRenderPass::~CCRenderPass() @@ -39,7 +39,7 @@ CCRenderPass::~CCRenderPass() scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const { - DCHECK(newId != m_id); + ASSERT(newId != m_id); scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToRootTarget)); copyPass->setDamageRect(m_damageRect); @@ -92,7 +92,7 @@ void CCRenderPass::appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor scree float opacity = 1; bool opaque = true; CCSharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(CCSharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque)); - DCHECK(rootLayer->screenSpaceTransform().isInvertible()); + ASSERT(rootLayer->screenSpaceTransform().isInvertible()); WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse(); Vector<WebCore::IntRect> fillRects = fillRegion.rects(); for (size_t i = 0; i < fillRects.size(); ++i) { diff --git a/cc/render_pass_draw_quad.cc b/cc/render_pass_draw_quad.cc index 8cec50f..9e385c6 100644 --- a/cc/render_pass_draw_quad.cc +++ b/cc/render_pass_draw_quad.cc @@ -24,20 +24,20 @@ CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadSt , m_maskTexCoordOffsetX(maskTexCoordOffsetX) , m_maskTexCoordOffsetY(maskTexCoordOffsetY) { - DCHECK(m_renderPassId.layerId > 0); - DCHECK(m_renderPassId.index >= 0); + ASSERT(m_renderPassId.layerId > 0); + ASSERT(m_renderPassId.index >= 0); } const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::RenderPass); + ASSERT(quad->material() == CCDrawQuad::RenderPass); return static_cast<const CCRenderPassDrawQuad*>(quad); } scoped_ptr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const { unsigned bytes = size(); - DCHECK(bytes > 0); + ASSERT(bytes); scoped_ptr<CCRenderPassDrawQuad> copyQuad(reinterpret_cast<CCRenderPassDrawQuad*>(new char[bytes])); memcpy(copyQuad.get(), this, bytes); diff --git a/cc/render_surface_filters.cc b/cc/render_surface_filters.cc index 5f683bf..7f1d3c6 100644 --- a/cc/render_surface_filters.cc +++ b/cc/render_surface_filters.cc @@ -6,7 +6,6 @@ #include "CCRenderSurfaceFilters.h" -#include "base/logging.h" #include "FloatSize.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/effects/SkBlurImageFilter.h" @@ -295,7 +294,7 @@ public: private: void createCanvas() { - DCHECK(m_scratchTextures[m_currentTexture].get()); + ASSERT(m_scratchTextures[m_currentTexture].get()); m_device.reset(new SkGpuDevice(m_grContext, m_scratchTextures[m_currentTexture].get())); m_canvas.reset(new SkCanvas(m_device.get())); m_canvas->clear(0x0); @@ -432,7 +431,7 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter case WebKit::WebFilterOperation::FilterTypeHueRotate: case WebKit::WebFilterOperation::FilterTypeInvert: case WebKit::WebFilterOperation::FilterTypeOpacity: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } state.swap(); diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc index 17eaffe..e5f0324 100644 --- a/cc/render_surface_impl.cc +++ b/cc/render_surface_impl.cc @@ -6,7 +6,6 @@ #include "CCRenderSurface.h" -#include "base/logging.h" #include "base/stringprintf.h" #include "CCDamageTracker.h" #include "CCDebugBorderDrawQuad.h" @@ -135,7 +134,7 @@ bool CCRenderSurface::surfacePropertyChanged() const // - all other property changes come from the owning layer (or some ancestor layer // that propagates its change to the owning layer). // - DCHECK(m_owningLayer); + ASSERT(m_owningLayer); return m_surfacePropertyChanged || m_owningLayer->layerPropertyChanged(); } @@ -146,7 +145,7 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const void CCRenderSurface::addContributingDelegatedRenderPassLayer(CCLayerImpl* layer) { - DCHECK(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end()); + ASSERT(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end()); CCDelegatedRendererLayerImpl* delegatedRendererLayer = static_cast<CCDelegatedRendererLayerImpl*>(layer); m_contributingDelegatedRenderPassLayerList.push_back(delegatedRendererLayer); } @@ -159,7 +158,7 @@ void CCRenderSurface::clearLayerLists() static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer) { - DCHECK(owningLayer->parent()); + ASSERT(owningLayer->parent()); const CCLayerImpl* renderTarget = owningLayer->parent()->renderTarget(); const CCRenderSurface* self = owningLayer->renderSurface(); @@ -181,7 +180,7 @@ CCRenderPass::Id CCRenderSurface::renderPassId() { int layerId = m_owningLayer->id(); int subId = 0; - DCHECK(layerId > 0); + ASSERT(layerId > 0); return CCRenderPass::Id(layerId, subId); } @@ -199,7 +198,7 @@ void CCRenderSurface::appendRenderPasses(CCRenderPassSink& passSink) void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData, bool forReplica, CCRenderPass::Id renderPassId) { - DCHECK(!forReplica || m_owningLayer->hasReplica()); + ASSERT(!forReplica || m_owningLayer->hasReplica()); IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); bool isOpaque = false; diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc index a9b396c..4b2326b 100644 --- a/cc/resource_provider.cc +++ b/cc/resource_provider.cc @@ -39,7 +39,7 @@ static GC3Denum textureToStorageFormat(GC3Denum textureFormat) storageFormat = Extensions3DChromium::BGRA8_EXT; break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); break; } @@ -131,13 +131,13 @@ CCResourceProvider::~CCResourceProvider() WebGraphicsContext3D* CCResourceProvider::graphicsContext3D() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); return m_context->context3D(); } bool CCResourceProvider::inUseByConsumer(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; @@ -150,7 +150,7 @@ CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, cons case GLTexture: return createGLTexture(pool, size, format, hint); case Bitmap: - DCHECK(format == GraphicsContext3D::RGBA); + ASSERT(format == GraphicsContext3D::RGBA); return createBitmap(pool, size); } @@ -160,10 +160,10 @@ CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, cons CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); unsigned textureId = 0; WebGraphicsContext3D* context3d = m_context->context3D(); - DCHECK(context3d); + ASSERT(context3d); GLC(context3d, textureId = context3d->createTexture()); GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); @@ -186,7 +186,7 @@ CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, con CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const IntSize& size) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); uint8_t* pixels = new uint8_t[size.width() * size.height() * 4]; @@ -198,8 +198,8 @@ CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTexture(unsigned textureId) { - DCHECK(CCProxy::isImplThread()); - DCHECK(m_context->context3D()); + ASSERT(CCProxy::isImplThread()); + ASSERT(m_context->context3D()); ResourceId id = m_nextId++; Resource resource(textureId, 0, IntSize(), 0); resource.external = true; @@ -209,13 +209,13 @@ CCResourceProvider::ResourceId CCResourceProvider::createResourceFromExternalTex void CCResourceProvider::deleteResource(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(!resource->lockedForWrite); - DCHECK(!resource->lockForReadCount); - DCHECK(!resource->markedForDeletion); + ASSERT(!resource->lockedForWrite); + ASSERT(!resource->lockForReadCount); + ASSERT(!resource->markedForDeletion); if (resource->exported) { resource->markedForDeletion = true; @@ -229,7 +229,7 @@ void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) Resource* resource = &it->second; if (resource->glId && !resource->external) { WebGraphicsContext3D* context3d = m_context->context3D(); - DCHECK(context3d); + ASSERT(context3d); GLC(context3d, context3d->deleteTexture(resource->glId)); } if (resource->pixels) @@ -240,7 +240,7 @@ void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) void CCResourceProvider::deleteOwnedResources(int pool) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceIdArray toDelete; for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { if (it->second.pool == pool && !it->second.external && !it->second.markedForDeletion) @@ -260,19 +260,19 @@ CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id) void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(!resource->lockedForWrite); - DCHECK(!resource->lockForReadCount); - DCHECK(!resource->external); - DCHECK(!resource->exported); + ASSERT(!resource->lockedForWrite); + ASSERT(!resource->lockForReadCount); + ASSERT(!resource->external); + ASSERT(!resource->exported); if (resource->glId) { WebGraphicsContext3D* context3d = m_context->context3D(); - DCHECK(context3d); - DCHECK(m_texSubImage.get()); + ASSERT(context3d); + ASSERT(m_texSubImage.get()); context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, resource->glId); m_texSubImage->upload(image, imageRect, sourceRect, destOffset, resource->format, context3d); } @@ -294,7 +294,7 @@ void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRe void CCResourceProvider::flush() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (context3d) context3d->flush(); @@ -302,7 +302,7 @@ void CCResourceProvider::flush() bool CCResourceProvider::shallowFlushIfSupported() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !m_useShallowFlush) return false; @@ -313,51 +313,51 @@ bool CCResourceProvider::shallowFlushIfSupported() const CCResourceProvider::Resource* CCResourceProvider::lockForRead(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(!resource->lockedForWrite); - DCHECK(!resource->exported); + ASSERT(!resource->lockedForWrite); + ASSERT(!resource->exported); resource->lockForReadCount++; return resource; } void CCResourceProvider::unlockForRead(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(resource->lockForReadCount > 0); - DCHECK(!resource->exported); + ASSERT(resource->lockForReadCount > 0); + ASSERT(!resource->exported); resource->lockForReadCount--; } const CCResourceProvider::Resource* CCResourceProvider::lockForWrite(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(!resource->lockedForWrite); - DCHECK(!resource->lockForReadCount); - DCHECK(!resource->exported); - DCHECK(!resource->external); + ASSERT(!resource->lockedForWrite); + ASSERT(!resource->lockForReadCount); + ASSERT(!resource->exported); + ASSERT(!resource->external); resource->lockedForWrite = true; return resource; } void CCResourceProvider::unlockForWrite(ResourceId id) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::iterator it = m_resources.find(id); CHECK(it != m_resources.end()); Resource* resource = &it->second; - DCHECK(resource->lockedForWrite); - DCHECK(!resource->exported); - DCHECK(!resource->external); + ASSERT(resource->lockedForWrite); + ASSERT(!resource->exported); + ASSERT(!resource->external); resource->lockedForWrite = false; } @@ -366,7 +366,7 @@ CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL(CCResourceProvider* resou , m_resourceId(resourceId) , m_textureId(resourceProvider->lockForRead(resourceId)->glId) { - DCHECK(m_textureId); + ASSERT(m_textureId); } CCResourceProvider::ScopedReadLockGL::~ScopedReadLockGL() @@ -379,7 +379,7 @@ CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(CCResourceProvider* res , m_resourceId(resourceId) , m_textureId(resourceProvider->lockForWrite(resourceId)->glId) { - DCHECK(m_textureId); + ASSERT(m_textureId); } CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() @@ -389,8 +389,8 @@ CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource) { - DCHECK(resource->pixels); - DCHECK(resource->format == GraphicsContext3D::RGBA); + ASSERT(resource->pixels); + ASSERT(resource->format == GraphicsContext3D::RGBA); skBitmap->setConfig(SkBitmap::kARGB_8888_Config, resource->size.width(), resource->size.height()); skBitmap->setPixels(resource->pixels); } @@ -434,7 +434,7 @@ CCResourceProvider::CCResourceProvider(CCGraphicsContext* context) bool CCResourceProvider::initialize() { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d) { m_maxTextureSize = INT_MAX / 2; @@ -472,7 +472,7 @@ bool CCResourceProvider::initialize() int CCResourceProvider::createChild(int pool) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); Child childInfo; childInfo.pool = pool; int child = m_nextChild++; @@ -482,9 +482,9 @@ int CCResourceProvider::createChild(int pool) void CCResourceProvider::destroyChild(int child) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ChildMap::iterator it = m_children.find(child); - DCHECK(it != m_children.end()); + ASSERT(it != m_children.end()); deleteOwnedResources(it->second.pool); m_children.erase(it); trimMailboxDeque(); @@ -492,15 +492,15 @@ void CCResourceProvider::destroyChild(int child) const CCResourceProvider::ResourceIdMap& CCResourceProvider::getChildToParentMap(int child) const { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ChildMap::const_iterator it = m_children.find(child); - DCHECK(it != m_children.end()); + ASSERT(it != m_children.end()); return it->second.childToParentMap; } CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToParent(const ResourceIdArray& resources) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TransferableResourceList list; list.syncPoint = 0; WebGraphicsContext3D* context3d = m_context->context3D(); @@ -522,7 +522,7 @@ CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToPa CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToChild(int child, const ResourceIdArray& resources) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); TransferableResourceList list; list.syncPoint = 0; WebGraphicsContext3D* context3d = m_context->context3D(); @@ -534,8 +534,8 @@ CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToCh for (ResourceIdArray::const_iterator it = resources.begin(); it != resources.end(); ++it) { TransferableResource resource; if (!transferResource(context3d, *it, &resource)) - NOTREACHED(); - DCHECK(childInfo.parentToChildMap.find(*it) != childInfo.parentToChildMap.end()); + ASSERT_NOT_REACHED(); + ASSERT(childInfo.parentToChildMap.find(*it) != childInfo.parentToChildMap.end()); resource.id = childInfo.parentToChildMap[*it]; childInfo.parentToChildMap.erase(*it); childInfo.childToParentMap.erase(resource.id); @@ -549,7 +549,7 @@ CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToCh void CCResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) { // FIXME: Implement this path for software compositing. @@ -581,7 +581,7 @@ void CCResourceProvider::receiveFromChild(int child, const TransferableResourceL void CCResourceProvider::receiveFromParent(const TransferableResourceList& resources) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); WebGraphicsContext3D* context3d = m_context->context3D(); if (!context3d || !context3d->makeContextCurrent()) { // FIXME: Implement this path for software compositing. @@ -591,9 +591,9 @@ void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou GLC(context3d, context3d->waitSyncPoint(resources.syncPoint)); for (Vector<TransferableResource>::const_iterator it = resources.resources.begin(); it != resources.resources.end(); ++it) { ResourceMap::iterator mapIterator = m_resources.find(it->id); - DCHECK(mapIterator != m_resources.end()); + ASSERT(mapIterator != m_resources.end()); Resource* resource = &mapIterator->second; - DCHECK(resource->exported); + ASSERT(resource->exported); resource->exported = false; GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, resource->glId)); GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, it->mailbox.name)); @@ -605,13 +605,13 @@ void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); ResourceMap::const_iterator it = m_resources.find(id); CHECK(it != m_resources.end()); const Resource* source = &it->second; - DCHECK(!source->lockedForWrite); - DCHECK(!source->lockForReadCount); - DCHECK(!source->external); + ASSERT(!source->lockedForWrite); + ASSERT(!source->lockForReadCount); + ASSERT(!source->external); if (source->exported) return false; resource->id = id; diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index ecc8985..9b22a0a 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -9,7 +9,6 @@ #include "CCGraphicsContext.h" #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread #include "Extensions3DChromium.h" -#include "base/logging.h" #include "cc/test/compositor_fake_web_graphics_context_3d.h" #include "cc/test/fake_web_compositor_output_surface.h" #include "testing/gtest/include/gtest/gtest.h" @@ -61,9 +60,9 @@ public: { unsigned mailbox = 0; memcpy(&mailbox, mailboxName, sizeof(mailbox)); - ASSERT_TRUE(mailbox && mailbox < m_nextMailBox); + ASSERT(mailbox && mailbox < m_nextMailBox); m_textures.set(mailbox, texture); - ASSERT_LT(m_syncPointForMailbox.get(mailbox), syncPoint); + ASSERT(m_syncPointForMailbox.get(mailbox) < syncPoint); m_syncPointForMailbox.set(mailbox, syncPoint); } @@ -71,7 +70,7 @@ public: { unsigned mailbox = 0; memcpy(&mailbox, mailboxName, sizeof(mailbox)); - DCHECK(mailbox && mailbox < m_nextMailBox); + ASSERT(mailbox && mailbox < m_nextMailBox); // If the latest sync point the context has waited on is before the sync // point for when the mailbox was set, pretend we never saw that @@ -116,8 +115,8 @@ public: virtual void bindTexture(WGC3Denum target, WebGLId texture) { - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); - ASSERT_TRUE(!texture || m_textures.find(texture) != m_textures.end()); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!texture || m_textures.find(texture) != m_textures.end()); m_currentTexture = texture; } @@ -131,7 +130,7 @@ public: virtual void deleteTexture(WebGLId id) { TextureMap::iterator it = m_textures.find(id); - ASSERT_NE(it, m_textures.end()); + ASSERT(it != m_textures.end()); m_textures.remove(it); if (m_currentTexture == id) m_currentTexture = 0; @@ -140,9 +139,9 @@ public: virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, WGC3Dint width, WGC3Dint height) { - ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); - ASSERT_EQ(levels, 1); + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(levels == 1); WGC3Denum format = GraphicsContext3D::RGBA; switch (internalformat) { case Extensions3D::RGBA8_OES: @@ -151,19 +150,19 @@ public: format = Extensions3D::BGRA_EXT; break; default: - NOTREACHED(); + ASSERT_NOT_REACHED(); } allocateTexture(IntSize(width, height), format); } virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { - ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); - ASSERT_FALSE(level); - ASSERT_EQ(internalformat, format); - ASSERT_FALSE(border); - ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!level); + ASSERT(internalformat == format); + ASSERT(!border); + ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); allocateTexture(IntSize(width, height), format); if (pixels) setPixels(0, 0, width, height, pixels); @@ -171,21 +170,21 @@ public: virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) { - ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); - ASSERT_FALSE(level); - ASSERT_TRUE(m_textures.get(m_currentTexture)); - ASSERT_EQ(m_textures.get(m_currentTexture)->format, format); - ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); - ASSERT_TRUE(pixels); + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); + ASSERT(!level); + ASSERT(m_textures.get(m_currentTexture)); + ASSERT(m_textures.get(m_currentTexture)->format == format); + ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); + ASSERT(pixels); setPixels(xoffset, yoffset, width, height, pixels); } virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { return m_sharedData->genMailbox(mailbox); } virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { - ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); // Delay movind the texture into the mailbox until the next // insertSyncPoint, so that it is not visible to other contexts that @@ -199,18 +198,18 @@ public: virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { - ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT(m_currentTexture); + ASSERT(target == GraphicsContext3D::TEXTURE_2D); m_textures.set(m_currentTexture, m_sharedData->consumeTexture(mailbox, m_lastWaitedSyncPoint)); } void getPixels(const IntSize& size, WGC3Denum format, uint8_t* pixels) { - ASSERT_TRUE(m_currentTexture); + ASSERT(m_currentTexture); Texture* texture = m_textures.get(m_currentTexture); - ASSERT_TRUE(texture); - ASSERT_EQ(texture->size, size); - ASSERT_EQ(texture->format, format); + ASSERT(texture); + ASSERT(texture->size == size); + ASSERT(texture->format == format); memcpy(pixels, texture->data.get(), textureSize(size, format)); } @@ -230,18 +229,18 @@ protected: private: void allocateTexture(const IntSize& size, WGC3Denum format) { - ASSERT_TRUE(m_currentTexture); + ASSERT(m_currentTexture); m_textures.set(m_currentTexture, adoptPtr(new Texture(size, format))); } void setPixels(int xoffset, int yoffset, int width, int height, const void* pixels) { - ASSERT_TRUE(m_currentTexture); + ASSERT(m_currentTexture); Texture* texture = m_textures.get(m_currentTexture); - ASSERT_TRUE(texture); - ASSERT_TRUE(xoffset >= 0 && xoffset+width <= texture->size.width()); - ASSERT_TRUE(yoffset >= 0 && yoffset+height <= texture->size.height()); - ASSERT_TRUE(pixels); + ASSERT(texture); + ASSERT(xoffset >= 0 && xoffset+width <= texture->size.width()); + ASSERT(yoffset >= 0 && yoffset+height <= texture->size.height()); + ASSERT(pixels); size_t inPitch = textureSize(IntSize(width, 1), texture->format); size_t outPitch = textureSize(IntSize(texture->size.width(), 1), texture->format); uint8_t* dest = texture->data.get() + yoffset * outPitch + textureSize(IntSize(xoffset, 1), texture->format); diff --git a/cc/scheduler.cc b/cc/scheduler.cc index eb24306..869cd19 100644 --- a/cc/scheduler.cc +++ b/cc/scheduler.cc @@ -7,8 +7,7 @@ #include "CCScheduler.h" #include "TraceEvent.h" -#include "base/auto_reset.h" -#include "base/logging.h" +#include <base/auto_reset.h> namespace cc { @@ -17,9 +16,9 @@ CCScheduler::CCScheduler(CCSchedulerClient* client, scoped_ptr<CCFrameRateContro , m_frameRateController(frameRateController.Pass()) , m_insideProcessScheduledActions(false) { - DCHECK(m_client); + ASSERT(m_client); m_frameRateController->setClient(this); - DCHECK(!m_stateMachine.vsyncCallbackNeeded()); + ASSERT(!m_stateMachine.vsyncCallbackNeeded()); } CCScheduler::~CCScheduler() diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc index 47fa5a0..3eaf5cd 100644 --- a/cc/scheduler_state_machine.cc +++ b/cc/scheduler_state_machine.cc @@ -5,9 +5,9 @@ #include "config.h" #include "CCSchedulerStateMachine.h" -#include "base/logging.h" #include "base/stringprintf.h" + namespace cc { CCSchedulerStateMachine::CCSchedulerStateMachine() @@ -103,7 +103,7 @@ bool CCSchedulerStateMachine::shouldAcquireLayerTexturesForMainThread() const return false; if (m_textureState == LAYER_TEXTURE_STATE_UNLOCKED) return true; - DCHECK(m_textureState == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD); + ASSERT(m_textureState == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD); // Transfer the lock from impl thread to main thread immediately if the // impl thread is not even scheduled to draw. Guards against deadlocking. if (!scheduledToDraw()) @@ -151,7 +151,7 @@ CCSchedulerStateMachine::Action CCSchedulerStateMachine::nextAction() const return ACTION_BEGIN_FRAME; return ACTION_NONE; } - NOTREACHED(); + ASSERT_NOT_REACHED(); return ACTION_NONE; } @@ -162,7 +162,7 @@ void CCSchedulerStateMachine::updateState(Action action) return; case ACTION_BEGIN_FRAME: - DCHECK(m_visible || m_needsForcedCommit); + ASSERT(m_visible || m_needsForcedCommit); m_commitState = COMMIT_STATE_FRAME_IN_PROGRESS; m_needsCommit = false; m_needsForcedCommit = false; @@ -196,8 +196,8 @@ void CCSchedulerStateMachine::updateState(Action action) return; case ACTION_BEGIN_CONTEXT_RECREATION: - DCHECK(m_commitState == COMMIT_STATE_IDLE); - DCHECK(m_contextState == CONTEXT_LOST); + ASSERT(m_commitState == COMMIT_STATE_IDLE); + ASSERT(m_contextState == CONTEXT_LOST); m_contextState = CONTEXT_RECREATING; return; @@ -212,8 +212,8 @@ void CCSchedulerStateMachine::updateState(Action action) void CCSchedulerStateMachine::setMainThreadNeedsLayerTextures() { - DCHECK(!m_mainThreadNeedsLayerTextures); - DCHECK(m_textureState != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); + ASSERT(!m_mainThreadNeedsLayerTextures); + ASSERT(m_textureState != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD); m_mainThreadNeedsLayerTextures = true; } @@ -284,13 +284,13 @@ void CCSchedulerStateMachine::setNeedsForcedCommit() void CCSchedulerStateMachine::beginFrameComplete() { - DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); + ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); m_commitState = COMMIT_STATE_READY_TO_COMMIT; } void CCSchedulerStateMachine::beginFrameAborted() { - DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); + ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS); m_commitState = COMMIT_STATE_IDLE; setNeedsCommit(); } @@ -304,7 +304,7 @@ void CCSchedulerStateMachine::didLoseContext() void CCSchedulerStateMachine::didRecreateContext() { - DCHECK(m_contextState == CONTEXT_RECREATING); + ASSERT(m_contextState == CONTEXT_RECREATING); m_contextState = CONTEXT_ACTIVE; setNeedsCommit(); } diff --git a/cc/scheduler_unittest.cc b/cc/scheduler_unittest.cc index d912abb..104453d 100644 --- a/cc/scheduler_unittest.cc +++ b/cc/scheduler_unittest.cc @@ -6,7 +6,6 @@ #include "CCScheduler.h" -#include "base/logging.h" #include "cc/test/scheduler_test_common.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -223,7 +222,7 @@ public: virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE { - NOTREACHED(); + ASSERT_NOT_REACHED(); return CCScheduledActionDrawAndSwapResult(true, true); } @@ -325,7 +324,7 @@ public: virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE { - NOTREACHED(); + ASSERT_NOT_REACHED(); return CCScheduledActionDrawAndSwapResult(true, true); } diff --git a/cc/scoped_ptr_hash_map.h b/cc/scoped_ptr_hash_map.h index 60eadee..1cea5c0 100644 --- a/cc/scoped_ptr_hash_map.h +++ b/cc/scoped_ptr_hash_map.h @@ -7,7 +7,6 @@ #include "base/basictypes.h" #include "base/hash_tables.h" -#include "base/logging.h" #include "base/stl_util.h" #include "base/memory/scoped_ptr.h" @@ -67,7 +66,7 @@ class ScopedPtrHashMap { } scoped_ptr<Value> take(iterator it) { - DCHECK(it != data_.end()); + ASSERT(it != data_.end()); if (it == data_.end()) return scoped_ptr<Value>(NULL); @@ -87,7 +86,7 @@ class ScopedPtrHashMap { } scoped_ptr<Value> take_and_erase(iterator it) { - DCHECK(it != data_.end()); + ASSERT(it != data_.end()); if (it == data_.end()) return scoped_ptr<Value>(NULL); diff --git a/cc/scoped_ptr_vector.h b/cc/scoped_ptr_vector.h index 28c0014..05e38d9 100644 --- a/cc/scoped_ptr_vector.h +++ b/cc/scoped_ptr_vector.h @@ -6,7 +6,6 @@ #define CC_SCOPED_PTR_VECTOR_H_ #include "base/basictypes.h" -#include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" @@ -32,7 +31,7 @@ class ScopedPtrVector { } T* Peek(size_t index) const { - DCHECK(index < size()); + ASSERT(index < size()); return data_[index]; } @@ -41,12 +40,12 @@ class ScopedPtrVector { } T* first() const { - DCHECK(!isEmpty()); + ASSERT(!isEmpty()); return Peek(0); } T* last() const { - DCHECK(!isEmpty()); + ASSERT(!isEmpty()); return Peek(size() - 1); } @@ -55,14 +54,14 @@ class ScopedPtrVector { } scoped_ptr<T> take(size_t index) { - DCHECK(index < size()); + ASSERT(index < size()); scoped_ptr<T> ret(data_[index]); data_[index] = NULL; return ret.Pass(); } void remove(size_t index) { - DCHECK(index < size()); + ASSERT(index < size()); delete data_[index]; data_.erase(data_.begin() + index); } @@ -76,7 +75,7 @@ class ScopedPtrVector { } void insert(size_t index, scoped_ptr<T> item) { - DCHECK(index < size()); + ASSERT(index < size()); data_.insert(data_.begin() + index, item.release()); } diff --git a/cc/scoped_texture.cc b/cc/scoped_texture.cc index f5a5feb..d43ebe3 100644 --- a/cc/scoped_texture.cc +++ b/cc/scoped_texture.cc @@ -11,7 +11,7 @@ namespace cc { CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider) : m_resourceProvider(resourceProvider) { - DCHECK(m_resourceProvider); + ASSERT(m_resourceProvider); } CCScopedTexture::~CCScopedTexture() @@ -21,13 +21,13 @@ CCScopedTexture::~CCScopedTexture() bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint) { - DCHECK(!id()); - DCHECK(!size.isEmpty()); + ASSERT(!id()); + ASSERT(!size.isEmpty()); setDimensions(size, format); setId(m_resourceProvider->createResource(pool, size, format, hint)); -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED m_allocateThreadIdentifier = base::PlatformThread::CurrentId(); #endif @@ -37,7 +37,7 @@ bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, C void CCScopedTexture::free() { if (id()) { - DCHECK(m_allocateThreadIdentifier == base::PlatformThread::CurrentId()); + ASSERT(m_allocateThreadIdentifier == base::PlatformThread::CurrentId()); m_resourceProvider->deleteResource(id()); } setId(0); diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h index 5ca8acd..7e27fd5 100644 --- a/cc/scoped_texture.h +++ b/cc/scoped_texture.h @@ -7,10 +7,9 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "cc/dcheck.h" #include "CCTexture.h" -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED #include "base/threading/platform_thread.h" #endif @@ -36,7 +35,7 @@ protected: private: CCResourceProvider* m_resourceProvider; -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED base::PlatformThreadId m_allocateThreadIdentifier; #endif diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h index c6ac440..802046d 100644 --- a/cc/scoped_thread_proxy.h +++ b/cc/scoped_thread_proxy.h @@ -6,7 +6,6 @@ #define CCScopedThreadProxy_h #include "CCThreadTask.h" -#include "base/logging.h" #include "base/threading/platform_thread.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -28,7 +27,7 @@ class CCScopedThreadProxy : public ThreadSafeRefCounted<CCScopedThreadProxy> { public: static PassRefPtr<CCScopedThreadProxy> create(CCThread* targetThread) { - DCHECK(base::PlatformThread::CurrentId() == targetThread->threadID()); + ASSERT(base::PlatformThread::CurrentId() == targetThread->threadID()); return adoptRef(new CCScopedThreadProxy(targetThread)); } @@ -44,8 +43,8 @@ public: void shutdown() { - DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID()); - DCHECK(!m_shutdown); + ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID()); + ASSERT(!m_shutdown); m_shutdown = true; } @@ -61,7 +60,7 @@ private: deref(); return; } - DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID()); + ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID()); task->performTask(); deref(); } diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index ed9a21d..d75a79c 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -219,7 +219,7 @@ void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater* return; // We should always have enough memory for UI. - DCHECK(texture->texture()->canAcquireBackingTexture()); + ASSERT(texture->texture()->canAcquireBackingTexture()); if (!texture->texture()->canAcquireBackingTexture()) return; diff --git a/cc/shader.cc b/cc/shader.cc index 7eaee7b..b936dd9 100644 --- a/cc/shader.cc +++ b/cc/shader.cc @@ -6,7 +6,6 @@ #include "cc/shader.h" -#include "base/logging.h" #include <public/WebGraphicsContext3D.h> #include <wtf/StdLibExtras.h> @@ -22,7 +21,7 @@ namespace { static void getProgramUniformLocations(WebGraphicsContext3D* context, unsigned program, const char** shaderUniforms, size_t count, size_t maxLocations, int* locations, bool usingBindUniform, int* baseUniformIndex) { for (size_t uniformIndex = 0; uniformIndex < count; uniformIndex ++) { - DCHECK(uniformIndex < maxLocations); + ASSERT(uniformIndex < maxLocations); if (usingBindUniform) { locations[uniformIndex] = (*baseUniformIndex)++; @@ -49,7 +48,7 @@ void VertexShaderPosTex::init(WebGraphicsContext3D* context, unsigned program, b getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGTH(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, baseUniformIndex); m_matrixLocation = locations[0]; - DCHECK(m_matrixLocation != -1); + ASSERT(m_matrixLocation != -1); } std::string VertexShaderPosTex::getShaderString() const @@ -88,7 +87,7 @@ void VertexShaderPosTexYUVStretch::init(WebGraphicsContext3D* context, unsigned m_matrixLocation = locations[0]; m_yWidthScaleFactorLocation = locations[1]; m_uvWidthScaleFactorLocation = locations[2]; - DCHECK(m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1); + ASSERT(m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1); } std::string VertexShaderPosTexYUVStretch::getShaderString() const @@ -126,7 +125,7 @@ void VertexShaderPos::init(WebGraphicsContext3D* context, unsigned program, bool getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGTH(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, baseUniformIndex); m_matrixLocation = locations[0]; - DCHECK(m_matrixLocation != -1); + ASSERT(m_matrixLocation != -1); } std::string VertexShaderPos::getShaderString() const @@ -159,7 +158,7 @@ void VertexShaderPosTexTransform::init(WebGraphicsContext3D* context, unsigned p m_matrixLocation = locations[0]; m_texTransformLocation = locations[1]; - DCHECK(m_matrixLocation != -1 && m_texTransformLocation != -1); + ASSERT(m_matrixLocation != -1 && m_texTransformLocation != -1); } std::string VertexShaderPosTexTransform::getShaderString() const @@ -209,7 +208,7 @@ void VertexShaderQuad::init(WebGraphicsContext3D* context, unsigned program, boo m_matrixLocation = locations[0]; m_pointLocation = locations[1]; - DCHECK(m_matrixLocation != -1 && m_pointLocation != -1); + ASSERT(m_matrixLocation != -1 && m_pointLocation != -1); } std::string VertexShaderQuad::getShaderString() const @@ -255,7 +254,7 @@ void VertexShaderTile::init(WebGraphicsContext3D* context, unsigned program, boo m_matrixLocation = locations[0]; m_pointLocation = locations[1]; m_vertexTexTransformLocation = locations[2]; - DCHECK(m_matrixLocation != -1 && m_pointLocation != -1 && m_vertexTexTransformLocation != -1); + ASSERT(m_matrixLocation != -1 && m_pointLocation != -1 && m_vertexTexTransformLocation != -1); } std::string VertexShaderTile::getShaderString() const @@ -336,7 +335,7 @@ void FragmentTexAlphaBinding::init(WebGraphicsContext3D* context, unsigned progr m_samplerLocation = locations[0]; m_alphaLocation = locations[1]; - DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1); + ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1); } FragmentTexOpaqueBinding::FragmentTexOpaqueBinding() @@ -354,7 +353,7 @@ void FragmentTexOpaqueBinding::init(WebGraphicsContext3D* context, unsigned prog getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGTH(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, baseUniformIndex); m_samplerLocation = locations[0]; - DCHECK(m_samplerLocation != -1); + ASSERT(m_samplerLocation != -1); } std::string FragmentShaderRGBATexFlipAlpha::getShaderString() const @@ -522,7 +521,7 @@ void FragmentShaderRGBATexAlphaAA::init(WebGraphicsContext3D* context, unsigned m_samplerLocation = locations[0]; m_alphaLocation = locations[1]; m_edgeLocation = locations[2]; - DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1); + ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1); } std::string FragmentShaderRGBATexAlphaAA::getShaderString() const @@ -574,7 +573,7 @@ void FragmentTexClampAlphaAABinding::init(WebGraphicsContext3D* context, unsigne m_alphaLocation = locations[1]; m_fragmentTexTransformLocation = locations[2]; m_edgeLocation = locations[3]; - DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1 && m_fragmentTexTransformLocation != -1 && m_edgeLocation != -1); + ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1 && m_fragmentTexTransformLocation != -1 && m_edgeLocation != -1); } std::string FragmentShaderRGBATexClampAlphaAA::getShaderString() const @@ -657,7 +656,7 @@ void FragmentShaderRGBATexAlphaMask::init(WebGraphicsContext3D* context, unsigne m_alphaLocation = locations[2]; m_maskTexCoordScaleLocation = locations[3]; m_maskTexCoordOffsetLocation = locations[4]; - DCHECK(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1); + ASSERT(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1); } std::string FragmentShaderRGBATexAlphaMask::getShaderString() const @@ -709,7 +708,7 @@ void FragmentShaderRGBATexAlphaMaskAA::init(WebGraphicsContext3D* context, unsig m_edgeLocation = locations[3]; m_maskTexCoordScaleLocation = locations[4]; m_maskTexCoordOffsetLocation = locations[5]; - DCHECK(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1); + ASSERT(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1); } std::string FragmentShaderRGBATexAlphaMaskAA::getShaderString() const @@ -773,7 +772,7 @@ void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned progra m_ccMatrixLocation = locations[4]; m_yuvAdjLocation = locations[5]; - DCHECK(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1 + ASSERT(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1 && m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocation != -1); } @@ -817,7 +816,7 @@ void FragmentShaderColor::init(WebGraphicsContext3D* context, unsigned program, getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGTH(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, baseUniformIndex); m_colorLocation = locations[0]; - DCHECK(m_colorLocation != -1); + ASSERT(m_colorLocation != -1); } std::string FragmentShaderColor::getShaderString() const @@ -855,7 +854,7 @@ void FragmentShaderCheckerboard::init(WebGraphicsContext3D* context, unsigned pr m_texTransformLocation = locations[1]; m_frequencyLocation = locations[2]; m_colorLocation = locations[3]; - DCHECK(m_alphaLocation != -1 && m_texTransformLocation != -1 && m_frequencyLocation != -1 && m_colorLocation != -1); + ASSERT(m_alphaLocation != -1 && m_texTransformLocation != -1 && m_frequencyLocation != -1 && m_colorLocation != -1); } std::string FragmentShaderCheckerboard::getShaderString() const diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc index bffcba1..e9ac8e7 100644 --- a/cc/single_thread_proxy.cc +++ b/cc/single_thread_proxy.cc @@ -31,7 +31,7 @@ CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) , m_totalCommitCount(0) { TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy"); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); } void CCSingleThreadProxy::start() @@ -43,14 +43,14 @@ void CCSingleThreadProxy::start() CCSingleThreadProxy::~CCSingleThreadProxy() { TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy"); - DCHECK(CCProxy::isMainThread()); - DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called. + ASSERT(CCProxy::isMainThread()); + ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called. } bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) { TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback"); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (!commitAndComposite()) return false; @@ -73,7 +73,7 @@ void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, void CCSingleThreadProxy::finishAllRendering() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); { DebugScopedSetImplThread impl; m_layerTreeHostImpl->finishAllRendering(); @@ -82,13 +82,13 @@ void CCSingleThreadProxy::finishAllRendering() bool CCSingleThreadProxy::isStarted() const { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); return m_layerTreeHostImpl.get(); } bool CCSingleThreadProxy::initializeContext() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) return false; @@ -109,8 +109,8 @@ void CCSingleThreadProxy::setVisible(bool visible) bool CCSingleThreadProxy::initializeRenderer() { - DCHECK(CCProxy::isMainThread()); - DCHECK(m_contextBeforeInitialization.get()); + ASSERT(CCProxy::isMainThread()); + ASSERT(m_contextBeforeInitialization.get()); { DebugScopedSetImplThread impl; bool ok = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitialization.Pass()); @@ -126,8 +126,8 @@ bool CCSingleThreadProxy::initializeRenderer() bool CCSingleThreadProxy::recreateContext() { TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext"); - DCHECK(CCProxy::isMainThread()); - DCHECK(m_contextLost); + ASSERT(CCProxy::isMainThread()); + ASSERT(m_contextLost); scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); if (!context.get()) @@ -160,14 +160,14 @@ void CCSingleThreadProxy::renderingStats(CCRenderingStats* stats) const RendererCapabilities& CCSingleThreadProxy::rendererCapabilities() const { - DCHECK(m_rendererInitialized); + ASSERT(m_rendererInitialized); // Note: this gets called during the commit by the "impl" thread return m_RendererCapabilitiesForMainThread; } void CCSingleThreadProxy::loseContext() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_layerTreeHost->didLoseContext(); m_contextLost = true; } @@ -175,12 +175,12 @@ void CCSingleThreadProxy::loseContext() void CCSingleThreadProxy::setNeedsAnimate() { // CCThread-only feature - NOTREACHED(); + ASSERT_NOT_REACHED(); } void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); // Commit immediately { DebugScopedSetMainThreadBlocked mainThreadBlocked; @@ -205,11 +205,11 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) m_layerTreeHostImpl->commitComplete(); -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED // In the single-threaded case, the scroll deltas should never be // touched on the impl layer tree. scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); - DCHECK(!scrollInfo->scrolls.size()); + ASSERT(!scrollInfo->scrolls.size()); #endif base::TimeTicks endTime = base::TimeTicks::HighResNow(); @@ -222,7 +222,7 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue) void CCSingleThreadProxy::setNeedsCommit() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_layerTreeHost->scheduleComposite(); } @@ -251,7 +251,7 @@ size_t CCSingleThreadProxy::maxPartialTextureUpdates() const void CCSingleThreadProxy::stop() { TRACE_EVENT0("cc", "CCSingleThreadProxy::stop"); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); { DebugScopedSetMainThreadBlocked mainThreadBlocked; DebugScopedSetImplThread impl; @@ -275,14 +275,14 @@ void CCSingleThreadProxy::setNeedsCommitOnImplThread() void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); DebugScopedSetMainThread main; m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); } void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); if (m_layerTreeHost->contentsTextureManager()) m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider()); } @@ -307,12 +307,12 @@ void CCSingleThreadProxy::forceSerializeOnSwapBuffers() void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread() { - NOTREACHED(); + ASSERT_NOT_REACHED(); } bool CCSingleThreadProxy::commitAndComposite() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (!m_layerTreeHost->initializeRendererIfNeeded()) return false; @@ -340,7 +340,7 @@ bool CCSingleThreadProxy::commitAndComposite() bool CCSingleThreadProxy::doComposite() { - DCHECK(!m_contextLost); + ASSERT(!m_contextLost); { DebugScopedSetImplThread impl; diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h index d43d874..2bbacef 100644 --- a/cc/single_thread_proxy.h +++ b/cc/single_thread_proxy.h @@ -8,7 +8,7 @@ #include "CCAnimationEvents.h" #include "CCLayerTreeHostImpl.h" #include "CCProxy.h" -#include "base/time.h" +#include <base/time.h> #include <limits> namespace cc { @@ -90,13 +90,13 @@ class DebugScopedSetImplThread { public: DebugScopedSetImplThread() { -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED CCProxy::setCurrentThreadIsImplThread(true); #endif } ~DebugScopedSetImplThread() { -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED CCProxy::setCurrentThreadIsImplThread(false); #endif } @@ -108,13 +108,13 @@ class DebugScopedSetMainThread { public: DebugScopedSetMainThread() { -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED CCProxy::setCurrentThreadIsImplThread(false); #endif } ~DebugScopedSetMainThread() { -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED CCProxy::setCurrentThreadIsImplThread(true); #endif } diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index b441f8d..0aeb33b 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -264,7 +264,7 @@ void CCRendererSoftware::drawTextureQuad(const DrawingFrame& frame, const CCText void CCRendererSoftware::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) { - DCHECK(isSoftwareResource(quad->resourceId())); + ASSERT(isSoftwareResource(quad->resourceId())); CCResourceProvider::ScopedReadLockSoftware quadResourceLock(m_resourceProvider, quad->resourceId()); SkIRect uvRect = toSkIRect(IntRect(quad->textureOffset(), quad->quadRect().size())); @@ -277,7 +277,7 @@ void CCRendererSoftware::drawRenderPassQuad(const DrawingFrame& frame, const CCR if (!contentsTexture || !contentsTexture->id()) return; - DCHECK(isSoftwareResource(contentsTexture->id())); + ASSERT(isSoftwareResource(contentsTexture->id())); CCResourceProvider::ScopedReadLockSoftware contentsTextureLock(m_resourceProvider, contentsTexture->id()); const SkBitmap* bitmap = contentsTextureLock.skBitmap(); diff --git a/cc/solid_color_draw_quad.cc b/cc/solid_color_draw_quad.cc index dca3cc5..157acd9 100644 --- a/cc/solid_color_draw_quad.cc +++ b/cc/solid_color_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCSolidColorDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) @@ -27,7 +25,7 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt const CCSolidColorDrawQuad* CCSolidColorDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::SolidColor); + ASSERT(quad->material() == CCDrawQuad::SolidColor); return static_cast<const CCSolidColorDrawQuad*>(quad); } diff --git a/cc/stream_video_draw_quad.cc b/cc/stream_video_draw_quad.cc index c10d633..e92d98a 100644 --- a/cc/stream_video_draw_quad.cc +++ b/cc/stream_video_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCStreamVideoDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCStreamVideoDrawQuad> CCStreamVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) @@ -24,7 +22,7 @@ CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuad const CCStreamVideoDrawQuad* CCStreamVideoDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::StreamVideoContent); + ASSERT(quad->material() == CCDrawQuad::StreamVideoContent); return static_cast<const CCStreamVideoDrawQuad*>(quad); } diff --git a/cc/stubs/config.h b/cc/stubs/config.h deleted file mode 100644 index 3b2b573..0000000 --- a/cc/stubs/config.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_CONFIG_H_ -#define CC_STUBS_CONFIG_H_ - -#if INSIDE_WEBKIT_BUILD -#include "Source/WTF/config.h" -#else -#include "third_party/WebKit/Source/WTF/config.h" -#endif - -#include <wtf/Assertions.h> -#undef LOG - -#endif diff --git a/cc/stubs/trace_event.h b/cc/stubs/trace_event.h index 811d6b9..75587a3 100644 --- a/cc/stubs/trace_event.h +++ b/cc/stubs/trace_event.h @@ -2,4 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Chromium's LOG() macro collides with one from WTF. +#ifdef LOG +#undef LOG +#endif + #include "base/debug/trace_event.h" diff --git a/cc/test/fake_web_compositor_output_surface.h b/cc/test/fake_web_compositor_output_surface.h index fb4f314..2d3128c 100644 --- a/cc/test/fake_web_compositor_output_surface.h +++ b/cc/test/fake_web_compositor_output_surface.h @@ -5,7 +5,6 @@ #ifndef FakeWebCompositorOutputSurface_h #define FakeWebCompositorOutputSurface_h -#include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "cc/test/fake_web_compositor_software_output_device.h" #include <public/WebCompositorOutputSurface.h> @@ -31,7 +30,7 @@ public: { if (!m_context3D) return true; - DCHECK(client); + ASSERT(client); if (!m_context3D->makeContextCurrent()) return false; m_client = client; diff --git a/cc/test/fake_web_compositor_software_output_device.h b/cc/test/fake_web_compositor_software_output_device.h index b71adee..356833b 100644 --- a/cc/test/fake_web_compositor_software_output_device.h +++ b/cc/test/fake_web_compositor_software_output_device.h @@ -5,7 +5,6 @@ #ifndef FakeWebCompositorSoftwareOutputDevice_h #define FakeWebCompositorSoftwareOutputDevice_h -#include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "third_party/skia/include/core/SkDevice.h" #include <public/WebCompositorSoftwareOutputDevice.h> @@ -18,7 +17,7 @@ class FakeWebCompositorSoftwareOutputDevice : public WebCompositorSoftwareOutput public: virtual WebImage* lock(bool forWrite) OVERRIDE { - DCHECK(m_device.get()); + ASSERT(m_device.get()); m_image = m_device->accessBitmap(forWrite); return &m_image; } diff --git a/cc/test/scheduler_test_common.cc b/cc/test/scheduler_test_common.cc index e956b5d..3e58f36 100644 --- a/cc/test/scheduler_test_common.cc +++ b/cc/test/scheduler_test_common.cc @@ -6,8 +6,6 @@ #include "cc/test/scheduler_test_common.h" -#include "base/logging.h" - namespace WebKitTests { void FakeCCTimeSourceClient::onTimerTick() @@ -26,7 +24,7 @@ FakeCCThread::~FakeCCThread() void FakeCCThread::postTask(PassOwnPtr<Task>) { - NOTREACHED(); + ASSERT_NOT_REACHED(); } void FakeCCThread::postDelayedTask(PassOwnPtr<Task> task, long long delay) diff --git a/cc/test/scheduler_test_common.h b/cc/test/scheduler_test_common.h index 3b73d0d..2f6660b 100644 --- a/cc/test/scheduler_test_common.h +++ b/cc/test/scheduler_test_common.h @@ -46,7 +46,7 @@ public: bool hasPendingTask() const { return m_pendingTask; } void runPendingTask() { - ASSERT_TRUE(m_pendingTask); + ASSERT(m_pendingTask); OwnPtr<Task> task = m_pendingTask.release(); task->performTask(); } @@ -87,7 +87,7 @@ public: void tick() { - ASSERT_TRUE(m_active); + ASSERT(m_active); if (m_client) m_client->onTimerTick(); } diff --git a/cc/texture_copier.cc b/cc/texture_copier.cc index 3a5e7c5..73121b8 100644 --- a/cc/texture_copier.cc +++ b/cc/texture_copier.cc @@ -17,7 +17,7 @@ AcceleratedTextureCopier::AcceleratedTextureCopier(WebKit::WebGraphicsContext3D* : m_context(context) , m_usingBindUniforms(usingBindUniforms) { - DCHECK(m_context); + ASSERT(m_context); GLC(m_context, m_fbo = m_context->createFramebuffer()); GLC(m_context, m_positionBuffer = m_context->createBuffer()); diff --git a/cc/texture_draw_quad.cc b/cc/texture_draw_quad.cc index 0bb0cef..db985ad 100644 --- a/cc/texture_draw_quad.cc +++ b/cc/texture_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCTextureDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) @@ -31,7 +29,7 @@ void CCTextureDrawQuad::setNeedsBlending() const CCTextureDrawQuad* CCTextureDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::TextureContent); + ASSERT(quad->material() == CCDrawQuad::TextureContent); return static_cast<const CCTextureDrawQuad*>(quad); } diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc index bb92ed8..4c81709 100644 --- a/cc/texture_layer_impl.cc +++ b/cc/texture_layer_impl.cc @@ -31,7 +31,7 @@ void CCTextureLayerImpl::willDraw(CCResourceProvider* resourceProvider) { if (!m_textureId) return; - DCHECK(!m_externalTextureResource); + ASSERT(!m_externalTextureResource); m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_textureId); } @@ -54,7 +54,7 @@ void CCTextureLayerImpl::didDraw(CCResourceProvider* resourceProvider) // FIXME: the following assert will not be true when sending resources to a // parent compositor. A synchronization scheme (double-buffering or // pipelining of updates) for the client will need to exist to solve this. - DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); resourceProvider->deleteResource(m_externalTextureResource); m_externalTextureResource = 0; } diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index 6e76d46..2e1e74d 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -56,21 +56,21 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_totalCommitCount(0) { TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); - DCHECK(isMainThread()); + ASSERT(isMainThread()); } CCThreadProxy::~CCThreadProxy() { TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy"); - DCHECK(isMainThread()); - DCHECK(!m_started); + ASSERT(isMainThread()); + ASSERT(!m_started); } bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) { TRACE_EVENT0("cc", "CCThreadPRoxy::compositeAndReadback"); - DCHECK(isMainThread()); - DCHECK(m_layerTreeHost); + ASSERT(isMainThread()); + ASSERT(m_layerTreeHost); if (!m_layerTreeHost->initializeRendererIfNeeded()) { TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); @@ -103,8 +103,8 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) { - DCHECK(CCProxy::isImplThread()); - DCHECK(!m_readbackRequestOnImplThread); + ASSERT(CCProxy::isImplThread()); + ASSERT(!m_readbackRequestOnImplThread); if (!m_layerTreeHostImpl.get()) { request->success = false; request->completion.signal(); @@ -118,20 +118,20 @@ void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) void CCThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, duration)); } void CCThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double duration) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); if (m_layerTreeHostImpl.get()) m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration); } void CCThreadProxy::finishAllRendering() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); // Make sure all GL drawing is finished on the impl thread. DebugScopedSetMainThreadBlocked mainThreadBlocked; @@ -142,7 +142,7 @@ void CCThreadProxy::finishAllRendering() bool CCThreadProxy::isStarted() const { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); return m_started; } @@ -212,7 +212,7 @@ bool CCThreadProxy::initializeRenderer() bool CCThreadProxy::recreateContext() { TRACE_EVENT0("cc", "CCThreadProxy::recreateContext"); - DCHECK(isMainThread()); + ASSERT(isMainThread()); // Try to create the context. scoped_ptr<CCGraphicsContext> context = m_layerTreeHost->createContext(); @@ -243,7 +243,7 @@ bool CCThreadProxy::recreateContext() void CCThreadProxy::renderingStats(CCRenderingStats* stats) { - DCHECK(isMainThread()); + ASSERT(isMainThread()); DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; @@ -258,7 +258,7 @@ void CCThreadProxy::renderingStats(CCRenderingStats* stats) const RendererCapabilities& CCThreadProxy::rendererCapabilities() const { - DCHECK(m_rendererInitialized); + ASSERT(m_rendererInitialized); return m_RendererCapabilitiesMainThreadCopy; } @@ -269,7 +269,7 @@ void CCThreadProxy::loseContext() void CCThreadProxy::setNeedsAnimate() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (m_animateRequested) return; @@ -284,7 +284,7 @@ void CCThreadProxy::setNeedsAnimate() void CCThreadProxy::setNeedsCommit() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (m_commitRequested) return; TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommit"); @@ -298,14 +298,14 @@ void CCThreadProxy::setNeedsCommit() void CCThreadProxy::didLoseContextOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread"); m_schedulerOnImplThread->didLoseContext(); } void CCThreadProxy::onSwapBuffersCompleteOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::onSwapBuffersCompleteOnImplThread"); m_schedulerOnImplThread->didSwapBuffersComplete(); m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCompleteSwapBuffers)); @@ -313,7 +313,7 @@ void CCThreadProxy::onSwapBuffersCompleteOnImplThread() void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT2("cc", "CCThreadProxy::onVSyncParametersChanged", "monotonicTimebase", monotonicTimebase, "intervalInSeconds", intervalInSeconds); base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimebase * base::Time::kMicrosecondsPerSecond); base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSeconds * base::Time::kMicrosecondsPerSecond); @@ -322,21 +322,21 @@ void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double in void CCThreadProxy::onCanDrawStateChanged(bool canDraw) { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDraw); m_schedulerOnImplThread->setCanDraw(canDraw); } void CCThreadProxy::setNeedsCommitOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommitOnImplThread"); m_schedulerOnImplThread->setNeedsCommit(); } void CCThreadProxy::setNeedsForcedCommitOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::setNeedsForcedCommitOnImplThread"); m_schedulerOnImplThread->setNeedsCommit(); m_schedulerOnImplThread->setNeedsForcedCommit(); @@ -344,14 +344,14 @@ void CCThreadProxy::setNeedsForcedCommitOnImplThread() void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime) { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::postAnimationEventsToMainThreadOnImplThread"); m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events.release(), wallClockTime)); } void CCThreadProxy::releaseContentsTexturesOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); if (m_layerTreeHost->contentsTextureManager()) m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider()); @@ -364,7 +364,7 @@ void CCThreadProxy::releaseContentsTexturesOnImplThread() void CCThreadProxy::setNeedsRedraw() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedraw"); CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setFullRootLayerDamageOnImplThread)); CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsRedrawOnImplThread)); @@ -372,21 +372,21 @@ void CCThreadProxy::setNeedsRedraw() bool CCThreadProxy::commitRequested() const { - DCHECK(isMainThread()); + ASSERT(isMainThread()); return m_commitRequested; } void CCThreadProxy::setNeedsRedrawOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedrawOnImplThread"); m_schedulerOnImplThread->setNeedsRedraw(); } void CCThreadProxy::start() { - DCHECK(isMainThread()); - DCHECK(CCProxy::implThread()); + ASSERT(isMainThread()); + ASSERT(CCProxy::implThread()); // Create LayerTreeHostImpl. DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; @@ -400,8 +400,8 @@ void CCThreadProxy::start() void CCThreadProxy::stop() { TRACE_EVENT0("cc", "CCThreadProxy::stop"); - DCHECK(isMainThread()); - DCHECK(m_started); + ASSERT(isMainThread()); + ASSERT(m_started); // Synchronously deletes the impl. { @@ -414,7 +414,7 @@ void CCThreadProxy::stop() m_mainThreadProxy->shutdown(); // Stop running tasks posted to us. - DCHECK(!m_layerTreeHostImpl.get()); // verify that the impl deleted. + ASSERT(!m_layerTreeHostImpl.get()); // verify that the impl deleted. m_layerTreeHost = 0; m_started = false; } @@ -438,7 +438,7 @@ void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* c void CCThreadProxy::finishAllRenderingOnImplThread(CCCompletionEvent* completion) { TRACE_EVENT0("cc", "CCThreadProxy::finishAllRenderingOnImplThread"); - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHostImpl->finishAllRendering(); completion->signal(); } @@ -446,7 +446,7 @@ void CCThreadProxy::finishAllRenderingOnImplThread(CCCompletionEvent* completion void CCThreadProxy::forceBeginFrameOnImplThread(CCCompletionEvent* completion) { TRACE_EVENT0("cc", "CCThreadProxy::forceBeginFrameOnImplThread"); - DCHECK(!m_beginFrameCompletionEventOnImplThread); + ASSERT(!m_beginFrameCompletionEventOnImplThread); if (m_schedulerOnImplThread->commitPending()) { completion->signal(); @@ -460,7 +460,7 @@ void CCThreadProxy::forceBeginFrameOnImplThread(CCCompletionEvent* completion) void CCThreadProxy::scheduledActionBeginFrame() { TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); - DCHECK(!m_pendingBeginFrameRequest); + ASSERT(!m_pendingBeginFrameRequest); m_pendingBeginFrameRequest = make_scoped_ptr(new BeginFrameAndCommitState()); m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasingTime(); m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); @@ -480,7 +480,7 @@ void CCThreadProxy::scheduledActionBeginFrame() void CCThreadProxy::beginFrame() { TRACE_EVENT0("cc", "CCThreadProxy::beginFrame"); - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (!m_layerTreeHost) return; @@ -588,10 +588,10 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion scoped_ptr<CCTextureUpdateQueue> queue(rawQueue); TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); - DCHECK(!m_commitCompletionEventOnImplThread); - DCHECK(isImplThread() && isMainThreadBlocked()); - DCHECK(m_schedulerOnImplThread); - DCHECK(m_schedulerOnImplThread->commitPending()); + ASSERT(!m_commitCompletionEventOnImplThread); + ASSERT(isImplThread() && isMainThreadBlocked()); + ASSERT(m_schedulerOnImplThread); + ASSERT(m_schedulerOnImplThread->commitPending()); if (!m_layerTreeHostImpl.get()) { TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); @@ -620,9 +620,9 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion void CCThreadProxy::beginFrameAbortedOnImplThread() { TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread"); - DCHECK(isImplThread()); - DCHECK(m_schedulerOnImplThread); - DCHECK(m_schedulerOnImplThread->commitPending()); + ASSERT(isImplThread()); + ASSERT(m_schedulerOnImplThread); + ASSERT(m_schedulerOnImplThread->commitPending()); m_schedulerOnImplThread->beginFrameAborted(); } @@ -630,9 +630,9 @@ void CCThreadProxy::beginFrameAbortedOnImplThread() void CCThreadProxy::scheduledActionCommit() { TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit"); - DCHECK(isImplThread()); - DCHECK(m_commitCompletionEventOnImplThread); - DCHECK(m_currentTextureUpdateControllerOnImplThread); + ASSERT(isImplThread()); + ASSERT(m_commitCompletionEventOnImplThread); + ASSERT(m_currentTextureUpdateControllerOnImplThread); // Complete all remaining texture updates. m_currentTextureUpdateControllerOnImplThread->finalize(); @@ -664,7 +664,7 @@ void CCThreadProxy::scheduledActionCommit() void CCThreadProxy::scheduledActionBeginContextRecreation() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginContextRecreation)); } @@ -674,12 +674,12 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte CCScheduledActionDrawAndSwapResult result; result.didDraw = false; result.didSwap = false; - DCHECK(isImplThread()); - DCHECK(m_layerTreeHostImpl.get()); + ASSERT(isImplThread()); + ASSERT(m_layerTreeHostImpl.get()); if (!m_layerTreeHostImpl.get()) return result; - DCHECK(m_layerTreeHostImpl->renderer()); + ASSERT(m_layerTreeHostImpl->renderer()); if (!m_layerTreeHostImpl->renderer()) return result; @@ -736,7 +736,7 @@ void CCThreadProxy::acquireLayerTextures() // This method will block until the next compositor draw if there is a // previously committed frame that is still undrawn. This is necessary to // ensure that the main thread does not monopolize access to the textures. - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (m_texturesAcquired) return; @@ -752,8 +752,8 @@ void CCThreadProxy::acquireLayerTextures() void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent* completion) { - DCHECK(isImplThread()); - DCHECK(!m_textureAcquisitionCompletionEventOnImplThread); + ASSERT(isImplThread()); + ASSERT(!m_textureAcquisitionCompletionEventOnImplThread); m_textureAcquisitionCompletionEventOnImplThread = completion; m_schedulerOnImplThread->setMainThreadNeedsLayerTextures(); @@ -761,7 +761,7 @@ void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEv void CCThreadProxy::scheduledActionAcquireLayerTexturesForMainThread() { - DCHECK(m_textureAcquisitionCompletionEventOnImplThread); + ASSERT(m_textureAcquisitionCompletionEventOnImplThread); m_textureAcquisitionCompletionEventOnImplThread->signal(); m_textureAcquisitionCompletionEventOnImplThread = 0; } @@ -786,13 +786,13 @@ void CCThreadProxy::didAnticipatedDrawTimeChange(base::TimeTicks time) void CCThreadProxy::readyToFinalizeTextureUpdates() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_schedulerOnImplThread->beginFrameComplete(); } void CCThreadProxy::didCommitAndDrawFrame() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (!m_layerTreeHost) return; m_layerTreeHost->didCommitAndDrawFrame(); @@ -800,7 +800,7 @@ void CCThreadProxy::didCommitAndDrawFrame() void CCThreadProxy::didCompleteSwapBuffers() { - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (!m_layerTreeHost) return; m_layerTreeHost->didCompleteSwapBuffers(); @@ -811,7 +811,7 @@ void CCThreadProxy::setAnimationEvents(CCAnimationEventsVector* passed_events, d scoped_ptr<CCAnimationEventsVector> events(make_scoped_ptr(passed_events)); TRACE_EVENT0("cc", "CCThreadProxy::setAnimationEvents"); - DCHECK(isMainThread()); + ASSERT(isMainThread()); if (!m_layerTreeHost) return; m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); @@ -839,8 +839,8 @@ private: void CCThreadProxy::beginContextRecreation() { TRACE_EVENT0("cc", "CCThreadProxy::beginContextRecreation"); - DCHECK(isMainThread()); - DCHECK(!m_contextRecreationTimer); + ASSERT(isMainThread()); + ASSERT(!m_contextRecreationTimer); m_contextRecreationTimer = CCThreadProxyContextRecreationTimer::create(this); m_layerTreeHost->didLoseContext(); m_contextRecreationTimer->startOneShot(contextRecreationTickRate); @@ -848,8 +848,8 @@ void CCThreadProxy::beginContextRecreation() void CCThreadProxy::tryToRecreateContext() { - DCHECK(isMainThread()); - DCHECK(m_layerTreeHost); + ASSERT(isMainThread()); + ASSERT(m_layerTreeHost); CCLayerTreeHost::RecreateResult result = m_layerTreeHost->recreateContext(); if (result == CCLayerTreeHost::RecreateFailedButTryAgain) m_contextRecreationTimer->startOneShot(contextRecreationTickRate); @@ -860,7 +860,7 @@ void CCThreadProxy::tryToRecreateContext() void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, CCInputHandler* handler) { TRACE_EVENT0("cc", "CCThreadProxy::initializeImplOnImplThread"); - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); const base::TimeDelta displayRefreshInterval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); scoped_ptr<CCFrameRateController> frameRateController; @@ -881,15 +881,15 @@ void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion, CC void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context) { TRACE_EVENT0("cc", "CCThreadProxy::initializeContextOnImplThread"); - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_contextBeforeInitializationOnImplThread = scoped_ptr<CCGraphicsContext>(context).Pass(); } void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread"); - DCHECK(isImplThread()); - DCHECK(m_contextBeforeInitializationOnImplThread.get()); + ASSERT(isImplThread()); + ASSERT(m_contextBeforeInitializationOnImplThread.get()); *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_contextBeforeInitializationOnImplThread.Pass()); if (*initializeSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); @@ -903,7 +903,7 @@ void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completion) { TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_inputHandlerOnImplThread.reset(); m_layerTreeHostImpl.reset(); @@ -913,7 +913,7 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio void CCThreadProxy::setFullRootLayerDamageOnImplThread() { - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHostImpl->setFullRootLayerDamage(); } @@ -925,7 +925,7 @@ size_t CCThreadProxy::maxPartialTextureUpdates() const void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities) { TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(scoped_ptr<CCGraphicsContext>(contextPtr).Pass()); if (*recreateSucceeded) { @@ -937,7 +937,7 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C void CCThreadProxy::renderingStatsOnImplThread(CCCompletionEvent* completion, CCRenderingStats* stats) { - DCHECK(isImplThread()); + ASSERT(isImplThread()); m_layerTreeHostImpl->renderingStats(stats); completion->signal(); } diff --git a/cc/threaded_unittest.cc b/cc/threaded_unittest.cc index 6465fdb..ebeaa70 100644 --- a/cc/threaded_unittest.cc +++ b/cc/threaded_unittest.cc @@ -378,7 +378,7 @@ void CCThreadedTest::postDidAddAnimationToMainThread() void CCThreadedTest::doBeginTest() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_client = MockLayerTreeHostClient::create(this); scoped_refptr<LayerChromium> rootLayer = LayerChromium::create(); @@ -411,13 +411,13 @@ void CCThreadedTest::scheduleComposite() void CCThreadedTest::realEndTest() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); WebKit::Platform::current()->currentThread()->exitRunLoop(); } void CCThreadedTest::dispatchSetNeedsAnimate() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -428,7 +428,7 @@ void CCThreadedTest::dispatchSetNeedsAnimate() void CCThreadedTest::dispatchAddInstantAnimation() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -439,7 +439,7 @@ void CCThreadedTest::dispatchAddInstantAnimation() void CCThreadedTest::dispatchAddAnimation() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -450,7 +450,7 @@ void CCThreadedTest::dispatchAddAnimation() void CCThreadedTest::dispatchSetNeedsAnimateAndCommit() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -463,7 +463,7 @@ void CCThreadedTest::dispatchSetNeedsAnimateAndCommit() void CCThreadedTest::dispatchSetNeedsCommit() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -474,7 +474,7 @@ void CCThreadedTest::dispatchSetNeedsCommit() void CCThreadedTest::dispatchAcquireLayerTextures() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -485,7 +485,7 @@ void CCThreadedTest::dispatchAcquireLayerTextures() void CCThreadedTest::dispatchSetNeedsRedraw() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -496,7 +496,7 @@ void CCThreadedTest::dispatchSetNeedsRedraw() void CCThreadedTest::dispatchSetVisible(bool visible) { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -514,7 +514,7 @@ void CCThreadedTest::dispatchComposite() void CCThreadedTest::dispatchDidAddAnimation() { - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); if (m_finished) return; @@ -534,7 +534,7 @@ void CCThreadedTest::runTest(bool threaded) } else Platform::current()->compositorSupport()->initialize(0); - DCHECK(CCProxy::isMainThread()); + ASSERT(CCProxy::isMainThread()); m_mainThreadProxy = CCScopedThreadProxy::create(CCProxy::mainThread()); initializeSettings(m_settings); diff --git a/cc/throttled_texture_uploader.cc b/cc/throttled_texture_uploader.cc index 2b5bf20..2ad0309 100644 --- a/cc/throttled_texture_uploader.cc +++ b/cc/throttled_texture_uploader.cc @@ -136,7 +136,7 @@ void ThrottledTextureUploader::markPendingUploadsAsNonBlocking() it->get()->markAsNonBlocking(); } - DCHECK(!m_numBlockingTextureUploads); + ASSERT(!m_numBlockingTextureUploads); } double ThrottledTextureUploader::estimatedTexturesPerSecond() @@ -144,7 +144,7 @@ double ThrottledTextureUploader::estimatedTexturesPerSecond() processQueries(); // The history should never be empty because we initialize all elements with an estimate. - DCHECK(m_texturesPerSecondHistory.size() == uploadHistorySize); + ASSERT(m_texturesPerSecondHistory.size() == uploadHistorySize); // Sort the history and use the median as our estimate. std::vector<double> sortedHistory(m_texturesPerSecondHistory.begin(), @@ -199,10 +199,10 @@ void ThrottledTextureUploader::uploadTexture(CCResourceProvider* resourceProvide IntSize destOffset = upload.geometry.destOffset; texture->acquireBackingTexture(resourceProvider); - DCHECK(texture->haveBackingTexture()); + ASSERT(texture->haveBackingTexture()); - DCHECK(resourceProvider->resourceType(texture->resourceId()) == - CCResourceProvider::GLTexture); + ASSERT(resourceProvider->resourceType(texture->resourceId()) == + CCResourceProvider::GLTexture); WebGraphicsContext3D* paintContext = CCProxy::hasImplThread() ? WebSharedGraphicsContext3D::compositorThreadContext() : diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc index 0ffe46c..a5ac33d 100644 --- a/cc/tile_draw_quad.cc +++ b/cc/tile_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCTileDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) @@ -34,7 +32,7 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I const CCTileDrawQuad* CCTileDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::TiledContent); + ASSERT(quad->material() == CCDrawQuad::TiledContent); return static_cast<const CCTileDrawQuad*>(quad); } diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index e7adf54..1ea1e25 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -97,7 +97,7 @@ scoped_ptr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() void TiledLayerChromium::updateTileSizeAndTilingOption() { - DCHECK(layerTreeHost()); + ASSERT(layerTreeHost()); const IntSize& defaultTileSize = layerTreeHost()->settings().defaultTileSize; const IntSize& maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledLayerSize; @@ -309,7 +309,7 @@ void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); - DCHECK(tile); + ASSERT(tile); // FIXME: This should not ever be null. if (!tile) continue; @@ -379,11 +379,11 @@ void TiledLayerChromium::markOcclusionsAndRequestTextures(int left, int top, int for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); - DCHECK(tile); // Did setTexturePriorities get skipped? + ASSERT(tile); // Did setTexturePriorities get skipped? // FIXME: This should not ever be null. if (!tile) continue; - DCHECK(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass? + ASSERT(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass? IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect()); if (occlusion && occlusion->occluded(this, visibleTileRect)) { tile->occluded = true; @@ -407,7 +407,7 @@ bool TiledLayerChromium::haveTexturesForTiles(int left, int top, int right, int for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); - DCHECK(tile); // Did setTexturePriorites get skipped? + ASSERT(tile); // Did setTexturePriorites get skipped? // FIXME: This should not ever be null. if (!tile) continue; @@ -434,7 +434,7 @@ IntRect TiledLayerChromium::markTilesForUpdate(int left, int top, int right, int for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); - DCHECK(tile); // Did setTexturePriorites get skipped? + ASSERT(tile); // Did setTexturePriorites get skipped? // FIXME: This should not ever be null. if (!tile) continue; @@ -466,7 +466,7 @@ void TiledLayerChromium::updateTileTextures(const IntRect& paintRect, int left, for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); - DCHECK(tile); // Did setTexturePriorites get skipped? + ASSERT(tile); // Did setTexturePriorites get skipped? // FIXME: This should not ever be null. if (!tile) continue; @@ -667,7 +667,7 @@ void TiledLayerChromium::resetUpdateState() void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) { - DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped? + ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped? updateBounds(); if (m_tiler->hasEmptyBounds() || !drawsContent()) return; @@ -754,7 +754,7 @@ bool TiledLayerChromium::needsIdlePaint() for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); - DCHECK(tile); // Did setTexturePriorities get skipped? + ASSERT(tile); // Did setTexturePriorities get skipped? if (!tile) continue; diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index 7cd33d2..84af8bc 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -73,9 +73,9 @@ CCTiledLayerImpl::~CCTiledLayerImpl() CCResourceProvider::ResourceId CCTiledLayerImpl::contentsResourceId() const { // This function is only valid for single texture layers, e.g. masks. - DCHECK(m_tiler); - DCHECK(m_tiler->numTilesX() == 1); - DCHECK(m_tiler->numTilesY() == 1); + ASSERT(m_tiler); + ASSERT(m_tiler->numTilesX() == 1); + ASSERT(m_tiler->numTilesY() == 1); DrawableTile* tile = tileAt(0, 0); CCResourceProvider::ResourceId resourceId = tile ? tile->resourceId() : 0; diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index 980ca65..11c4acc 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -101,7 +101,7 @@ public: void updateTextures() { DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; - DCHECK(m_queue); + ASSERT(m_queue); scoped_ptr<CCTextureUpdateController> updateController = CCTextureUpdateController::create( NULL, diff --git a/cc/timer.cc b/cc/timer.cc index b5b9206..089c12b 100644 --- a/cc/timer.cc +++ b/cc/timer.cc @@ -7,7 +7,6 @@ #include "CCTimer.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "CCThread.h" namespace cc { @@ -25,7 +24,7 @@ public: if (!m_timer) return; - DCHECK(m_timer->m_task == this); + ASSERT(m_timer->m_task == this); m_timer->stop(); } diff --git a/cc/tree_synchronizer.cc b/cc/tree_synchronizer.cc index 201d0f4..fdea6e2 100644 --- a/cc/tree_synchronizer.cc +++ b/cc/tree_synchronizer.cc @@ -100,8 +100,8 @@ void TreeSynchronizer::updateScrollbarLayerPointersRecursive(const RawPtrCCLayer iter = newLayers.find(scrollbarLayer->scrollLayerId()); CCLayerImpl* ccScrollLayerImpl = iter != newLayers.end() ? iter->second : NULL; - DCHECK(ccScrollbarLayerImpl); - DCHECK(ccScrollLayerImpl); + ASSERT(ccScrollbarLayerImpl); + ASSERT(ccScrollLayerImpl); if (ccScrollbarLayerImpl->orientation() == WebKit::WebScrollbar::Horizontal) ccScrollLayerImpl->setHorizontalScrollbarLayer(ccScrollbarLayerImpl); diff --git a/cc/unthrottled_texture_uploader.cc b/cc/unthrottled_texture_uploader.cc index e76c805..4aaf6b0 100644 --- a/cc/unthrottled_texture_uploader.cc +++ b/cc/unthrottled_texture_uploader.cc @@ -37,7 +37,7 @@ void UnthrottledTextureUploader::uploadTexture(CCResourceProvider* resourceProvi upload.bitmap->unlockPixels(); } - DCHECK(!upload.picture); + ASSERT(!upload.picture); } } diff --git a/cc/video_layer.cc b/cc/video_layer.cc index 459c6dc..5bf7982 100644 --- a/cc/video_layer.cc +++ b/cc/video_layer.cc @@ -19,7 +19,7 @@ VideoLayerChromium::VideoLayerChromium(WebKit::WebVideoFrameProvider* provider) : LayerChromium() , m_provider(provider) { - DCHECK(m_provider); + ASSERT(m_provider); } VideoLayerChromium::~VideoLayerChromium() diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index cf5c048..dee1360 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -38,24 +38,24 @@ CCVideoLayerImpl::CCVideoLayerImpl(int id, WebKit::WebVideoFrameProvider* provid // thread is blocked. That makes this a thread-safe call to set the video // frame provider client that does not require a lock. The same is true of // the call in the destructor. - DCHECK(CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isMainThreadBlocked()); m_provider->setVideoFrameProviderClient(this); } CCVideoLayerImpl::~CCVideoLayerImpl() { // See comment in constructor for why this doesn't need a lock. - DCHECK(CCProxy::isMainThreadBlocked()); + ASSERT(CCProxy::isMainThreadBlocked()); if (m_provider) { m_provider->setVideoFrameProviderClient(0); m_provider = 0; } freePlaneData(layerTreeHostImpl()->resourceProvider()); -#if CC_DCHECK_ENABLED() +#if !ASSERT_DISABLED for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i) - DCHECK(!m_framePlanes[i].resourceId); - DCHECK(!m_externalTextureResource); + ASSERT(!m_framePlanes[i].resourceId); + ASSERT(!m_externalTextureResource); #endif } @@ -64,7 +64,7 @@ void CCVideoLayerImpl::stopUsingProvider() // Block the provider from shutting down until this client is done // using the frame. base::AutoLock locker(m_providerLock); - DCHECK(!m_frame); + ASSERT(!m_frame); m_provider = 0; } @@ -88,7 +88,7 @@ static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); CCLayerImpl::willDraw(resourceProvider); // Explicitly acquire and release the provider mutex so it can be held from @@ -109,8 +109,8 @@ void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); - DCHECK(!m_externalTextureResource); + ASSERT(CCProxy::isImplThread()); + ASSERT(!m_externalTextureResource); if (!m_provider) { m_frame = 0; @@ -154,7 +154,7 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); if (!m_frame) return; @@ -217,18 +217,18 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) { - DCHECK(CCProxy::isImplThread()); + ASSERT(CCProxy::isImplThread()); CCLayerImpl::didDraw(resourceProvider); if (!m_frame) return; if (m_format == GraphicsContext3D::TEXTURE_2D) { - DCHECK(m_externalTextureResource); + ASSERT(m_externalTextureResource); // FIXME: the following assert will not be true when sending resources to a // parent compositor. We will probably need to hold on to m_frame for // longer, and have several "current frames" in the pipeline. - DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource)); + ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource)); resourceProvider->deleteResource(m_externalTextureResource); m_externalTextureResource = 0; } diff --git a/cc/yuv_video_draw_quad.cc b/cc/yuv_video_draw_quad.cc index eec671b..41d5490 100644 --- a/cc/yuv_video_draw_quad.cc +++ b/cc/yuv_video_draw_quad.cc @@ -6,8 +6,6 @@ #include "CCYUVVideoDrawQuad.h" -#include "base/logging.h" - namespace cc { scoped_ptr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) @@ -25,7 +23,7 @@ CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const CCDrawQuad* quad) { - DCHECK(quad->material() == CCDrawQuad::YUVVideoContent); + ASSERT(quad->material() == CCDrawQuad::YUVVideoContent); return static_cast<const CCYUVVideoDrawQuad*>(quad); } |