summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/DEPS2
-rw-r--r--cc/animation_curve.cc6
-rw-r--r--cc/caching_bitmap_canvas_layer_texture_updater.cc2
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/checkerboard_draw_quad.cc4
-rw-r--r--cc/completion_event.h17
-rw-r--r--cc/damage_tracker.cc4
-rw-r--r--cc/dcheck.h18
-rw-r--r--cc/debug_border_draw_quad.cc4
-rw-r--r--cc/debug_rect_history.cc6
-rw-r--r--cc/delay_based_time_source.cc7
-rw-r--r--cc/delegated_renderer_layer_impl.cc20
-rw-r--r--cc/direct_renderer.cc6
-rw-r--r--cc/draw_quad.cc9
-rw-r--r--cc/font_atlas.cc6
-rw-r--r--cc/frame_rate_controller.cc7
-rw-r--r--cc/frame_rate_counter.cc3
-rw-r--r--cc/gl_renderer.cc88
-rw-r--r--cc/gl_renderer.h2
-rw-r--r--cc/gl_renderer_unittest.cc8
-rw-r--r--cc/heads_up_display_layer_impl.cc4
-rw-r--r--cc/io_surface_draw_quad.cc4
-rw-r--r--cc/keyframed_animation_curve.cc2
-rw-r--r--cc/layer.cc10
-rw-r--r--cc/layer.h2
-rw-r--r--cc/layer_animation_controller.cc5
-rw-r--r--cc/layer_impl.cc24
-rw-r--r--cc/layer_impl.h5
-rw-r--r--cc/layer_iterator.h2
-rw-r--r--cc/layer_quad.cc4
-rw-r--r--cc/layer_sorter.cc57
-rw-r--r--cc/layer_texture_sub_image.cc2
-rw-r--r--cc/layer_tiling_data.cc6
-rw-r--r--cc/layer_tree_host.cc34
-rw-r--r--cc/layer_tree_host_common.cc18
-rw-r--r--cc/layer_tree_host_common_unittest.cc4
-rw-r--r--cc/layer_tree_host_impl.cc56
-rw-r--r--cc/layer_tree_host_impl_unittest.cc12
-rw-r--r--cc/layer_tree_host_unittest.cc16
-rw-r--r--cc/math_util.cc6
-rw-r--r--cc/math_util.h5
-rw-r--r--cc/occlusion_tracker.cc24
-rw-r--r--cc/occlusion_tracker_unittest.cc10
-rw-r--r--cc/platform_color.h4
-rw-r--r--cc/prioritized_texture.cc44
-rw-r--r--cc/prioritized_texture.h3
-rw-r--r--cc/prioritized_texture_manager.cc100
-rw-r--r--cc/prioritized_texture_manager.h2
-rw-r--r--cc/prioritized_texture_unittest.cc2
-rw-r--r--cc/program_binding.cc25
-rw-r--r--cc/program_binding.h10
-rw-r--r--cc/proxy.cc10
-rw-r--r--cc/proxy.h13
-rw-r--r--cc/quad_culler.cc8
-rw-r--r--cc/rate_limiter.cc2
-rw-r--r--cc/render_pass.cc8
-rw-r--r--cc/render_pass_draw_quad.cc8
-rw-r--r--cc/render_surface_filters.cc5
-rw-r--r--cc/render_surface_impl.cc11
-rw-r--r--cc/resource_provider.cc122
-rw-r--r--cc/resource_provider_unittest.cc75
-rw-r--r--cc/scheduler.cc7
-rw-r--r--cc/scheduler_state_machine.cc22
-rw-r--r--cc/scheduler_unittest.cc5
-rw-r--r--cc/scoped_ptr_hash_map.h5
-rw-r--r--cc/scoped_ptr_vector.h13
-rw-r--r--cc/scoped_texture.cc10
-rw-r--r--cc/scoped_texture.h5
-rw-r--r--cc/scoped_thread_proxy.h9
-rw-r--r--cc/scrollbar_layer.cc2
-rw-r--r--cc/shader.cc33
-rw-r--r--cc/single_thread_proxy.cc48
-rw-r--r--cc/single_thread_proxy.h10
-rw-r--r--cc/software_renderer.cc4
-rw-r--r--cc/solid_color_draw_quad.cc4
-rw-r--r--cc/stream_video_draw_quad.cc4
-rw-r--r--cc/stubs/config.h17
-rw-r--r--cc/stubs/trace_event.h5
-rw-r--r--cc/test/fake_web_compositor_output_surface.h3
-rw-r--r--cc/test/fake_web_compositor_software_output_device.h3
-rw-r--r--cc/test/scheduler_test_common.cc4
-rw-r--r--cc/test/scheduler_test_common.h4
-rw-r--r--cc/texture_copier.cc2
-rw-r--r--cc/texture_draw_quad.cc4
-rw-r--r--cc/texture_layer_impl.cc4
-rw-r--r--cc/thread_proxy.cc140
-rw-r--r--cc/threaded_unittest.cc24
-rw-r--r--cc/throttled_texture_uploader.cc10
-rw-r--r--cc/tile_draw_quad.cc4
-rw-r--r--cc/tiled_layer.cc18
-rw-r--r--cc/tiled_layer_impl.cc6
-rw-r--r--cc/tiled_layer_unittest.cc2
-rw-r--r--cc/timer.cc3
-rw-r--r--cc/tree_synchronizer.cc4
-rw-r--r--cc/unthrottled_texture_uploader.cc2
-rw-r--r--cc/video_layer.cc2
-rw-r--r--cc/video_layer_impl.cc26
-rw-r--r--cc/yuv_video_draw_quad.cc4
98 files changed, 760 insertions, 697 deletions
diff --git a/cc/DEPS b/cc/DEPS
index 32e11cc..33e133e 100644
--- a/cc/DEPS
+++ b/cc/DEPS
@@ -21,6 +21,8 @@ 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 7cd0158..c2c3dc0 100644
--- a/cc/animation_curve.cc
+++ b/cc/animation_curve.cc
@@ -6,11 +6,13 @@
#include "CCAnimationCurve.h"
+#include "base/logging.h"
+
namespace cc {
const CCFloatAnimationCurve* CCAnimationCurve::toFloatAnimationCurve() const
{
- ASSERT(type() == CCAnimationCurve::Float);
+ DCHECK(type() == CCAnimationCurve::Float);
return static_cast<const CCFloatAnimationCurve*>(this);
}
@@ -21,7 +23,7 @@ CCAnimationCurve::Type CCFloatAnimationCurve::type() const
const CCTransformAnimationCurve* CCAnimationCurve::toTransformAnimationCurve() const
{
- ASSERT(type() == CCAnimationCurve::Transform);
+ DCHECK(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 a8a8483..6e82c24 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);
- ASSERT(new_bitmap.bytesPerPixel() > 0);
+ DCHECK(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() ||
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 45d7ed6..3507f0b 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -5,6 +5,7 @@
{
'variables': {
'cc_source_files': [
+ 'dcheck.h',
'hash_pair.h',
'scoped_ptr_hash_map.h',
'scoped_ptr_vector.h',
@@ -355,6 +356,7 @@
'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 f1b34a3..cba8813 100644
--- a/cc/checkerboard_draw_quad.cc
+++ b/cc/checkerboard_draw_quad.cc
@@ -6,6 +6,8 @@
#include "CCCheckerboardDrawQuad.h"
+#include "base/logging.h"
+
namespace cc {
scoped_ptr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
@@ -21,7 +23,7 @@ CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQu
const CCCheckerboardDrawQuad* CCCheckerboardDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::Checkerboard);
+ DCHECK(quad->material() == CCDrawQuad::Checkerboard);
return static_cast<const CCCheckerboardDrawQuad*>(quad);
}
diff --git a/cc/completion_event.h b/cc/completion_event.h
index 795b030..8113fab 100644
--- a/cc/completion_event.h
+++ b/cc/completion_event.h
@@ -7,6 +7,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread_restrictions.h"
+#include "cc/dcheck.h"
namespace cc {
@@ -19,7 +20,7 @@ public:
CCCompletionEvent()
: m_event(false /* manual_reset */, false /* initially_signaled */)
{
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
m_waited = false;
m_signaled = false;
#endif
@@ -27,14 +28,14 @@ public:
~CCCompletionEvent()
{
- ASSERT(m_waited);
- ASSERT(m_signaled);
+ DCHECK(m_waited);
+ DCHECK(m_signaled);
}
void wait()
{
- ASSERT(!m_waited);
-#ifndef NDEBUG
+ DCHECK(!m_waited);
+#if CC_DCHECK_ENABLED()
m_waited = true;
#endif
base::ThreadRestrictions::ScopedAllowWait allow_wait;
@@ -43,8 +44,8 @@ public:
void signal()
{
- ASSERT(!m_signaled);
-#ifndef NDEBUG
+ DCHECK(!m_signaled);
+#if CC_DCHECK_ENABLED()
m_signaled = true;
#endif
m_event.Signal();
@@ -52,7 +53,7 @@ public:
private:
base::WaitableEvent m_event;
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
// 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 12901292..f6ad5fb 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.
- ASSERT(layerID > 0);
- ASSERT(m_nextRectHistory->find(layerID) == m_nextRectHistory->end());
+ DCHECK(layerID > 0);
+ DCHECK(m_nextRectHistory->find(layerID) == m_nextRectHistory->end());
(*m_nextRectHistory)[layerID] = targetSpaceRect;
}
diff --git a/cc/dcheck.h b/cc/dcheck.h
new file mode 100644
index 0000000..acd3c90
--- /dev/null
+++ b/cc/dcheck.h
@@ -0,0 +1,18 @@
+// 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 aabf9e2..a8b9d35 100644
--- a/cc/debug_border_draw_quad.cc
+++ b/cc/debug_border_draw_quad.cc
@@ -6,6 +6,8 @@
#include "CCDebugBorderDrawQuad.h"
+#include "base/logging.h"
+
namespace cc {
scoped_ptr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width)
@@ -25,7 +27,7 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad
const CCDebugBorderDrawQuad* CCDebugBorderDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::DebugBorder);
+ DCHECK(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 17fda21..7ff9f75 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();
- ASSERT(renderSurface);
+ DCHECK(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();
- ASSERT(renderSurface);
+ DCHECK(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();
- ASSERT(renderSurface);
+ DCHECK(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 be0b10b..ca02564 100644
--- a/cc/delay_based_time_source.cc
+++ b/cc/delay_based_time_source.cc
@@ -6,6 +6,7 @@
#include "CCDelayBasedTimeSource.h"
+#include "base/logging.h"
#include "TraceEvent.h"
#include <algorithm>
#include <wtf/CurrentTime.h>
@@ -91,7 +92,7 @@ base::TimeTicks CCDelayBasedTimeSource::nextTickTime()
void CCDelayBasedTimeSource::onTimerFired()
{
- ASSERT(m_state != STATE_INACTIVE);
+ DCHECK(m_state != STATE_INACTIVE);
base::TimeTicks now = this->now();
m_lastTickTime = now;
@@ -203,7 +204,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;
- ASSERT(newTickTarget > now);
+ DCHECK(newTickTarget > now);
// Avoid double ticks when:
// 1) Turning off the timer and turning it right back on.
@@ -220,7 +221,7 @@ void CCDelayBasedTimeSource::postNextTickTask(base::TimeTicks now)
// Post another task *before* the tick and update state
base::TimeDelta delay = newTickTarget - now;
- ASSERT(delay.InMillisecondsF() <=
+ DCHECK(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 02d5698..b6d1ab6 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);
- ASSERT(it != m_renderPassesIndexById.end());
+ DCHECK(it != m_renderPassesIndexById.end());
unsigned delegatedRenderPassIndex = it->second;
return CCRenderPass::Id(id(), indexToId(delegatedRenderPassIndex));
}
void CCDelegatedRendererLayerImpl::appendContributingRenderPasses(CCRenderPassSink& renderPassSink)
{
- ASSERT(hasContributingDelegatedRenderPasses());
+ DCHECK(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.
- ASSERT(outputRenderPassId.index > 0);
+ DCHECK(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.
- ASSERT(targetRenderPassId.layerId == renderTarget()->id());
+ DCHECK(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.
- ASSERT(targetRenderPassId.layerId == id());
+ DCHECK(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.
- ASSERT(delegatedRenderPass == m_renderPassesInDrawOrder.last());
+ DCHECK(delegatedRenderPass == m_renderPassesInDrawOrder.last());
// This layer must be drawing to a renderTarget other than itself.
- ASSERT(renderTarget() != this);
+ DCHECK(renderTarget() != this);
copiedSharedQuadState->clippedRectInTarget = CCMathUtil::mapClippedRect(drawTransform(), copiedSharedQuadState->clippedRectInTarget);
copiedSharedQuadState->quadTransform = copiedSharedQuadState->quadTransform * drawTransform();
copiedSharedQuadState->opacity *= drawOpacity();
}
}
- ASSERT(copiedSharedQuadState);
+ DCHECK(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);
- ASSERT(contributingRenderPassId != appendQuadsData.renderPassId);
+ DCHECK(contributingRenderPassId != appendQuadsData.renderPassId);
copyQuad = CCRenderPassDrawQuad::materialCast(quad)->copy(copiedSharedQuadState, contributingRenderPassId).PassAs<CCDrawQuad>();
}
- ASSERT(copyQuad.get());
+ DCHECK(copyQuad.get());
quadSink.append(copyQuad.Pass(), appendQuadsData);
}
diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc
index 23fa1d3..68deadb 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;
- ASSERT(texture);
+ DCHECK(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();
- ASSERT(rootRenderPass);
+ DCHECK(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());
- ASSERT(texture);
+ DCHECK(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 b88eac6..999b0aa 100644
--- a/cc/draw_quad.cc
+++ b/cc/draw_quad.cc
@@ -5,6 +5,7 @@
#include "config.h"
#include "CCDrawQuad.h"
+#include "base/logging.h"
#include "CCCheckerboardDrawQuad.h"
#include "CCDebugBorderDrawQuad.h"
#include "CCIOSurfaceDrawQuad.h"
@@ -27,8 +28,8 @@ CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material materi
, m_quadOpaque(true)
, m_needsBlending(false)
{
- ASSERT(m_sharedQuadState);
- ASSERT(m_material != Invalid);
+ DCHECK(m_sharedQuadState);
+ DCHECK(m_material != Invalid);
}
IntRect CCDrawQuad::opaqueRect() const
@@ -79,10 +80,10 @@ unsigned CCDrawQuad::size() const
scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQuadState) const
{
// RenderPass quads have their own copy() method.
- ASSERT(material() != RenderPass);
+ DCHECK(material() != RenderPass);
unsigned bytes = size();
- ASSERT(bytes);
+ DCHECK(bytes > 0);
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 20ed9df..9a48300 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
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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 c996ebd..c154226 100644
--- a/cc/frame_rate_controller.cc
+++ b/cc/frame_rate_controller.cc
@@ -6,6 +6,7 @@
#include "CCFrameRateController.h"
+#include "base/logging.h"
#include "CCDelayBasedTimeSource.h"
#include "CCTimeSource.h"
#include "TraceEvent.h"
@@ -88,7 +89,7 @@ void CCFrameRateController::setActive(bool active)
void CCFrameRateController::setMaxFramesPending(int maxFramesPending)
{
- ASSERT(maxFramesPending > 0);
+ DCHECK(maxFramesPending > 0);
m_maxFramesPending = maxFramesPending;
}
@@ -105,7 +106,7 @@ void CCFrameRateController::setSwapBuffersCompleteSupported(bool supported)
void CCFrameRateController::onTimerTick()
{
- ASSERT(m_active);
+ DCHECK(m_active);
// Check if we have too many frames in flight.
bool throttled = m_numFramesPending >= m_maxFramesPending;
@@ -138,7 +139,7 @@ void CCFrameRateController::didBeginFrame()
void CCFrameRateController::didFinishFrame()
{
- ASSERT(m_swapBuffersCompleteSupported);
+ DCHECK(m_swapBuffersCompleteSupported);
m_numFramesPending--;
if (!m_isTimeSourceThrottling)
diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc
index a02486b..898086c 100644
--- a/cc/frame_rate_counter.cc
+++ b/cc/frame_rate_counter.cc
@@ -126,7 +126,8 @@ void CCFrameRateCounter::getAverageFPSAndStandardDeviation(double& averageFPS, d
base::TimeTicks CCFrameRateCounter::timeStampOfRecentFrame(int n)
{
- ASSERT(n >= 0 && n < kTimeStampHistorySize);
+ DCHECK(n >= 0);
+ DCHECK(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 f76863e..9755b27 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -21,11 +21,9 @@
#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"
@@ -79,7 +77,7 @@ CCRendererGL::CCRendererGL(CCRendererClient* client,
, m_isUsingBindUniform(false)
, m_visible(true)
{
- ASSERT(m_context);
+ DCHECK(m_context);
}
bool CCRendererGL::initialize()
@@ -115,7 +113,7 @@ bool CCRendererGL::initialize()
m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibility");
if (extensions.count("GL_CHROMIUM_iosurface"))
- ASSERT(extensions.count("GL_ARB_texture_rectangle"));
+ DCHECK(extensions.count("GL_ARB_texture_rectangle"));
m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_memory_manager");
if (m_capabilities.usingGpuMemoryManager)
@@ -140,7 +138,7 @@ bool CCRendererGL::initialize()
CCRendererGL::~CCRendererGL()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
m_context->setSwapBuffersCompleteCallbackCHROMIUM(0);
m_context->setMemoryAllocationChangedCallbackCHROMIUM(0);
m_context->setContextLostCallback(0);
@@ -161,7 +159,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: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error));
+ LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line << "\n\tcommand: " << command << ", error " << static_cast<int>(error) << "\n";
}
void CCRendererGL::setVisible(bool visible)
@@ -194,7 +192,7 @@ void CCRendererGL::clearFramebuffer(DrawingFrame& frame)
else
GLC(m_context, m_context->clearColor(0, 0, 1, 1));
-#if defined(NDEBUG)
+#if !CC_DCHECK_ENABLED()
if (frame.currentRenderPass->hasTransparentBackground())
#endif
m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
@@ -243,7 +241,7 @@ void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad)
switch (quad->material()) {
case CCDrawQuad::Invalid:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
case CCDrawQuad::Checkerboard:
drawCheckerboardQuad(frame, CCCheckerboardDrawQuad::materialCast(quad));
@@ -278,7 +276,7 @@ void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad)
void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheckerboardDrawQuad* quad)
{
const TileCheckerboardProgram* program = tileCheckerboardProgram();
- ASSERT(program && program->initialized());
+ DCHECK(program && program->initialized());
GLC(context(), context()->useProgram(program->program()));
SkColor color = quad->color();
@@ -304,7 +302,7 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB
{
static float glMatrix[16];
const SolidColorProgram* program = solidColorProgram();
- ASSERT(program && program->initialized());
+ DCHECK(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.
@@ -369,7 +367,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>();
- ASSERT(!frame.currentTexture);
+ DCHECK(!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()));
@@ -422,7 +420,7 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra
return;
const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPassId());
- ASSERT(renderPass);
+ DCHECK(renderPass);
if (!renderPass)
return;
@@ -451,14 +449,14 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra
// Draw the background texture if there is one.
if (backgroundTexture) {
- ASSERT(backgroundTexture->size() == quad->quadRect().size());
+ DCHECK(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);
- ASSERT(!clipped);
+ DCHECK(!clipped);
CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox()));
CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad);
@@ -529,8 +527,8 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra
}
if (shaderMaskSamplerLocation != -1) {
- ASSERT(shaderMaskTexCoordScaleLocation != 1);
- ASSERT(shaderMaskTexCoordOffsetLocation != 1);
+ DCHECK(shaderMaskTexCoordScaleLocation != 1);
+ DCHECK(shaderMaskTexCoordOffsetLocation != 1);
GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1));
GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1));
GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, quad->maskTexCoordScaleX(), quad->maskTexCoordScaleY()));
@@ -548,7 +546,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);
- ASSERT(!clipped);
+ DCHECK(!clipped);
setShaderOpacity(quad->opacity(), shaderAlphaLocation);
setShaderFloatQuad(surfaceQuad, shaderQuadLocation);
@@ -636,7 +634,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
bool clipped = false;
FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped);
- ASSERT(!clipped);
+ DCHECK(!clipped);
TileProgramUniforms uniforms;
// For now, we simply skip anti-aliasing with the quad is clipped. This only happens
@@ -691,13 +689,13 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
// Map points to device space.
bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped);
- ASSERT(!clipped);
+ DCHECK(!clipped);
bottomLeft = CCMathUtil::mapPoint(deviceTransform, bottomLeft, clipped);
- ASSERT(!clipped);
+ DCHECK(!clipped);
topLeft = CCMathUtil::mapPoint(deviceTransform, topLeft, clipped);
- ASSERT(!clipped);
+ DCHECK(!clipped);
topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped);
- ASSERT(!clipped);
+ DCHECK(!clipped);
CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
CCLayerQuad::Edge leftEdge(bottomLeft, topLeft);
@@ -727,7 +725,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse();
localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped);
- // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
+ // We should not DCHECK(!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
@@ -764,7 +762,7 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad*
void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoDrawQuad* quad)
{
const VideoYUVProgram* program = videoYUVProgram();
- ASSERT(program && program->initialized());
+ DCHECK(program && program->initialized());
const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane();
const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane();
@@ -825,7 +823,7 @@ void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream
{
static float glMatrix[16];
- ASSERT(m_capabilities.usingEglImage);
+ DCHECK(m_capabilities.usingEglImage);
const VideoStreamTextureProgram* program = videoStreamTextureProgram();
GLC(context(), context()->useProgram(program->program()));
@@ -845,7 +843,7 @@ void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream
struct TextureProgramBinding {
template<class Program> void set(Program* program)
{
- ASSERT(program && program->initialized());
+ DCHECK(program && program->initialized());
programId = program->program();
samplerLocation = program->fragmentShader().samplerLocation();
matrixLocation = program->vertexShader().matrixLocation();
@@ -868,7 +866,7 @@ struct TexTransformTextureProgramBinding : TextureProgramBinding {
void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDrawQuad* quad)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
TexTransformTextureProgramBinding binding;
if (quad->flipped())
@@ -912,7 +910,7 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra
void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
TexTransformTextureProgramBinding binding;
binding.set(textureIOSurfaceProgram());
@@ -1025,8 +1023,8 @@ void CCRendererGL::finish()
bool CCRendererGL::swapBuffers()
{
- ASSERT(m_visible);
- ASSERT(!m_isFramebufferDiscarded);
+ DCHECK(m_visible);
+ DCHECK(!m_isFramebufferDiscarded);
TRACE_EVENT0("cc", "CCRendererGL::swapBuffers");
// We're done! Time to swapbuffers!
@@ -1056,11 +1054,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()) {
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
DebugScopedSetImplThread impl;
onMemoryAllocationChangedOnImplThread(allocation);
} else {
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
onMemoryAllocationChangedOnImplThread(allocation);
}
}
@@ -1117,7 +1115,8 @@ void CCRendererGL::onContextLost()
void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect)
{
- ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight());
+ DCHECK(rect.maxX() <= viewportWidth());
+ DCHECK(rect.maxY() <= viewportHeight());
if (!pixels)
return;
@@ -1148,7 +1147,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));
- ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
+ DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
}
scoped_array<uint8_t> srcPixels(new uint8_t[rect.width() * rect.height() * 4]);
@@ -1190,7 +1189,7 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect)
bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect)
{
- ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB));
+ DCHECK(!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;
@@ -1204,7 +1203,7 @@ bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect
bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect)
{
- ASSERT(texture->id());
+ DCHECK(texture->id());
frame.currentRenderPass = 0;
frame.currentTexture = texture;
@@ -1219,19 +1218,14 @@ void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame)
bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect)
{
- ASSERT(texture->id());
+ DCHECK(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));
-#if !defined ( NDEBUG )
- if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
- ASSERT_NOT_REACHED();
- return false;
- }
-#endif
+ DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
initializeMatrices(frame, framebufferRect, false);
setDrawViewportSize(framebufferRect.size());
@@ -1304,7 +1298,7 @@ const CCRendererGL::SolidColorProgram* CCRendererGL::solidColorProgram()
const CCRendererGL::RenderPassProgram* CCRendererGL::renderPassProgram()
{
- ASSERT(m_renderPassProgram);
+ DCHECK(m_renderPassProgram);
if (!m_renderPassProgram->initialized()) {
TRACE_EVENT0("cc", "CCRendererGL::renderPassProgram::initialize");
m_renderPassProgram->initialize(m_context, m_isUsingBindUniform);
@@ -1347,7 +1341,7 @@ const CCRendererGL::RenderPassMaskProgramAA* CCRendererGL::renderPassMaskProgram
const CCRendererGL::TileProgram* CCRendererGL::tileProgram()
{
- ASSERT(m_tileProgram);
+ DCHECK(m_tileProgram);
if (!m_tileProgram->initialized()) {
TRACE_EVENT0("cc", "CCRendererGL::tileProgram::initialize");
m_tileProgram->initialize(m_context, m_isUsingBindUniform);
@@ -1357,7 +1351,7 @@ const CCRendererGL::TileProgram* CCRendererGL::tileProgram()
const CCRendererGL::TileProgramOpaque* CCRendererGL::tileProgramOpaque()
{
- ASSERT(m_tileProgramOpaque);
+ DCHECK(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 caf7495..58ba1f0 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 1b64595..af9ee7e 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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
*value = 1;
#else
ADD_FAILURE();
@@ -260,7 +260,7 @@ public:
virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value)
{
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
*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 defined(NDEBUG)
+#if CC_DCHECK_ENABLED()
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 4b64b1a..c6a46b8 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());
- ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config);
+ DCHECK(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.
- ASSERT(!resourceProvider->inUseByConsumer(m_hudTexture->id()));
+ DCHECK(!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 5d50043..2cd2ca6 100644
--- a/cc/io_surface_draw_quad.cc
+++ b/cc/io_surface_draw_quad.cc
@@ -6,6 +6,8 @@
#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)
@@ -23,7 +25,7 @@ CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadStat
const CCIOSurfaceDrawQuad* CCIOSurfaceDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::IOSurfaceContent);
+ DCHECK(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 a6b368e..b536095 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)
{
- ASSERT(timingFunction);
+ DCHECK(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 a7b74c8..85a5221 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.
- ASSERT(!parent());
+ DCHECK(!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)
{
- ASSERT(!layer || !layer->hasAncestor(this));
+ DCHECK(!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) {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return;
}
@@ -234,7 +234,7 @@ void LayerChromium::removeAllChildren()
{
while (m_children.size()) {
LayerChromium* layer = m_children[0].get();
- ASSERT(layer->parent());
+ DCHECK(layer->parent());
layer->removeFromParent();
}
}
@@ -654,7 +654,7 @@ void LayerChromium::setBoundsContainPageScale(bool boundsContainPageScale)
void LayerChromium::createRenderSurface()
{
- ASSERT(!m_renderSurface);
+ DCHECK(!m_renderSurface);
m_renderSurface = make_scoped_ptr(new RenderSurfaceChromium(this));
setRenderTarget(this);
}
diff --git a/cc/layer.h b/cc/layer.h
index 0dd140f..cfb80b0 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -202,7 +202,7 @@ public:
bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
- LayerChromium* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
+ LayerChromium* renderTarget() const { DCHECK(!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 2025db8..20e4984 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));
- ASSERT(!toAdd->needsSynchronizedStartTime());
+ DCHECK(!toAdd->needsSynchronizedStartTime());
controllerImpl->addAnimation(toAdd.Pass());
}
}
@@ -397,8 +397,7 @@ void CCLayerAnimationController::tickAnimations(double monotonicTime)
// Do nothing for sentinel value.
case CCActiveAnimation::TargetPropertyEnumSize:
- ASSERT_NOT_REACHED();
-
+ NOTREACHED();
}
}
}
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 2b30363..a7307a5 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -54,21 +54,19 @@ CCLayerImpl::CCLayerImpl(int id)
, m_debugBorderWidth(0)
, m_drawTransformIsAnimating(false)
, m_screenSpaceTransformIsAnimating(false)
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
, m_betweenWillDrawAndDidDraw(false)
#endif
, m_layerAnimationController(CCLayerAnimationController::create(this))
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(m_layerId > 0);
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(m_layerId > 0);
}
CCLayerImpl::~CCLayerImpl()
{
- ASSERT(CCProxy::isImplThread());
-#ifndef NDEBUG
- ASSERT(!m_betweenWillDrawAndDidDraw);
-#endif
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(!m_betweenWillDrawAndDidDraw);
}
void CCLayerImpl::addChild(scoped_ptr<CCLayerImpl> child)
@@ -106,7 +104,7 @@ void CCLayerImpl::clearChildList()
void CCLayerImpl::createRenderSurface()
{
- ASSERT(!m_renderSurface);
+ DCHECK(!m_renderSurface);
m_renderSurface = make_scoped_ptr(new CCRenderSurface(this));
setRenderTarget(this);
}
@@ -127,17 +125,17 @@ scoped_ptr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const
void CCLayerImpl::willDraw(CCResourceProvider*)
{
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
// willDraw/didDraw must be matched.
- ASSERT(!m_betweenWillDrawAndDidDraw);
+ DCHECK(!m_betweenWillDrawAndDidDraw);
m_betweenWillDrawAndDidDraw = true;
#endif
}
void CCLayerImpl::didDraw(CCResourceProvider*)
{
-#ifndef NDEBUG
- ASSERT(m_betweenWillDrawAndDidDraw);
+#if CC_DCHECK_ENABLED()
+ DCHECK(m_betweenWillDrawAndDidDraw);
m_betweenWillDrawAndDidDraw = false;
#endif
}
@@ -168,7 +166,7 @@ CCRenderPass::Id CCLayerImpl::nextContributingRenderPassId(CCRenderPass::Id) con
CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const
{
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return 0;
}
diff --git a/cc/layer_impl.h b/cc/layer_impl.h
index 01ab13a..b2b5988 100644
--- a/cc/layer_impl.h
+++ b/cc/layer_impl.h
@@ -6,6 +6,7 @@
#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"
@@ -160,7 +161,7 @@ public:
bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
- CCLayerImpl* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
+ CCLayerImpl* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
void setRenderTarget(CCLayerImpl* target) { m_renderTarget = target; }
void setBounds(const IntSize&);
@@ -367,7 +368,7 @@ private:
bool m_drawTransformIsAnimating;
bool m_screenSpaceTransformIsAnimating;
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
bool m_betweenWillDrawAndDidDraw;
#endif
diff --git a/cc/layer_iterator.h b/cc/layer_iterator.h
index 4d36080..dbfac53 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()) {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
m_actions.end(*this);
return;
}
diff --git a/cc/layer_quad.cc b/cc/layer_quad.cc
index 08c16bb..c7cc42c 100644
--- a/cc/layer_quad.cc
+++ b/cc/layer_quad.cc
@@ -7,11 +7,13 @@
#include "CCLayerQuad.h"
+#include "base/logging.h"
+
namespace cc {
CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q)
{
- ASSERT(p != q);
+ DCHECK(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 cf85777..f5aef04 100644
--- a/cc/layer_sorter.cc
+++ b/cc/layer_sorter.cc
@@ -6,25 +6,18 @@
#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 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
+#define SHOW_DEBUG_LOG 0 && !defined(NDEBUG)
namespace cc {
@@ -223,8 +216,8 @@ float CCLayerSorter::LayerShape::layerZFromProjectedPoint(const FloatPoint& p) c
void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::iterator last)
{
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Creating graph nodes:\n");
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: Creating graph nodes:\n";
#endif
float minZ = FLT_MAX;
float maxZ = -FLT_MAX;
@@ -235,8 +228,8 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera
if (!node.layer->drawsContent() && !renderSurface)
continue;
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Layer %d (%d x %d)\n", node.layer->id(), node.layer->bounds().width(), node.layer->bounds().height());
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: Layer " << node.layer->id() << " (" << node.layer->bounds().width() << " x " << node.layer->bounds().height() << ")\n";
#endif
WebTransformationMatrix drawTransform;
@@ -262,8 +255,8 @@ void CCLayerSorter::createGraphNodes(LayerList::iterator first, LayerList::itera
void CCLayerSorter::createGraphEdges()
{
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Edges:\n");
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: Edges:\n";
#endif
// Fraction of the total zRange below which z differences
// are not considered reliable.
@@ -291,8 +284,8 @@ void CCLayerSorter::createGraphEdges()
}
if (startNode) {
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "%d -> %d\n", startNode->layer->id(), endNode->layer->id());
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: " << startNode->layer->id() << " -> " << endNode->layer->id() << "\n";
#endif
m_edges.append(GraphEdge(startNode, endNode, weight));
}
@@ -313,9 +306,9 @@ void CCLayerSorter::createGraphEdges()
void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list)
{
size_t edgeIndex = list.find(edge);
- ASSERT(edgeIndex != notFound);
+ DCHECK(edgeIndex != notFound);
if (list.size() == 1) {
- ASSERT(!edgeIndex);
+ DCHECK(!edgeIndex);
list.clear();
return;
}
@@ -346,8 +339,8 @@ void CCLayerSorter::removeEdgeFromList(GraphEdge* edge, Vector<GraphEdge*>& list
//
void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
{
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Sorting start ----\n");
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: Sorting start ----\n";
#endif
createGraphNodes(first, last);
@@ -362,8 +355,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
noIncomingEdgeNodeList.append(la);
}
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Sorted list: ");
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "CCLayerSorter: Sorted list: ";
#endif
while (m_activeEdges.size() || noIncomingEdgeNodeList.size()) {
while (noIncomingEdgeNodeList.size()) {
@@ -377,8 +370,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
// Add it to the final list.
sortedList.append(fromNode);
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "%d, ", fromNode->layer->id());
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << fromNode->layer->id() << ", ";
#endif
// Remove all its outgoing edges from the graph.
@@ -411,7 +404,7 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
nextNode = &m_nodes[i];
}
}
- ASSERT(nextNode);
+ DCHECK(nextNode);
// Remove all its incoming edges.
for (unsigned e = 0; e < nextNode->incoming.size(); e++) {
GraphEdge* incomingEdge = nextNode->incoming[e];
@@ -422,8 +415,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
nextNode->incoming.clear();
nextNode->incomingEdgeWeight = 0;
noIncomingEdgeNodeList.append(nextNode);
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Breaking cycle by cleaning up incoming edges from %d (weight = %f)\n", nextNode->layer->id(), minIncomingEdgeWeight);
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "Breaking cycle by cleaning up incoming edges from " << nextNode->layer->id() << " (weight = " << minIncomingEdgeWeight<< ")\n";
#endif
}
@@ -433,8 +426,8 @@ void CCLayerSorter::sort(LayerList::iterator first, LayerList::iterator last)
for (LayerList::iterator it = first; it < last; it++)
*it = sortedList[count++]->layer;
-#if !defined( NDEBUG )
- LOG(CCLayerSorter, "Sorting end ----\n");
+#if SHOW_DEBUG_LOG
+ DLOG(INFO) << "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 da27507..fd48528 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:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
unsigned int bytesPerComponent = 1;
diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc
index 2e6eaab..63750b1 100644
--- a/cc/layer_tiling_data.cc
+++ b/cc/layer_tiling_data.cc
@@ -7,6 +7,8 @@
#include "CCLayerTilingData.h"
+#include "base/logging.h"
+
using namespace std;
namespace cc {
@@ -60,7 +62,7 @@ const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& t
void CCLayerTilingData::addTile(scoped_ptr<Tile> tile, int i, int j)
{
- ASSERT(!tileAt(i, j));
+ DCHECK(!tileAt(i, j));
tile->moveTo(i, j);
m_tiles.add(make_pair(i, j), tile.Pass());
}
@@ -85,7 +87,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.
- ASSERT(!contentRect.isEmpty());
+ DCHECK(!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 8d4d63b..c19f258 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)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
numLayerTreeInstances++;
}
@@ -132,9 +132,9 @@ CCLayerTreeHost::~CCLayerTreeHost()
{
if (m_rootLayer)
m_rootLayer->setLayerTreeHost(0);
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost");
- ASSERT(m_proxy.get());
+ DCHECK(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");
- ASSERT(m_contextLost);
+ DCHECK(m_contextLost);
bool recreated = false;
if (!m_numTimesRecreateShouldFail)
@@ -211,14 +211,14 @@ CCLayerTreeHost::RecreateResult CCLayerTreeHost::recreateContext()
void CCLayerTreeHost::deleteContentsTexturesOnImplThread(CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
if (m_rendererInitialized)
m_contentsTextureManager->clearAllMemory(resourceProvider);
}
void CCLayerTreeHost::acquireLayerTextures()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
m_proxy->acquireLayerTextures();
}
@@ -239,7 +239,7 @@ void CCLayerTreeHost::layout()
void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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");
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
m_contextLost = true;
m_numFailedRecreateAttempts = 0;
setNeedsCommit();
@@ -356,7 +356,7 @@ const RendererCapabilities& CCLayerTreeHost::rendererCapabilities() const
void CCLayerTreeHost::setNeedsAnimate()
{
- ASSERT(CCProxy::hasImplThread());
+ DCHECK(CCProxy::hasImplThread());
m_proxy->setNeedsAnimate();
}
@@ -379,7 +379,7 @@ bool CCLayerTreeHost::commitRequested() const
void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime)
{
- ASSERT(CCThreadProxy::isMainThread());
+ DCHECK(CCThreadProxy::isMainThread());
setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime);
}
@@ -455,7 +455,7 @@ CCPrioritizedTextureManager* CCLayerTreeHost::contentsTextureManager() const
void CCLayerTreeHost::composite()
{
- ASSERT(!CCThreadProxy::implThread());
+ DCHECK(!CCThreadProxy::implThread());
static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately();
}
@@ -481,8 +481,8 @@ bool CCLayerTreeHost::initializeRendererIfNeeded()
void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes)
{
- ASSERT(m_rendererInitialized);
- ASSERT(memoryAllocationLimitBytes);
+ DCHECK(m_rendererInitialized);
+ DCHECK(memoryAllocationLimitBytes);
if (!rootLayer())
return;
@@ -673,10 +673,10 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList
occlusionTracker.enterLayer(it);
if (it.representsTargetRenderSurface()) {
- ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
+ DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
needMoreUpdates |= paintMasksForRenderSurface(*it, queue);
} else if (it.representsItself()) {
- ASSERT(!it->bounds().isEmpty());
+ DCHECK(!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;
- ASSERT(context);
+ DCHECK(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 1044930..bf5ec34 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)
{
- ASSERT(layer->renderTarget());
+ DCHECK(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()) {
- ASSERT(layer->parent());
- ASSERT(!layer->parent()->useParentBackfaceVisibility());
+ DCHECK(layer->parent());
+ DCHECK(!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();
- ASSERT(renderSurfaceLayerList.empty());
+ DCHECK(renderSurfaceLayerList.empty());
renderSurfaceLayerList.push_back(rootLayer);
}
@@ -598,7 +598,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
layer->setDrawOpacityIsAnimating(drawOpacityIsAnimating);
if (layer != rootLayer) {
- ASSERT(layer->parent());
+ DCHECK(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
- ASSERT(!layer->parent());
- ASSERT(layer->renderSurface());
- ASSERT(ancestorClipsSubtree);
+ DCHECK(!layer->parent());
+ DCHECK(layer->renderSurface());
+ DCHECK(ancestorClipsSubtree);
layer->renderSurface()->setClipRect(clipRectFromAncestor);
subtreeShouldBeClipped = false;
}
@@ -736,7 +736,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
renderSurfaceLayerList.back()->clearRenderSurface();
renderSurfaceLayerList.pop_back();
}
- ASSERT(renderSurfaceLayerList.back() == layer);
+ DCHECK(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 7db514f..cc7ae1c 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.
- ASSERT(!rootLayer->bounds().isEmpty());
+ DCHECK(!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.
- ASSERT(!rootLayer->bounds().isEmpty());
+ DCHECK(!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 6b984a7..8f36fb1 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)
{
- ASSERT(pageScaleFactor);
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
didVisibilityChange(this, m_visible);
}
CCLayerTreeHostImpl::~CCLayerTreeHostImpl()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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();
- ASSERT(renderSurface);
+ DCHECK(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)
{
- ASSERT(renderSurfaceLayerList.empty());
- ASSERT(m_rootLayerImpl);
- ASSERT(m_renderer); // For maxTextureSize.
+ DCHECK(renderSurfaceLayerList.empty());
+ DCHECK(m_rootLayerImpl);
+ DCHECK(m_renderer); // For maxTextureSize.
{
updateRootScrollLayerImplTransform();
@@ -371,7 +371,7 @@ void CCLayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<CCRenderPass> r
bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
{
- ASSERT(frame.renderPasses.empty());
+ DCHECK(frame.renderPasses.empty());
calculateRenderSurfaceLayerList(*frame.renderSurfaceLayerList);
@@ -447,11 +447,11 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
occlusionTracker.leaveLayer(it);
}
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
- 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()));
+ 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()));
}
#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);
- ASSERT(it != frame.renderPassesById.end());
+ DCHECK(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;
- ASSERT(it >= 0);
+ DCHECK(it >= 0);
}
}
}
@@ -619,7 +619,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData&
bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame)
{
TRACE_EVENT0("cc", "CCLayerTreeHostImpl::prepareToDraw");
- ASSERT(canDraw());
+ DCHECK(canDraw());
frame.renderSurfaceLayerList = &m_renderSurfaceLayerList;
frame.renderPasses.clear();
@@ -650,7 +650,7 @@ void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes)
return;
m_memoryAllocationLimitBytes = bytes;
- ASSERT(bytes);
+ DCHECK(bytes > 0);
m_client->setNeedsCommitOnImplThread();
}
@@ -662,8 +662,8 @@ void CCLayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, dou
void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
{
TRACE_EVENT0("cc", "CCLayerTreeHostImpl::drawLayers");
- ASSERT(canDraw());
- ASSERT(!frame.renderPasses.empty());
+ DCHECK(canDraw());
+ DCHECK(!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()
{
- ASSERT(m_renderer);
+ DCHECK(m_renderer);
m_fpsCounter->markEndOfFrame();
return m_renderer->swapBuffers();
@@ -747,7 +747,7 @@ void CCLayerTreeHostImpl::onSwapBuffersComplete()
void CCLayerTreeHostImpl::readback(void* pixels, const IntRect& rect)
{
- ASSERT(m_renderer);
+ DCHECK(m_renderer);
m_renderer->getFramebufferPixels(pixels, rect);
}
@@ -811,7 +811,7 @@ scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree()
void CCLayerTreeHostImpl::setVisible(bool visible)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
if (m_visible == visible)
return;
@@ -1016,7 +1016,7 @@ CCInputHandlerClient::ScrollStatus CCLayerTreeHostImpl::scrollBegin(const IntPoi
{
TRACE_EVENT0("cc", "CCLayerTreeHostImpl::scrollBegin");
- ASSERT(!m_currentlyScrollingLayerImpl);
+ DCHECK(!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.
- ASSERT(layerImpl.screenSpaceTransform().isInvertible());
+ DCHECK(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.
- ASSERT(!startClipped);
- ASSERT(!endClipped);
+ DCHECK(!startClipped);
+ DCHECK(!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);
- ASSERT(!endClipped);
+ DCHECK(!endClipped);
if (endClipped)
return FloatSize();
return actualScreenSpaceEndPoint - screenSpacePoint;
@@ -1384,7 +1384,7 @@ base::TimeDelta CCLayerTreeHostImpl::lowFrequencyAnimationInterval() const
void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current)
{
- ASSERT(current);
+ DCHECK(current);
current->didLoseContext();
if (current->maskLayer())
sendDidLoseContextRecursive(current->maskLayer());
@@ -1396,7 +1396,7 @@ void CCLayerTreeHostImpl::sendDidLoseContextRecursive(CCLayerImpl* current)
static void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl* current)
{
- ASSERT(current);
+ DCHECK(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 9220e64..f1f2747 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();
- ASSERT(scrollLayer);
+ DCHECK(scrollLayer);
const float minPageScale = 1, maxPageScale = 4;
const WebTransformationMatrix identityScaleTransform;
@@ -528,7 +528,7 @@ TEST_P(CCLayerTreeHostImplTest, pinchGesture)
initializeRendererAndDrawFrame();
CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
- ASSERT(scrollLayer);
+ DCHECK(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();
- ASSERT(scrollLayer);
+ DCHECK(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();
- ASSERT(scrollLayer);
+ DCHECK(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();
- ASSERT(scrollLayer);
+ DCHECK(scrollLayer);
const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5;
const float maxPageScale = 4;
@@ -2601,7 +2601,7 @@ public:
void createResources(CCResourceProvider* provider)
{
- ASSERT(provider);
+ DCHECK(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 dcce06c..430e644 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -1429,7 +1429,7 @@ public:
context->resetUsedTextures();
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -1551,7 +1551,7 @@ public:
context->resetUsedTextures();
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -1596,7 +1596,7 @@ public:
m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -2506,7 +2506,7 @@ public:
virtual ~EvictTexturesTask() { }
virtual void run() OVERRIDE
{
- ASSERT(m_test->m_implForEvictTextures);
+ DCHECK(m_test->m_implForEvictTextures);
m_test->m_implForEvictTextures->releaseContentsTextures();
}
@@ -2516,7 +2516,7 @@ public:
void postEvictTextures()
{
- ASSERT(webThread());
+ DCHECK(webThread());
webThread()->postTask(new EvictTexturesTask(this));
}
@@ -2566,7 +2566,7 @@ public:
endTest();
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -2599,7 +2599,7 @@ public:
postEvictTextures();
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
}
@@ -2663,7 +2663,7 @@ public:
void evictTexturesOnImplThread()
{
- ASSERT(m_implForEvictTextures);
+ DCHECK(m_implForEvictTextures);
m_implForEvictTextures->releaseContentsTextures();
}
diff --git a/cc/math_util.cc b/cc/math_util.cc
index d90eb09..417e0c9 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.
- ASSERT(h2.w != h1.w);
+ DCHECK(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.
- ASSERT(h1.shouldBeClipped() ^ h2.shouldBeClipped());
+ DCHECK(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);
- ASSERT(numVerticesInClippedQuad <= 8);
+ DCHECK(numVerticesInClippedQuad <= 8);
}
FloatRect CCMathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices)
diff --git a/cc/math_util.h b/cc/math_util.h
index ed3848e..f0a36ab 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -5,6 +5,7 @@
#ifndef CCMathUtil_h
#define CCMathUtil_h
+#include "base/logging.h"
#include "FloatPoint.h"
#include "FloatPoint3D.h"
@@ -38,7 +39,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.
- ASSERT(w);
+ DCHECK(w);
double invW = 1.0 / w;
return FloatPoint(x * invW, y * invW);
}
@@ -49,7 +50,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.
- ASSERT(w);
+ DCHECK(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 39d7efe..7d5640d 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)
{
- ASSERT(layer->visibleContentRect().contains(opaqueContents.bounds()));
+ DCHECK(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)
{
- ASSERT(!m_stack.isEmpty());
- ASSERT(layer->renderTarget() == m_stack.last().target);
+ DCHECK(!m_stack.isEmpty());
+ DCHECK(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;
- ASSERT(!m_stack.isEmpty());
+ DCHECK(!m_stack.isEmpty());
if (m_stack.isEmpty())
return false;
if (contentRect.isEmpty())
return true;
- ASSERT(layer->renderTarget() == m_stack.last().target);
+ DCHECK(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
{
- ASSERT(!m_stack.isEmpty());
+ DCHECK(!m_stack.isEmpty());
if (m_stack.isEmpty())
return contentRect;
if (contentRect.isEmpty())
return contentRect;
- ASSERT(layer->renderTarget() == m_stack.last().target);
+ DCHECK(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
{
- ASSERT(!m_stack.isEmpty());
+ DCHECK(!m_stack.isEmpty());
// The layer is a contributing renderTarget so it should have a surface.
- ASSERT(layer->renderSurface());
+ DCHECK(layer->renderSurface());
// The layer is a contributing renderTarget so its target should be itself.
- ASSERT(layer->renderTarget() == layer);
+ DCHECK(layer->renderTarget() == layer);
// The layer should not be the root, else what is is contributing to?
- ASSERT(layer->parent());
+ DCHECK(layer->parent());
// This should be called while the layer is still considered the current target in the occlusion tracker.
- ASSERT(layer == m_stack.last().target);
+ DCHECK(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 76306b8..355c9ea 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);
- ASSERT(!m_root);
+ DCHECK(!m_root);
m_root = Types::passLayerPtr(layer);
return layerPtr;
}
@@ -264,11 +264,11 @@ protected:
void calcDrawEtc(TestContentLayerImpl* root)
{
- ASSERT(root == m_root.get());
+ DCHECK(root == m_root.get());
int dummyMaxTextureSize = 512;
CCLayerSorter layerSorter;
- ASSERT(!root->renderSurface());
+ DCHECK(!root->renderSurface());
CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl);
@@ -277,10 +277,10 @@ protected:
void calcDrawEtc(TestContentLayerChromium* root)
{
- ASSERT(root == m_root.get());
+ DCHECK(root == m_root.get());
int dummyMaxTextureSize = 512;
- ASSERT(!root->renderSurface());
+ DCHECK(!root->renderSurface());
CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, dummyMaxTextureSize, m_renderSurfaceLayerListChromium);
diff --git a/cc/platform_color.h b/cc/platform_color.h
index 2149d1c..a3f3f35 100644
--- a/cc/platform_color.h
+++ b/cc/platform_color.h
@@ -31,7 +31,7 @@ public:
textureFormat = Extensions3D::BGRA_EXT;
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
return textureFormat;
@@ -47,7 +47,7 @@ public:
case GraphicsContext3D::SourceFormatBGRA8:
return textureFormat == Extensions3D::BGRA_EXT;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return false;
}
}
diff --git a/cc/prioritized_texture.cc b/cc/prioritized_texture.cc
index f1a7cf4..9bb6b96 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.
- ASSERT(format || size.isEmpty());
+ DCHECK(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);
- ASSERT(m_manager || !m_backing);
+ DCHECK(m_manager || !m_backing);
if (m_manager)
m_manager->returnBackingTexture(this);
}
@@ -76,7 +76,7 @@ bool CCPrioritizedTexture::backingResourceWasEvicted() const
void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider)
{
- ASSERT(m_isAbovePriorityCutoff);
+ DCHECK(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)
{
- ASSERT(m_isAbovePriorityCutoff);
+ DCHECK(m_isAbovePriorityCutoff);
if (m_isAbovePriorityCutoff)
acquireBackingTexture(resourceProvider);
- ASSERT(m_backing);
+ DCHECK(m_backing);
resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destOffset);
}
void CCPrioritizedTexture::link(Backing* backing)
{
- ASSERT(backing);
- ASSERT(!backing->m_owner);
- ASSERT(!m_backing);
+ DCHECK(backing);
+ DCHECK(!backing->m_owner);
+ DCHECK(!m_backing);
m_backing = backing;
m_backing->m_owner = this;
@@ -111,8 +111,8 @@ void CCPrioritizedTexture::link(Backing* backing)
void CCPrioritizedTexture::unlink()
{
- ASSERT(m_backing);
- ASSERT(m_backing->m_owner == this);
+ DCHECK(m_backing);
+ DCHECK(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)
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
, m_resourceProvider(resourceProvider)
#endif
{
@@ -140,17 +140,15 @@ CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resource
CCPrioritizedTexture::Backing::~Backing()
{
- ASSERT(!m_owner);
- ASSERT(m_resourceHasBeenDeleted);
+ DCHECK(!m_owner);
+ DCHECK(m_resourceHasBeenDeleted);
}
void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(!m_resourceHasBeenDeleted);
-#ifndef NDEBUG
- ASSERT(resourceProvider == m_resourceProvider);
-#endif
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(!m_resourceHasBeenDeleted);
+ DCHECK(resourceProvider == m_resourceProvider);
resourceProvider->deleteResource(id());
setId(0);
@@ -159,19 +157,19 @@ void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceP
bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
return m_resourceHasBeenDeleted;
}
bool CCPrioritizedTexture::Backing::canBeRecycled() const
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
return !m_wasAbovePriorityCutoffAtLastPriorityUpdate && !m_inDrawingImplTree;
}
void CCPrioritizedTexture::Backing::updatePriority()
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
if (m_owner) {
m_priorityAtLastPriorityUpdate = m_owner->requestPriority();
m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityCutoff();
@@ -183,10 +181,10 @@ void CCPrioritizedTexture::Backing::updatePriority()
void CCPrioritizedTexture::Backing::updateInDrawingImplTree()
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
m_inDrawingImplTree = !!owner();
if (!m_inDrawingImplTree)
- ASSERT(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPriority());
+ DCHECK(m_priorityAtLastPriorityUpdate == CCPriorityCalculator::lowestPriority());
}
} // namespace cc
diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h
index 242147c..24278db 100644
--- a/cc/prioritized_texture.h
+++ b/cc/prioritized_texture.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "cc/dcheck.h"
#include "CCPriorityCalculator.h"
#include "CCResourceProvider.h"
#include "CCTexture.h"
@@ -111,7 +112,7 @@ private:
bool m_inDrawingImplTree;
bool m_resourceHasBeenDeleted;
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
CCResourceProvider* m_resourceProvider;
#endif
diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_texture_manager.cc
index 06d6c8e..55da5b3 100644
--- a/cc/prioritized_texture_manager.cc
+++ b/cc/prioritized_texture_manager.cc
@@ -32,16 +32,16 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager()
unregisterTexture(*m_textures.begin());
deleteUnlinkedEvictedBackings();
- ASSERT(m_evictedBackings.isEmpty());
+ DCHECK(m_evictedBackings.isEmpty());
// Each remaining backing is a leaked opengl texture. There should be none.
- ASSERT(m_backings.isEmpty());
+ DCHECK(m_backings.isEmpty());
}
void CCPrioritizedTextureManager::prioritizeTextures()
{
TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures");
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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();
- ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes);
- ASSERT(memoryAboveCutoffBytes() <= maxMemoryLimitBytes());
+ DCHECK(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes);
+ DCHECK(memoryAboveCutoffBytes() <= maxMemoryLimitBytes());
}
void CCPrioritizedTextureManager::pushTexturePrioritiesToBackings()
{
TRACE_EVENT0("cc", "CCPrioritizedTextureManager::pushTexturePrioritiesToBackings");
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(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");
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(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");
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(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 !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
assertInvariants();
#endif
}
void CCPrioritizedTextureManager::clearPriorities()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
- ASSERT(!texture->isSelfManaged());
- ASSERT(texture->isAbovePriorityCutoff());
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(!texture->isSelfManaged());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
if (memoryUseBytes() <= limitBytes)
return;
@@ -234,10 +234,10 @@ void CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes,
void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
evictBackingsToReduceMemory(m_memoryAvailableBytes, RespectManagerPriorityCutoff, resourceProvider);
- ASSERT(memoryUseBytes() <= maxMemoryLimitBytes());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
- ASSERT(resourceProvider);
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(resourceProvider);
evictBackingsToReduceMemory(0, DoNotRespectManagerPriorityCutoff, resourceProvider);
}
void CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(resourceProvider);
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(resourceProvider);
evictBackingsToReduceMemory(limitBytes, DoNotRespectManagerPriorityCutoff, resourceProvider);
}
void CCPrioritizedTextureManager::getEvictedBackings(BackingVector& evictedBackings)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
evictedBackings.clear();
evictedBackings.append(m_evictedBackings);
}
void CCPrioritizedTextureManager::unlinkEvictedBackings(const BackingVector& evictedBackings)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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()
{
- ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
+ DCHECK(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)
{
- ASSERT(CCProxy::isMainThread());
- ASSERT(texture);
- ASSERT(!texture->textureManager());
- ASSERT(!texture->backing());
- ASSERT(!ContainsKey(m_textures, texture));
+ DCHECK(CCProxy::isMainThread());
+ DCHECK(texture);
+ DCHECK(!texture->textureManager());
+ DCHECK(!texture->backing());
+ DCHECK(!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)
{
- ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
- ASSERT(texture);
- ASSERT(ContainsKey(m_textures, texture));
+ DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
+ DCHECK(texture);
+ DCHECK(ContainsKey(m_textures, texture));
returnBackingTexture(texture);
texture->setManagerInternal(0);
@@ -345,15 +345,15 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur
void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture)
{
- ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
+ DCHECK(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
if (texture->backing())
texture->unlink();
}
CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
- ASSERT(resourceProvider);
+ DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(backing);
- ASSERT(resourceProvider);
- ASSERT(m_backings.find(backing) != m_backings.end());
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(backing);
+ DCHECK(resourceProvider);
+ DCHECK(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 !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
void CCPrioritizedTextureManager::assertInvariants()
{
- ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ DCHECK(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()) {
- ASSERT(ContainsKey(m_textures, (*it)->owner()));
- ASSERT((*it)->owner()->backing() == (*it));
+ DCHECK(ContainsKey(m_textures, (*it)->owner()));
+ DCHECK((*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()) {
- ASSERT(m_backings.find(backing) == m_backings.end());
- ASSERT(m_evictedBackings.contains(backing));
+ DCHECK(m_backings.find(backing) == m_backings.end());
+ DCHECK(m_evictedBackings.contains(backing));
} else {
- ASSERT(m_backings.find(backing) != m_backings.end());
- ASSERT(!m_evictedBackings.contains(backing));
+ DCHECK(m_backings.find(backing) != m_backings.end());
+ DCHECK(!m_evictedBackings.contains(backing));
}
- ASSERT(backing->owner() == texture);
+ DCHECK(backing->owner() == texture);
}
}
@@ -418,9 +418,9 @@ void CCPrioritizedTextureManager::assertInvariants()
if (!(*it)->canBeRecycled())
reachedUnrecyclable = true;
if (reachedUnrecyclable)
- ASSERT(!(*it)->canBeRecycled());
+ DCHECK(!(*it)->canBeRecycled());
else
- ASSERT((*it)->canBeRecycled());
+ DCHECK((*it)->canBeRecycled());
}
}
#endif
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h
index e8998b0..2daf783 100644
--- a/cc/prioritized_texture_manager.h
+++ b/cc/prioritized_texture_manager.h
@@ -140,7 +140,7 @@ private:
void deleteUnlinkedEvictedBackings();
void sortBackings();
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
void assertInvariants();
#endif
diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc
index 25b677f..09312ec 100644
--- a/cc/prioritized_texture_unittest.cc
+++ b/cc/prioritized_texture_unittest.cc
@@ -80,7 +80,7 @@ public:
void textureManagerAssertInvariants(CCPrioritizedTextureManager* textureManager)
{
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
textureManager->assertInvariants();
#endif
diff --git a/cc/program_binding.cc b/cc/program_binding.cc
index 094020b..4cae7a0 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().
- ASSERT(!m_program);
- ASSERT(!m_vertexShaderId);
- ASSERT(!m_fragmentShaderId);
- ASSERT(!m_initialized);
+ DCHECK(!m_program);
+ DCHECK(!m_vertexShaderId);
+ DCHECK(!m_fragmentShaderId);
+ DCHECK(!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,26 +54,25 @@ 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);
- ASSERT(m_program || contextLost(context));
+ DCHECK(m_program || contextLost(context));
}
void ProgramBindingBase::link(WebGraphicsContext3D* context)
{
GLC(context, context->linkProgram(m_program));
cleanupShaders(context);
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
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
}
@@ -84,7 +83,7 @@ void ProgramBindingBase::cleanup(WebGraphicsContext3D* context)
if (!m_program)
return;
- ASSERT(context);
+ DCHECK(context);
GLC(context, context->deleteProgram(m_program));
m_program = 0;
@@ -98,7 +97,7 @@ unsigned ProgramBindingBase::loadShader(WebGraphicsContext3D* context, unsigned
return 0;
GLC(context, context->shaderSource(shader, shaderSource.data()));
GLC(context, context->compileShader(shader));
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
int compiled = 0;
GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled));
if (!compiled) {
@@ -114,7 +113,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 28f628c..3ddc0b4 100644
--- a/cc/program_binding.h
+++ b/cc/program_binding.h
@@ -7,6 +7,8 @@
#include <string>
+#include "base/logging.h"
+
namespace WebKit {
class WebGraphicsContext3D;
}
@@ -22,7 +24,7 @@ public:
void link(WebKit::WebGraphicsContext3D*);
void cleanup(WebKit::WebGraphicsContext3D*);
- unsigned program() const { ASSERT(m_initialized); return m_program; }
+ unsigned program() const { DCHECK(m_initialized); return m_program; }
bool initialized() const { return m_initialized; }
protected:
@@ -47,9 +49,9 @@ public:
void initialize(WebKit::WebGraphicsContext3D* context, bool usingBindUniform)
{
- ASSERT(context);
- ASSERT(m_program);
- ASSERT(!m_initialized);
+ DCHECK(context);
+ DCHECK(m_program);
+ DCHECK(!m_initialized);
// Need to bind uniforms before linking
if (!usingBindUniform)
diff --git a/cc/proxy.cc b/cc/proxy.cc
index bc5ae69..10b4ed0 100644
--- a/cc/proxy.cc
+++ b/cc/proxy.cc
@@ -13,7 +13,7 @@ using namespace WTF;
namespace cc {
namespace {
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
bool implThreadIsOverridden = false;
bool s_isMainThreadBlocked = false;
base::PlatformThreadId threadIDOverridenToBeImplThread;
@@ -57,10 +57,10 @@ CCThread* CCProxy::currentThread()
return 0;
}
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
bool CCProxy::isMainThread()
{
- ASSERT(s_mainThread);
+ DCHECK(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()
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
}
CCProxy::~CCProxy()
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
}
}
diff --git a/cc/proxy.h b/cc/proxy.h
index cae128e..0a68075 100644
--- a/cc/proxy.h
+++ b/cc/proxy.h
@@ -6,6 +6,7 @@
#define CCProxy_h
#include "base/basictypes.h"
+#include "cc/dcheck.h"
#include <public/WebCompositorOutputSurface.h>
namespace cc {
@@ -81,7 +82,7 @@ public:
virtual void acquireLayerTextures() = 0;
// Debug hooks
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
static bool isMainThread();
static bool isImplThread();
static bool isMainThreadBlocked();
@@ -91,7 +92,7 @@ public:
// Testing hooks
virtual void loseContext() = 0;
-#ifndef NDEBUG
+#if CC_DCHECK_ENABLED()
static void setCurrentThreadIsImplThread(bool);
#endif
@@ -108,15 +109,15 @@ class DebugScopedSetMainThreadBlocked {
public:
DebugScopedSetMainThreadBlocked()
{
-#if !ASSERT_DISABLED
- ASSERT(!CCProxy::isMainThreadBlocked());
+#if CC_DCHECK_ENABLED()
+ DCHECK(!CCProxy::isMainThreadBlocked());
CCProxy::setMainThreadBlocked(true);
#endif
}
~DebugScopedSetMainThreadBlocked()
{
-#if !ASSERT_DISABLED
- ASSERT(CCProxy::isMainThreadBlocked());
+#if CC_DCHECK_ENABLED()
+ DCHECK(CCProxy::isMainThreadBlocked());
CCProxy::setMainThreadBlocked(false);
#endif
}
diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc
index 3a7c96c..6733b31 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)
{
- ASSERT(drawQuad->sharedQuadState() == m_currentSharedQuadState);
- ASSERT(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id);
- ASSERT(!m_sharedQuadStateList.isEmpty());
- ASSERT(m_sharedQuadStateList.last() == m_currentSharedQuadState);
+ DCHECK(drawQuad->sharedQuadState() == m_currentSharedQuadState);
+ DCHECK(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id);
+ DCHECK(!m_sharedQuadStateList.isEmpty());
+ DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState);
IntRect culledRect;
bool hasOcclusionFromOutsideTargetSurface;
diff --git a/cc/rate_limiter.cc b/cc/rate_limiter.cc
index b26959e..d772e3e 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)
{
- ASSERT(context);
+ DCHECK(context);
}
RateLimiter::~RateLimiter()
diff --git a/cc/render_pass.cc b/cc/render_pass.cc
index 513bd8b..d628c0d 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)
{
- ASSERT(id.layerId > 0);
- ASSERT(id.index >= 0);
+ DCHECK(id.layerId > 0);
+ DCHECK(id.index >= 0);
}
CCRenderPass::~CCRenderPass()
@@ -39,7 +39,7 @@ CCRenderPass::~CCRenderPass()
scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const
{
- ASSERT(newId != m_id);
+ DCHECK(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));
- ASSERT(rootLayer->screenSpaceTransform().isInvertible());
+ DCHECK(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 9e385c6..8cec50f 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)
{
- ASSERT(m_renderPassId.layerId > 0);
- ASSERT(m_renderPassId.index >= 0);
+ DCHECK(m_renderPassId.layerId > 0);
+ DCHECK(m_renderPassId.index >= 0);
}
const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::RenderPass);
+ DCHECK(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();
- ASSERT(bytes);
+ DCHECK(bytes > 0);
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 7f1d3c6..5f683bf 100644
--- a/cc/render_surface_filters.cc
+++ b/cc/render_surface_filters.cc
@@ -6,6 +6,7 @@
#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"
@@ -294,7 +295,7 @@ public:
private:
void createCanvas()
{
- ASSERT(m_scratchTextures[m_currentTexture].get());
+ DCHECK(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);
@@ -431,7 +432,7 @@ SkBitmap CCRenderSurfaceFilters::apply(const WebKit::WebFilterOperations& filter
case WebKit::WebFilterOperation::FilterTypeHueRotate:
case WebKit::WebFilterOperation::FilterTypeInvert:
case WebKit::WebFilterOperation::FilterTypeOpacity:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
state.swap();
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index e5f0324..17eaffe 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -6,6 +6,7 @@
#include "CCRenderSurface.h"
+#include "base/logging.h"
#include "base/stringprintf.h"
#include "CCDamageTracker.h"
#include "CCDebugBorderDrawQuad.h"
@@ -134,7 +135,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).
//
- ASSERT(m_owningLayer);
+ DCHECK(m_owningLayer);
return m_surfacePropertyChanged || m_owningLayer->layerPropertyChanged();
}
@@ -145,7 +146,7 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const
void CCRenderSurface::addContributingDelegatedRenderPassLayer(CCLayerImpl* layer)
{
- ASSERT(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end());
+ DCHECK(std::find(m_layerList.begin(), m_layerList.end(), layer) != m_layerList.end());
CCDelegatedRendererLayerImpl* delegatedRendererLayer = static_cast<CCDelegatedRendererLayerImpl*>(layer);
m_contributingDelegatedRenderPassLayerList.push_back(delegatedRendererLayer);
}
@@ -158,7 +159,7 @@ void CCRenderSurface::clearLayerLists()
static inline IntRect computeClippedRectInTarget(const CCLayerImpl* owningLayer)
{
- ASSERT(owningLayer->parent());
+ DCHECK(owningLayer->parent());
const CCLayerImpl* renderTarget = owningLayer->parent()->renderTarget();
const CCRenderSurface* self = owningLayer->renderSurface();
@@ -180,7 +181,7 @@ CCRenderPass::Id CCRenderSurface::renderPassId()
{
int layerId = m_owningLayer->id();
int subId = 0;
- ASSERT(layerId > 0);
+ DCHECK(layerId > 0);
return CCRenderPass::Id(layerId, subId);
}
@@ -198,7 +199,7 @@ void CCRenderSurface::appendRenderPasses(CCRenderPassSink& passSink)
void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData, bool forReplica, CCRenderPass::Id renderPassId)
{
- ASSERT(!forReplica || m_owningLayer->hasReplica());
+ DCHECK(!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 4b2326b..a9b396c 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:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
break;
}
@@ -131,13 +131,13 @@ CCResourceProvider::~CCResourceProvider()
WebGraphicsContext3D* CCResourceProvider::graphicsContext3D()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
return m_context->context3D();
}
bool CCResourceProvider::inUseByConsumer(ResourceId id)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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:
- ASSERT(format == GraphicsContext3D::RGBA);
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
unsigned textureId = 0;
WebGraphicsContext3D* context3d = m_context->context3D();
- ASSERT(context3d);
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(m_context->context3D());
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(!resource->lockedForWrite);
- ASSERT(!resource->lockForReadCount);
- ASSERT(!resource->markedForDeletion);
+ DCHECK(!resource->lockedForWrite);
+ DCHECK(!resource->lockForReadCount);
+ DCHECK(!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();
- ASSERT(context3d);
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(!resource->lockedForWrite);
- ASSERT(!resource->lockForReadCount);
- ASSERT(!resource->external);
- ASSERT(!resource->exported);
+ DCHECK(!resource->lockedForWrite);
+ DCHECK(!resource->lockForReadCount);
+ DCHECK(!resource->external);
+ DCHECK(!resource->exported);
if (resource->glId) {
WebGraphicsContext3D* context3d = m_context->context3D();
- ASSERT(context3d);
- ASSERT(m_texSubImage.get());
+ DCHECK(context3d);
+ DCHECK(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()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
WebGraphicsContext3D* context3d = m_context->context3D();
if (context3d)
context3d->flush();
@@ -302,7 +302,7 @@ void CCResourceProvider::flush()
bool CCResourceProvider::shallowFlushIfSupported()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(!resource->lockedForWrite);
- ASSERT(!resource->exported);
+ DCHECK(!resource->lockedForWrite);
+ DCHECK(!resource->exported);
resource->lockForReadCount++;
return resource;
}
void CCResourceProvider::unlockForRead(ResourceId id)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(resource->lockForReadCount > 0);
- ASSERT(!resource->exported);
+ DCHECK(resource->lockForReadCount > 0);
+ DCHECK(!resource->exported);
resource->lockForReadCount--;
}
const CCResourceProvider::Resource* CCResourceProvider::lockForWrite(ResourceId id)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(!resource->lockedForWrite);
- ASSERT(!resource->lockForReadCount);
- ASSERT(!resource->exported);
- ASSERT(!resource->external);
+ DCHECK(!resource->lockedForWrite);
+ DCHECK(!resource->lockForReadCount);
+ DCHECK(!resource->exported);
+ DCHECK(!resource->external);
resource->lockedForWrite = true;
return resource;
}
void CCResourceProvider::unlockForWrite(ResourceId id)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
Resource* resource = &it->second;
- ASSERT(resource->lockedForWrite);
- ASSERT(!resource->exported);
- ASSERT(!resource->external);
+ DCHECK(resource->lockedForWrite);
+ DCHECK(!resource->exported);
+ DCHECK(!resource->external);
resource->lockedForWrite = false;
}
@@ -366,7 +366,7 @@ CCResourceProvider::ScopedReadLockGL::ScopedReadLockGL(CCResourceProvider* resou
, m_resourceId(resourceId)
, m_textureId(resourceProvider->lockForRead(resourceId)->glId)
{
- ASSERT(m_textureId);
+ DCHECK(m_textureId);
}
CCResourceProvider::ScopedReadLockGL::~ScopedReadLockGL()
@@ -379,7 +379,7 @@ CCResourceProvider::ScopedWriteLockGL::ScopedWriteLockGL(CCResourceProvider* res
, m_resourceId(resourceId)
, m_textureId(resourceProvider->lockForWrite(resourceId)->glId)
{
- ASSERT(m_textureId);
+ DCHECK(m_textureId);
}
CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL()
@@ -389,8 +389,8 @@ CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL()
void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource)
{
- ASSERT(resource->pixels);
- ASSERT(resource->format == GraphicsContext3D::RGBA);
+ DCHECK(resource->pixels);
+ DCHECK(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()
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ChildMap::iterator it = m_children.find(child);
- ASSERT(it != m_children.end());
+ DCHECK(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
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ChildMap::const_iterator it = m_children.find(child);
- ASSERT(it != m_children.end());
+ DCHECK(it != m_children.end());
return it->second.childToParentMap;
}
CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToParent(const ResourceIdArray& resources)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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))
- ASSERT_NOT_REACHED();
- ASSERT(childInfo.parentToChildMap.find(*it) != childInfo.parentToChildMap.end());
+ NOTREACHED();
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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);
- ASSERT(mapIterator != m_resources.end());
+ DCHECK(mapIterator != m_resources.end());
Resource* resource = &mapIterator->second;
- ASSERT(resource->exported);
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
ResourceMap::const_iterator it = m_resources.find(id);
CHECK(it != m_resources.end());
const Resource* source = &it->second;
- ASSERT(!source->lockedForWrite);
- ASSERT(!source->lockForReadCount);
- ASSERT(!source->external);
+ DCHECK(!source->lockedForWrite);
+ DCHECK(!source->lockForReadCount);
+ DCHECK(!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 9b22a0a..ecc8985 100644
--- a/cc/resource_provider_unittest.cc
+++ b/cc/resource_provider_unittest.cc
@@ -9,6 +9,7 @@
#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"
@@ -60,9 +61,9 @@ public:
{
unsigned mailbox = 0;
memcpy(&mailbox, mailboxName, sizeof(mailbox));
- ASSERT(mailbox && mailbox < m_nextMailBox);
+ ASSERT_TRUE(mailbox && mailbox < m_nextMailBox);
m_textures.set(mailbox, texture);
- ASSERT(m_syncPointForMailbox.get(mailbox) < syncPoint);
+ ASSERT_LT(m_syncPointForMailbox.get(mailbox), syncPoint);
m_syncPointForMailbox.set(mailbox, syncPoint);
}
@@ -70,7 +71,7 @@ public:
{
unsigned mailbox = 0;
memcpy(&mailbox, mailboxName, sizeof(mailbox));
- ASSERT(mailbox && mailbox < m_nextMailBox);
+ DCHECK(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
@@ -115,8 +116,8 @@ public:
virtual void bindTexture(WGC3Denum target, WebGLId texture)
{
- ASSERT(target == GraphicsContext3D::TEXTURE_2D);
- ASSERT(!texture || m_textures.find(texture) != m_textures.end());
+ ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D);
+ ASSERT_TRUE(!texture || m_textures.find(texture) != m_textures.end());
m_currentTexture = texture;
}
@@ -130,7 +131,7 @@ public:
virtual void deleteTexture(WebGLId id)
{
TextureMap::iterator it = m_textures.find(id);
- ASSERT(it != m_textures.end());
+ ASSERT_NE(it, m_textures.end());
m_textures.remove(it);
if (m_currentTexture == id)
m_currentTexture = 0;
@@ -139,9 +140,9 @@ public:
virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat,
WGC3Dint width, WGC3Dint height)
{
- ASSERT(m_currentTexture);
- ASSERT(target == GraphicsContext3D::TEXTURE_2D);
- ASSERT(levels == 1);
+ ASSERT_TRUE(m_currentTexture);
+ ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D);
+ ASSERT_EQ(levels, 1);
WGC3Denum format = GraphicsContext3D::RGBA;
switch (internalformat) {
case Extensions3D::RGBA8_OES:
@@ -150,19 +151,19 @@ public:
format = Extensions3D::BGRA_EXT;
break;
default:
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
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(m_currentTexture);
- ASSERT(target == GraphicsContext3D::TEXTURE_2D);
- ASSERT(!level);
- ASSERT(internalformat == format);
- ASSERT(!border);
- ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE);
+ 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);
allocateTexture(IntSize(width, height), format);
if (pixels)
setPixels(0, 0, width, height, pixels);
@@ -170,21 +171,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(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);
+ 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);
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(m_currentTexture);
- ASSERT(target == GraphicsContext3D::TEXTURE_2D);
+ ASSERT_TRUE(m_currentTexture);
+ ASSERT_EQ(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
@@ -198,18 +199,18 @@ public:
virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox)
{
- ASSERT(m_currentTexture);
- ASSERT(target == GraphicsContext3D::TEXTURE_2D);
+ ASSERT_TRUE(m_currentTexture);
+ ASSERT_EQ(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(m_currentTexture);
+ ASSERT_TRUE(m_currentTexture);
Texture* texture = m_textures.get(m_currentTexture);
- ASSERT(texture);
- ASSERT(texture->size == size);
- ASSERT(texture->format == format);
+ ASSERT_TRUE(texture);
+ ASSERT_EQ(texture->size, size);
+ ASSERT_EQ(texture->format, format);
memcpy(pixels, texture->data.get(), textureSize(size, format));
}
@@ -229,18 +230,18 @@ protected:
private:
void allocateTexture(const IntSize& size, WGC3Denum format)
{
- ASSERT(m_currentTexture);
+ ASSERT_TRUE(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(m_currentTexture);
+ ASSERT_TRUE(m_currentTexture);
Texture* texture = m_textures.get(m_currentTexture);
- ASSERT(texture);
- ASSERT(xoffset >= 0 && xoffset+width <= texture->size.width());
- ASSERT(yoffset >= 0 && yoffset+height <= texture->size.height());
- ASSERT(pixels);
+ ASSERT_TRUE(texture);
+ ASSERT_TRUE(xoffset >= 0 && xoffset+width <= texture->size.width());
+ ASSERT_TRUE(yoffset >= 0 && yoffset+height <= texture->size.height());
+ ASSERT_TRUE(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 869cd19..eb24306 100644
--- a/cc/scheduler.cc
+++ b/cc/scheduler.cc
@@ -7,7 +7,8 @@
#include "CCScheduler.h"
#include "TraceEvent.h"
-#include <base/auto_reset.h>
+#include "base/auto_reset.h"
+#include "base/logging.h"
namespace cc {
@@ -16,9 +17,9 @@ CCScheduler::CCScheduler(CCSchedulerClient* client, scoped_ptr<CCFrameRateContro
, m_frameRateController(frameRateController.Pass())
, m_insideProcessScheduledActions(false)
{
- ASSERT(m_client);
+ DCHECK(m_client);
m_frameRateController->setClient(this);
- ASSERT(!m_stateMachine.vsyncCallbackNeeded());
+ DCHECK(!m_stateMachine.vsyncCallbackNeeded());
}
CCScheduler::~CCScheduler()
diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc
index 3eaf5cd..47fa5a0 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;
- ASSERT(m_textureState == LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD);
+ DCHECK(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;
}
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return ACTION_NONE;
}
@@ -162,7 +162,7 @@ void CCSchedulerStateMachine::updateState(Action action)
return;
case ACTION_BEGIN_FRAME:
- ASSERT(m_visible || m_needsForcedCommit);
+ DCHECK(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:
- ASSERT(m_commitState == COMMIT_STATE_IDLE);
- ASSERT(m_contextState == CONTEXT_LOST);
+ DCHECK(m_commitState == COMMIT_STATE_IDLE);
+ DCHECK(m_contextState == CONTEXT_LOST);
m_contextState = CONTEXT_RECREATING;
return;
@@ -212,8 +212,8 @@ void CCSchedulerStateMachine::updateState(Action action)
void CCSchedulerStateMachine::setMainThreadNeedsLayerTextures()
{
- ASSERT(!m_mainThreadNeedsLayerTextures);
- ASSERT(m_textureState != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD);
+ DCHECK(!m_mainThreadNeedsLayerTextures);
+ DCHECK(m_textureState != LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD);
m_mainThreadNeedsLayerTextures = true;
}
@@ -284,13 +284,13 @@ void CCSchedulerStateMachine::setNeedsForcedCommit()
void CCSchedulerStateMachine::beginFrameComplete()
{
- ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
+ DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
m_commitState = COMMIT_STATE_READY_TO_COMMIT;
}
void CCSchedulerStateMachine::beginFrameAborted()
{
- ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
+ DCHECK(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
m_commitState = COMMIT_STATE_IDLE;
setNeedsCommit();
}
@@ -304,7 +304,7 @@ void CCSchedulerStateMachine::didLoseContext()
void CCSchedulerStateMachine::didRecreateContext()
{
- ASSERT(m_contextState == CONTEXT_RECREATING);
+ DCHECK(m_contextState == CONTEXT_RECREATING);
m_contextState = CONTEXT_ACTIVE;
setNeedsCommit();
}
diff --git a/cc/scheduler_unittest.cc b/cc/scheduler_unittest.cc
index 104453d..d912abb 100644
--- a/cc/scheduler_unittest.cc
+++ b/cc/scheduler_unittest.cc
@@ -6,6 +6,7 @@
#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"
@@ -222,7 +223,7 @@ public:
virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
{
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return CCScheduledActionDrawAndSwapResult(true, true);
}
@@ -324,7 +325,7 @@ public:
virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE
{
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return CCScheduledActionDrawAndSwapResult(true, true);
}
diff --git a/cc/scoped_ptr_hash_map.h b/cc/scoped_ptr_hash_map.h
index 1cea5c0..60eadee 100644
--- a/cc/scoped_ptr_hash_map.h
+++ b/cc/scoped_ptr_hash_map.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
+#include "base/logging.h"
#include "base/stl_util.h"
#include "base/memory/scoped_ptr.h"
@@ -66,7 +67,7 @@ class ScopedPtrHashMap {
}
scoped_ptr<Value> take(iterator it) {
- ASSERT(it != data_.end());
+ DCHECK(it != data_.end());
if (it == data_.end())
return scoped_ptr<Value>(NULL);
@@ -86,7 +87,7 @@ class ScopedPtrHashMap {
}
scoped_ptr<Value> take_and_erase(iterator it) {
- ASSERT(it != data_.end());
+ DCHECK(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 05e38d9..28c0014 100644
--- a/cc/scoped_ptr_vector.h
+++ b/cc/scoped_ptr_vector.h
@@ -6,6 +6,7 @@
#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"
@@ -31,7 +32,7 @@ class ScopedPtrVector {
}
T* Peek(size_t index) const {
- ASSERT(index < size());
+ DCHECK(index < size());
return data_[index];
}
@@ -40,12 +41,12 @@ class ScopedPtrVector {
}
T* first() const {
- ASSERT(!isEmpty());
+ DCHECK(!isEmpty());
return Peek(0);
}
T* last() const {
- ASSERT(!isEmpty());
+ DCHECK(!isEmpty());
return Peek(size() - 1);
}
@@ -54,14 +55,14 @@ class ScopedPtrVector {
}
scoped_ptr<T> take(size_t index) {
- ASSERT(index < size());
+ DCHECK(index < size());
scoped_ptr<T> ret(data_[index]);
data_[index] = NULL;
return ret.Pass();
}
void remove(size_t index) {
- ASSERT(index < size());
+ DCHECK(index < size());
delete data_[index];
data_.erase(data_.begin() + index);
}
@@ -75,7 +76,7 @@ class ScopedPtrVector {
}
void insert(size_t index, scoped_ptr<T> item) {
- ASSERT(index < size());
+ DCHECK(index < size());
data_.insert(data_.begin() + index, item.release());
}
diff --git a/cc/scoped_texture.cc b/cc/scoped_texture.cc
index d43ebe3..f5a5feb 100644
--- a/cc/scoped_texture.cc
+++ b/cc/scoped_texture.cc
@@ -11,7 +11,7 @@ namespace cc {
CCScopedTexture::CCScopedTexture(CCResourceProvider* resourceProvider)
: m_resourceProvider(resourceProvider)
{
- ASSERT(m_resourceProvider);
+ DCHECK(m_resourceProvider);
}
CCScopedTexture::~CCScopedTexture()
@@ -21,13 +21,13 @@ CCScopedTexture::~CCScopedTexture()
bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint)
{
- ASSERT(!id());
- ASSERT(!size.isEmpty());
+ DCHECK(!id());
+ DCHECK(!size.isEmpty());
setDimensions(size, format);
setId(m_resourceProvider->createResource(pool, size, format, hint));
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
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()) {
- ASSERT(m_allocateThreadIdentifier == base::PlatformThread::CurrentId());
+ DCHECK(m_allocateThreadIdentifier == base::PlatformThread::CurrentId());
m_resourceProvider->deleteResource(id());
}
setId(0);
diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h
index 7e27fd5..5ca8acd 100644
--- a/cc/scoped_texture.h
+++ b/cc/scoped_texture.h
@@ -7,9 +7,10 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "cc/dcheck.h"
#include "CCTexture.h"
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
#include "base/threading/platform_thread.h"
#endif
@@ -35,7 +36,7 @@ protected:
private:
CCResourceProvider* m_resourceProvider;
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
base::PlatformThreadId m_allocateThreadIdentifier;
#endif
diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h
index 802046d..c6ac440 100644
--- a/cc/scoped_thread_proxy.h
+++ b/cc/scoped_thread_proxy.h
@@ -6,6 +6,7 @@
#define CCScopedThreadProxy_h
#include "CCThreadTask.h"
+#include "base/logging.h"
#include "base/threading/platform_thread.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -27,7 +28,7 @@ class CCScopedThreadProxy : public ThreadSafeRefCounted<CCScopedThreadProxy> {
public:
static PassRefPtr<CCScopedThreadProxy> create(CCThread* targetThread)
{
- ASSERT(base::PlatformThread::CurrentId() == targetThread->threadID());
+ DCHECK(base::PlatformThread::CurrentId() == targetThread->threadID());
return adoptRef(new CCScopedThreadProxy(targetThread));
}
@@ -43,8 +44,8 @@ public:
void shutdown()
{
- ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
- ASSERT(!m_shutdown);
+ DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID());
+ DCHECK(!m_shutdown);
m_shutdown = true;
}
@@ -60,7 +61,7 @@ private:
deref();
return;
}
- ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
+ DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID());
task->performTask();
deref();
}
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index d75a79c..ed9a21d 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.
- ASSERT(texture->texture()->canAcquireBackingTexture());
+ DCHECK(texture->texture()->canAcquireBackingTexture());
if (!texture->texture()->canAcquireBackingTexture())
return;
diff --git a/cc/shader.cc b/cc/shader.cc
index b936dd9..7eaee7b 100644
--- a/cc/shader.cc
+++ b/cc/shader.cc
@@ -6,6 +6,7 @@
#include "cc/shader.h"
+#include "base/logging.h"
#include <public/WebGraphicsContext3D.h>
#include <wtf/StdLibExtras.h>
@@ -21,7 +22,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 ++) {
- ASSERT(uniformIndex < maxLocations);
+ DCHECK(uniformIndex < maxLocations);
if (usingBindUniform) {
locations[uniformIndex] = (*baseUniformIndex)++;
@@ -48,7 +49,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];
- ASSERT(m_matrixLocation != -1);
+ DCHECK(m_matrixLocation != -1);
}
std::string VertexShaderPosTex::getShaderString() const
@@ -87,7 +88,7 @@ void VertexShaderPosTexYUVStretch::init(WebGraphicsContext3D* context, unsigned
m_matrixLocation = locations[0];
m_yWidthScaleFactorLocation = locations[1];
m_uvWidthScaleFactorLocation = locations[2];
- ASSERT(m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1);
+ DCHECK(m_matrixLocation != -1 && m_yWidthScaleFactorLocation != -1 && m_uvWidthScaleFactorLocation != -1);
}
std::string VertexShaderPosTexYUVStretch::getShaderString() const
@@ -125,7 +126,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];
- ASSERT(m_matrixLocation != -1);
+ DCHECK(m_matrixLocation != -1);
}
std::string VertexShaderPos::getShaderString() const
@@ -158,7 +159,7 @@ void VertexShaderPosTexTransform::init(WebGraphicsContext3D* context, unsigned p
m_matrixLocation = locations[0];
m_texTransformLocation = locations[1];
- ASSERT(m_matrixLocation != -1 && m_texTransformLocation != -1);
+ DCHECK(m_matrixLocation != -1 && m_texTransformLocation != -1);
}
std::string VertexShaderPosTexTransform::getShaderString() const
@@ -208,7 +209,7 @@ void VertexShaderQuad::init(WebGraphicsContext3D* context, unsigned program, boo
m_matrixLocation = locations[0];
m_pointLocation = locations[1];
- ASSERT(m_matrixLocation != -1 && m_pointLocation != -1);
+ DCHECK(m_matrixLocation != -1 && m_pointLocation != -1);
}
std::string VertexShaderQuad::getShaderString() const
@@ -254,7 +255,7 @@ void VertexShaderTile::init(WebGraphicsContext3D* context, unsigned program, boo
m_matrixLocation = locations[0];
m_pointLocation = locations[1];
m_vertexTexTransformLocation = locations[2];
- ASSERT(m_matrixLocation != -1 && m_pointLocation != -1 && m_vertexTexTransformLocation != -1);
+ DCHECK(m_matrixLocation != -1 && m_pointLocation != -1 && m_vertexTexTransformLocation != -1);
}
std::string VertexShaderTile::getShaderString() const
@@ -335,7 +336,7 @@ void FragmentTexAlphaBinding::init(WebGraphicsContext3D* context, unsigned progr
m_samplerLocation = locations[0];
m_alphaLocation = locations[1];
- ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1);
+ DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1);
}
FragmentTexOpaqueBinding::FragmentTexOpaqueBinding()
@@ -353,7 +354,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];
- ASSERT(m_samplerLocation != -1);
+ DCHECK(m_samplerLocation != -1);
}
std::string FragmentShaderRGBATexFlipAlpha::getShaderString() const
@@ -521,7 +522,7 @@ void FragmentShaderRGBATexAlphaAA::init(WebGraphicsContext3D* context, unsigned
m_samplerLocation = locations[0];
m_alphaLocation = locations[1];
m_edgeLocation = locations[2];
- ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1);
+ DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1);
}
std::string FragmentShaderRGBATexAlphaAA::getShaderString() const
@@ -573,7 +574,7 @@ void FragmentTexClampAlphaAABinding::init(WebGraphicsContext3D* context, unsigne
m_alphaLocation = locations[1];
m_fragmentTexTransformLocation = locations[2];
m_edgeLocation = locations[3];
- ASSERT(m_samplerLocation != -1 && m_alphaLocation != -1 && m_fragmentTexTransformLocation != -1 && m_edgeLocation != -1);
+ DCHECK(m_samplerLocation != -1 && m_alphaLocation != -1 && m_fragmentTexTransformLocation != -1 && m_edgeLocation != -1);
}
std::string FragmentShaderRGBATexClampAlphaAA::getShaderString() const
@@ -656,7 +657,7 @@ void FragmentShaderRGBATexAlphaMask::init(WebGraphicsContext3D* context, unsigne
m_alphaLocation = locations[2];
m_maskTexCoordScaleLocation = locations[3];
m_maskTexCoordOffsetLocation = locations[4];
- ASSERT(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1);
+ DCHECK(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1);
}
std::string FragmentShaderRGBATexAlphaMask::getShaderString() const
@@ -708,7 +709,7 @@ void FragmentShaderRGBATexAlphaMaskAA::init(WebGraphicsContext3D* context, unsig
m_edgeLocation = locations[3];
m_maskTexCoordScaleLocation = locations[4];
m_maskTexCoordOffsetLocation = locations[5];
- ASSERT(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1);
+ DCHECK(m_samplerLocation != -1 && m_maskSamplerLocation != -1 && m_alphaLocation != -1 && m_edgeLocation != -1);
}
std::string FragmentShaderRGBATexAlphaMaskAA::getShaderString() const
@@ -772,7 +773,7 @@ void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned progra
m_ccMatrixLocation = locations[4];
m_yuvAdjLocation = locations[5];
- ASSERT(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1
+ DCHECK(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLocation != -1
&& m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocation != -1);
}
@@ -816,7 +817,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];
- ASSERT(m_colorLocation != -1);
+ DCHECK(m_colorLocation != -1);
}
std::string FragmentShaderColor::getShaderString() const
@@ -854,7 +855,7 @@ void FragmentShaderCheckerboard::init(WebGraphicsContext3D* context, unsigned pr
m_texTransformLocation = locations[1];
m_frequencyLocation = locations[2];
m_colorLocation = locations[3];
- ASSERT(m_alphaLocation != -1 && m_texTransformLocation != -1 && m_frequencyLocation != -1 && m_colorLocation != -1);
+ DCHECK(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 e9ac8e7..bffcba1 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");
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
}
void CCSingleThreadProxy::start()
@@ -43,14 +43,14 @@ void CCSingleThreadProxy::start()
CCSingleThreadProxy::~CCSingleThreadProxy()
{
TRACE_EVENT0("cc", "CCSingleThreadProxy::~CCSingleThreadProxy");
- ASSERT(CCProxy::isMainThread());
- ASSERT(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called.
+ DCHECK(CCProxy::isMainThread());
+ DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called.
}
bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
TRACE_EVENT0("cc", "CCSingleThreadProxy::compositeAndReadback");
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (!commitAndComposite())
return false;
@@ -73,7 +73,7 @@ void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition,
void CCSingleThreadProxy::finishAllRendering()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
{
DebugScopedSetImplThread impl;
m_layerTreeHostImpl->finishAllRendering();
@@ -82,13 +82,13 @@ void CCSingleThreadProxy::finishAllRendering()
bool CCSingleThreadProxy::isStarted() const
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
return m_layerTreeHostImpl.get();
}
bool CCSingleThreadProxy::initializeContext()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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()
{
- ASSERT(CCProxy::isMainThread());
- ASSERT(m_contextBeforeInitialization.get());
+ DCHECK(CCProxy::isMainThread());
+ DCHECK(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");
- ASSERT(CCProxy::isMainThread());
- ASSERT(m_contextLost);
+ DCHECK(CCProxy::isMainThread());
+ DCHECK(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
{
- ASSERT(m_rendererInitialized);
+ DCHECK(m_rendererInitialized);
// Note: this gets called during the commit by the "impl" thread
return m_RendererCapabilitiesForMainThread;
}
void CCSingleThreadProxy::loseContext()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
m_layerTreeHost->didLoseContext();
m_contextLost = true;
}
@@ -175,12 +175,12 @@ void CCSingleThreadProxy::loseContext()
void CCSingleThreadProxy::setNeedsAnimate()
{
// CCThread-only feature
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
// Commit immediately
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
@@ -205,11 +205,11 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue)
m_layerTreeHostImpl->commitComplete();
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
// In the single-threaded case, the scroll deltas should never be
// touched on the impl layer tree.
scoped_ptr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
- ASSERT(!scrollInfo->scrolls.size());
+ DCHECK(!scrollInfo->scrolls.size());
#endif
base::TimeTicks endTime = base::TimeTicks::HighResNow();
@@ -222,7 +222,7 @@ void CCSingleThreadProxy::doCommit(scoped_ptr<CCTextureUpdateQueue> queue)
void CCSingleThreadProxy::setNeedsCommit()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
m_layerTreeHost->scheduleComposite();
}
@@ -251,7 +251,7 @@ size_t CCSingleThreadProxy::maxPartialTextureUpdates() const
void CCSingleThreadProxy::stop()
{
TRACE_EVENT0("cc", "CCSingleThreadProxy::stop");
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
DebugScopedSetImplThread impl;
@@ -275,14 +275,14 @@ void CCSingleThreadProxy::setNeedsCommitOnImplThread()
void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector> events, double wallClockTime)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
DebugScopedSetMainThread main;
m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime);
}
void CCSingleThreadProxy::releaseContentsTexturesOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
if (m_layerTreeHost->contentsTextureManager())
m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider());
}
@@ -307,12 +307,12 @@ void CCSingleThreadProxy::forceSerializeOnSwapBuffers()
void CCSingleThreadProxy::onSwapBuffersCompleteOnImplThread()
{
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
bool CCSingleThreadProxy::commitAndComposite()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (!m_layerTreeHost->initializeRendererIfNeeded())
return false;
@@ -340,7 +340,7 @@ bool CCSingleThreadProxy::commitAndComposite()
bool CCSingleThreadProxy::doComposite()
{
- ASSERT(!m_contextLost);
+ DCHECK(!m_contextLost);
{
DebugScopedSetImplThread impl;
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 2bbacef..d43d874 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 !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
CCProxy::setCurrentThreadIsImplThread(true);
#endif
}
~DebugScopedSetImplThread()
{
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
CCProxy::setCurrentThreadIsImplThread(false);
#endif
}
@@ -108,13 +108,13 @@ class DebugScopedSetMainThread {
public:
DebugScopedSetMainThread()
{
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
CCProxy::setCurrentThreadIsImplThread(false);
#endif
}
~DebugScopedSetMainThread()
{
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
CCProxy::setCurrentThreadIsImplThread(true);
#endif
}
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index 0aeb33b..b441f8d 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)
{
- ASSERT(isSoftwareResource(quad->resourceId()));
+ DCHECK(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;
- ASSERT(isSoftwareResource(contentsTexture->id()));
+ DCHECK(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 157acd9..dca3cc5 100644
--- a/cc/solid_color_draw_quad.cc
+++ b/cc/solid_color_draw_quad.cc
@@ -6,6 +6,8 @@
#include "CCSolidColorDrawQuad.h"
+#include "base/logging.h"
+
namespace cc {
scoped_ptr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color)
@@ -25,7 +27,7 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt
const CCSolidColorDrawQuad* CCSolidColorDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::SolidColor);
+ DCHECK(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 e92d98a..c10d633 100644
--- a/cc/stream_video_draw_quad.cc
+++ b/cc/stream_video_draw_quad.cc
@@ -6,6 +6,8 @@
#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)
@@ -22,7 +24,7 @@ CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuad
const CCStreamVideoDrawQuad* CCStreamVideoDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::StreamVideoContent);
+ DCHECK(quad->material() == CCDrawQuad::StreamVideoContent);
return static_cast<const CCStreamVideoDrawQuad*>(quad);
}
diff --git a/cc/stubs/config.h b/cc/stubs/config.h
new file mode 100644
index 0000000..3b2b573
--- /dev/null
+++ b/cc/stubs/config.h
@@ -0,0 +1,17 @@
+// 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 75587a3..811d6b9 100644
--- a/cc/stubs/trace_event.h
+++ b/cc/stubs/trace_event.h
@@ -2,9 +2,4 @@
// 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 2d3128c..fb4f314 100644
--- a/cc/test/fake_web_compositor_output_surface.h
+++ b/cc/test/fake_web_compositor_output_surface.h
@@ -5,6 +5,7 @@
#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>
@@ -30,7 +31,7 @@ public:
{
if (!m_context3D)
return true;
- ASSERT(client);
+ DCHECK(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 356833b..b71adee 100644
--- a/cc/test/fake_web_compositor_software_output_device.h
+++ b/cc/test/fake_web_compositor_software_output_device.h
@@ -5,6 +5,7 @@
#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>
@@ -17,7 +18,7 @@ class FakeWebCompositorSoftwareOutputDevice : public WebCompositorSoftwareOutput
public:
virtual WebImage* lock(bool forWrite) OVERRIDE
{
- ASSERT(m_device.get());
+ DCHECK(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 3e58f36..e956b5d 100644
--- a/cc/test/scheduler_test_common.cc
+++ b/cc/test/scheduler_test_common.cc
@@ -6,6 +6,8 @@
#include "cc/test/scheduler_test_common.h"
+#include "base/logging.h"
+
namespace WebKitTests {
void FakeCCTimeSourceClient::onTimerTick()
@@ -24,7 +26,7 @@ FakeCCThread::~FakeCCThread()
void FakeCCThread::postTask(PassOwnPtr<Task>)
{
- ASSERT_NOT_REACHED();
+ NOTREACHED();
}
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 2f6660b..3b73d0d 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(m_pendingTask);
+ ASSERT_TRUE(m_pendingTask);
OwnPtr<Task> task = m_pendingTask.release();
task->performTask();
}
@@ -87,7 +87,7 @@ public:
void tick()
{
- ASSERT(m_active);
+ ASSERT_TRUE(m_active);
if (m_client)
m_client->onTimerTick();
}
diff --git a/cc/texture_copier.cc b/cc/texture_copier.cc
index 73121b8..3a5e7c5 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)
{
- ASSERT(m_context);
+ DCHECK(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 db985ad..0bb0cef 100644
--- a/cc/texture_draw_quad.cc
+++ b/cc/texture_draw_quad.cc
@@ -6,6 +6,8 @@
#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)
@@ -29,7 +31,7 @@ void CCTextureDrawQuad::setNeedsBlending()
const CCTextureDrawQuad* CCTextureDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::TextureContent);
+ DCHECK(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 4c81709..bb92ed8 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;
- ASSERT(!m_externalTextureResource);
+ DCHECK(!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.
- ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource));
+ DCHECK(!resourceProvider->inUseByConsumer(m_externalTextureResource));
resourceProvider->deleteResource(m_externalTextureResource);
m_externalTextureResource = 0;
}
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index 2e1e74d..6e76d46 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");
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
}
CCThreadProxy::~CCThreadProxy()
{
TRACE_EVENT0("cc", "CCThreadProxy::~CCThreadProxy");
- ASSERT(isMainThread());
- ASSERT(!m_started);
+ DCHECK(isMainThread());
+ DCHECK(!m_started);
}
bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
TRACE_EVENT0("cc", "CCThreadPRoxy::compositeAndReadback");
- ASSERT(isMainThread());
- ASSERT(m_layerTreeHost);
+ DCHECK(isMainThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(!m_readbackRequestOnImplThread);
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(!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)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, duration));
}
void CCThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double duration)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
if (m_layerTreeHostImpl.get())
m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration);
}
void CCThreadProxy::finishAllRendering()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
return m_started;
}
@@ -212,7 +212,7 @@ bool CCThreadProxy::initializeRenderer()
bool CCThreadProxy::recreateContext()
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContext");
- ASSERT(isMainThread());
+ DCHECK(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)
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
@@ -258,7 +258,7 @@ void CCThreadProxy::renderingStats(CCRenderingStats* stats)
const RendererCapabilities& CCThreadProxy::rendererCapabilities() const
{
- ASSERT(m_rendererInitialized);
+ DCHECK(m_rendererInitialized);
return m_RendererCapabilitiesMainThreadCopy;
}
@@ -269,7 +269,7 @@ void CCThreadProxy::loseContext()
void CCThreadProxy::setNeedsAnimate()
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (m_animateRequested)
return;
@@ -284,7 +284,7 @@ void CCThreadProxy::setNeedsAnimate()
void CCThreadProxy::setNeedsCommit()
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (m_commitRequested)
return;
TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommit");
@@ -298,14 +298,14 @@ void CCThreadProxy::setNeedsCommit()
void CCThreadProxy::didLoseContextOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread");
m_schedulerOnImplThread->didLoseContext();
}
void CCThreadProxy::onSwapBuffersCompleteOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(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)
{
- ASSERT(isImplThread());
+ DCHECK(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)
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
TRACE_EVENT1("cc", "CCThreadProxy::onCanDrawStateChanged", "canDraw", canDraw);
m_schedulerOnImplThread->setCanDraw(canDraw);
}
void CCThreadProxy::setNeedsCommitOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
TRACE_EVENT0("cc", "CCThreadProxy::setNeedsCommitOnImplThread");
m_schedulerOnImplThread->setNeedsCommit();
}
void CCThreadProxy::setNeedsForcedCommitOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(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)
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
TRACE_EVENT0("cc", "CCThreadProxy::postAnimationEventsToMainThreadOnImplThread");
m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events.release(), wallClockTime));
}
void CCThreadProxy::releaseContentsTexturesOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
if (m_layerTreeHost->contentsTextureManager())
m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider());
@@ -364,7 +364,7 @@ void CCThreadProxy::releaseContentsTexturesOnImplThread()
void CCThreadProxy::setNeedsRedraw()
{
- ASSERT(isMainThread());
+ DCHECK(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
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
return m_commitRequested;
}
void CCThreadProxy::setNeedsRedrawOnImplThread()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedrawOnImplThread");
m_schedulerOnImplThread->setNeedsRedraw();
}
void CCThreadProxy::start()
{
- ASSERT(isMainThread());
- ASSERT(CCProxy::implThread());
+ DCHECK(isMainThread());
+ DCHECK(CCProxy::implThread());
// Create LayerTreeHostImpl.
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
@@ -400,8 +400,8 @@ void CCThreadProxy::start()
void CCThreadProxy::stop()
{
TRACE_EVENT0("cc", "CCThreadProxy::stop");
- ASSERT(isMainThread());
- ASSERT(m_started);
+ DCHECK(isMainThread());
+ DCHECK(m_started);
// Synchronously deletes the impl.
{
@@ -414,7 +414,7 @@ void CCThreadProxy::stop()
m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.
- ASSERT(!m_layerTreeHostImpl.get()); // verify that the impl deleted.
+ DCHECK(!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");
- ASSERT(isImplThread());
+ DCHECK(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");
- ASSERT(!m_beginFrameCompletionEventOnImplThread);
+ DCHECK(!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");
- ASSERT(!m_pendingBeginFrameRequest);
+ DCHECK(!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");
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (!m_layerTreeHost)
return;
@@ -588,10 +588,10 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
scoped_ptr<CCTextureUpdateQueue> queue(rawQueue);
TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
- ASSERT(!m_commitCompletionEventOnImplThread);
- ASSERT(isImplThread() && isMainThreadBlocked());
- ASSERT(m_schedulerOnImplThread);
- ASSERT(m_schedulerOnImplThread->commitPending());
+ DCHECK(!m_commitCompletionEventOnImplThread);
+ DCHECK(isImplThread() && isMainThreadBlocked());
+ DCHECK(m_schedulerOnImplThread);
+ DCHECK(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");
- ASSERT(isImplThread());
- ASSERT(m_schedulerOnImplThread);
- ASSERT(m_schedulerOnImplThread->commitPending());
+ DCHECK(isImplThread());
+ DCHECK(m_schedulerOnImplThread);
+ DCHECK(m_schedulerOnImplThread->commitPending());
m_schedulerOnImplThread->beginFrameAborted();
}
@@ -630,9 +630,9 @@ void CCThreadProxy::beginFrameAbortedOnImplThread()
void CCThreadProxy::scheduledActionCommit()
{
TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit");
- ASSERT(isImplThread());
- ASSERT(m_commitCompletionEventOnImplThread);
- ASSERT(m_currentTextureUpdateControllerOnImplThread);
+ DCHECK(isImplThread());
+ DCHECK(m_commitCompletionEventOnImplThread);
+ DCHECK(m_currentTextureUpdateControllerOnImplThread);
// Complete all remaining texture updates.
m_currentTextureUpdateControllerOnImplThread->finalize();
@@ -664,7 +664,7 @@ void CCThreadProxy::scheduledActionCommit()
void CCThreadProxy::scheduledActionBeginContextRecreation()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginContextRecreation));
}
@@ -674,12 +674,12 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte
CCScheduledActionDrawAndSwapResult result;
result.didDraw = false;
result.didSwap = false;
- ASSERT(isImplThread());
- ASSERT(m_layerTreeHostImpl.get());
+ DCHECK(isImplThread());
+ DCHECK(m_layerTreeHostImpl.get());
if (!m_layerTreeHostImpl.get())
return result;
- ASSERT(m_layerTreeHostImpl->renderer());
+ DCHECK(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.
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (m_texturesAcquired)
return;
@@ -752,8 +752,8 @@ void CCThreadProxy::acquireLayerTextures()
void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent* completion)
{
- ASSERT(isImplThread());
- ASSERT(!m_textureAcquisitionCompletionEventOnImplThread);
+ DCHECK(isImplThread());
+ DCHECK(!m_textureAcquisitionCompletionEventOnImplThread);
m_textureAcquisitionCompletionEventOnImplThread = completion;
m_schedulerOnImplThread->setMainThreadNeedsLayerTextures();
@@ -761,7 +761,7 @@ void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEv
void CCThreadProxy::scheduledActionAcquireLayerTexturesForMainThread()
{
- ASSERT(m_textureAcquisitionCompletionEventOnImplThread);
+ DCHECK(m_textureAcquisitionCompletionEventOnImplThread);
m_textureAcquisitionCompletionEventOnImplThread->signal();
m_textureAcquisitionCompletionEventOnImplThread = 0;
}
@@ -786,13 +786,13 @@ void CCThreadProxy::didAnticipatedDrawTimeChange(base::TimeTicks time)
void CCThreadProxy::readyToFinalizeTextureUpdates()
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
m_schedulerOnImplThread->beginFrameComplete();
}
void CCThreadProxy::didCommitAndDrawFrame()
{
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (!m_layerTreeHost)
return;
m_layerTreeHost->didCommitAndDrawFrame();
@@ -800,7 +800,7 @@ void CCThreadProxy::didCommitAndDrawFrame()
void CCThreadProxy::didCompleteSwapBuffers()
{
- ASSERT(isMainThread());
+ DCHECK(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");
- ASSERT(isMainThread());
+ DCHECK(isMainThread());
if (!m_layerTreeHost)
return;
m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime);
@@ -839,8 +839,8 @@ private:
void CCThreadProxy::beginContextRecreation()
{
TRACE_EVENT0("cc", "CCThreadProxy::beginContextRecreation");
- ASSERT(isMainThread());
- ASSERT(!m_contextRecreationTimer);
+ DCHECK(isMainThread());
+ DCHECK(!m_contextRecreationTimer);
m_contextRecreationTimer = CCThreadProxyContextRecreationTimer::create(this);
m_layerTreeHost->didLoseContext();
m_contextRecreationTimer->startOneShot(contextRecreationTickRate);
@@ -848,8 +848,8 @@ void CCThreadProxy::beginContextRecreation()
void CCThreadProxy::tryToRecreateContext()
{
- ASSERT(isMainThread());
- ASSERT(m_layerTreeHost);
+ DCHECK(isMainThread());
+ DCHECK(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");
- ASSERT(isImplThread());
+ DCHECK(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");
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
m_contextBeforeInitializationOnImplThread = scoped_ptr<CCGraphicsContext>(context).Pass();
}
void CCThreadProxy::initializeRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, RendererCapabilities* capabilities)
{
TRACE_EVENT0("cc", "CCThreadProxy::initializeRendererOnImplThread");
- ASSERT(isImplThread());
- ASSERT(m_contextBeforeInitializationOnImplThread.get());
+ DCHECK(isImplThread());
+ DCHECK(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");
- ASSERT(isImplThread());
+ DCHECK(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()
{
- ASSERT(isImplThread());
+ DCHECK(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");
- ASSERT(isImplThread());
+ DCHECK(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)
{
- ASSERT(isImplThread());
+ DCHECK(isImplThread());
m_layerTreeHostImpl->renderingStats(stats);
completion->signal();
}
diff --git a/cc/threaded_unittest.cc b/cc/threaded_unittest.cc
index ebeaa70..6465fdb 100644
--- a/cc/threaded_unittest.cc
+++ b/cc/threaded_unittest.cc
@@ -378,7 +378,7 @@ void CCThreadedTest::postDidAddAnimationToMainThread()
void CCThreadedTest::doBeginTest()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
m_client = MockLayerTreeHostClient::create(this);
scoped_refptr<LayerChromium> rootLayer = LayerChromium::create();
@@ -411,13 +411,13 @@ void CCThreadedTest::scheduleComposite()
void CCThreadedTest::realEndTest()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
WebKit::Platform::current()->currentThread()->exitRunLoop();
}
void CCThreadedTest::dispatchSetNeedsAnimate()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -428,7 +428,7 @@ void CCThreadedTest::dispatchSetNeedsAnimate()
void CCThreadedTest::dispatchAddInstantAnimation()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -439,7 +439,7 @@ void CCThreadedTest::dispatchAddInstantAnimation()
void CCThreadedTest::dispatchAddAnimation()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -450,7 +450,7 @@ void CCThreadedTest::dispatchAddAnimation()
void CCThreadedTest::dispatchSetNeedsAnimateAndCommit()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -463,7 +463,7 @@ void CCThreadedTest::dispatchSetNeedsAnimateAndCommit()
void CCThreadedTest::dispatchSetNeedsCommit()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -474,7 +474,7 @@ void CCThreadedTest::dispatchSetNeedsCommit()
void CCThreadedTest::dispatchAcquireLayerTextures()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -485,7 +485,7 @@ void CCThreadedTest::dispatchAcquireLayerTextures()
void CCThreadedTest::dispatchSetNeedsRedraw()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -496,7 +496,7 @@ void CCThreadedTest::dispatchSetNeedsRedraw()
void CCThreadedTest::dispatchSetVisible(bool visible)
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -514,7 +514,7 @@ void CCThreadedTest::dispatchComposite()
void CCThreadedTest::dispatchDidAddAnimation()
{
- ASSERT(CCProxy::isMainThread());
+ DCHECK(CCProxy::isMainThread());
if (m_finished)
return;
@@ -534,7 +534,7 @@ void CCThreadedTest::runTest(bool threaded)
} else
Platform::current()->compositorSupport()->initialize(0);
- ASSERT(CCProxy::isMainThread());
+ DCHECK(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 2ad0309..2b5bf20 100644
--- a/cc/throttled_texture_uploader.cc
+++ b/cc/throttled_texture_uploader.cc
@@ -136,7 +136,7 @@ void ThrottledTextureUploader::markPendingUploadsAsNonBlocking()
it->get()->markAsNonBlocking();
}
- ASSERT(!m_numBlockingTextureUploads);
+ DCHECK(!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.
- ASSERT(m_texturesPerSecondHistory.size() == uploadHistorySize);
+ DCHECK(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);
- ASSERT(texture->haveBackingTexture());
+ DCHECK(texture->haveBackingTexture());
- ASSERT(resourceProvider->resourceType(texture->resourceId()) ==
- CCResourceProvider::GLTexture);
+ DCHECK(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 a5ac33d..0ffe46c 100644
--- a/cc/tile_draw_quad.cc
+++ b/cc/tile_draw_quad.cc
@@ -6,6 +6,8 @@
#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)
@@ -32,7 +34,7 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I
const CCTileDrawQuad* CCTileDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::TiledContent);
+ DCHECK(quad->material() == CCDrawQuad::TiledContent);
return static_cast<const CCTileDrawQuad*>(quad);
}
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index 1ea1e25..e7adf54 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -97,7 +97,7 @@ scoped_ptr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl()
void TiledLayerChromium::updateTileSizeAndTilingOption()
{
- ASSERT(layerTreeHost());
+ DCHECK(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);
- ASSERT(tile);
+ DCHECK(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);
- ASSERT(tile); // Did setTexturePriorities get skipped?
+ DCHECK(tile); // Did setTexturePriorities get skipped?
// FIXME: This should not ever be null.
if (!tile)
continue;
- ASSERT(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass?
+ DCHECK(!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);
- ASSERT(tile); // Did setTexturePriorites get skipped?
+ DCHECK(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);
- ASSERT(tile); // Did setTexturePriorites get skipped?
+ DCHECK(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);
- ASSERT(tile); // Did setTexturePriorites get skipped?
+ DCHECK(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)
{
- ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped?
+ DCHECK(!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);
- ASSERT(tile); // Did setTexturePriorities get skipped?
+ DCHECK(tile); // Did setTexturePriorities get skipped?
if (!tile)
continue;
diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc
index 84af8bc..7cd33d2 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.
- ASSERT(m_tiler);
- ASSERT(m_tiler->numTilesX() == 1);
- ASSERT(m_tiler->numTilesY() == 1);
+ DCHECK(m_tiler);
+ DCHECK(m_tiler->numTilesX() == 1);
+ DCHECK(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 11c4acc..980ca65 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -101,7 +101,7 @@ public:
void updateTextures()
{
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- ASSERT(m_queue);
+ DCHECK(m_queue);
scoped_ptr<CCTextureUpdateController> updateController =
CCTextureUpdateController::create(
NULL,
diff --git a/cc/timer.cc b/cc/timer.cc
index 089c12b..b5b9206 100644
--- a/cc/timer.cc
+++ b/cc/timer.cc
@@ -7,6 +7,7 @@
#include "CCTimer.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
#include "CCThread.h"
namespace cc {
@@ -24,7 +25,7 @@ public:
if (!m_timer)
return;
- ASSERT(m_timer->m_task == this);
+ DCHECK(m_timer->m_task == this);
m_timer->stop();
}
diff --git a/cc/tree_synchronizer.cc b/cc/tree_synchronizer.cc
index fdea6e2..201d0f4 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;
- ASSERT(ccScrollbarLayerImpl);
- ASSERT(ccScrollLayerImpl);
+ DCHECK(ccScrollbarLayerImpl);
+ DCHECK(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 4aaf6b0..e76c805 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();
}
- ASSERT(!upload.picture);
+ DCHECK(!upload.picture);
}
}
diff --git a/cc/video_layer.cc b/cc/video_layer.cc
index 5bf7982..459c6dc 100644
--- a/cc/video_layer.cc
+++ b/cc/video_layer.cc
@@ -19,7 +19,7 @@ VideoLayerChromium::VideoLayerChromium(WebKit::WebVideoFrameProvider* provider)
: LayerChromium()
, m_provider(provider)
{
- ASSERT(m_provider);
+ DCHECK(m_provider);
}
VideoLayerChromium::~VideoLayerChromium()
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc
index dee1360..cf5c048 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.
- ASSERT(CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isMainThreadBlocked());
m_provider->setVideoFrameProviderClient(this);
}
CCVideoLayerImpl::~CCVideoLayerImpl()
{
// See comment in constructor for why this doesn't need a lock.
- ASSERT(CCProxy::isMainThreadBlocked());
+ DCHECK(CCProxy::isMainThreadBlocked());
if (m_provider) {
m_provider->setVideoFrameProviderClient(0);
m_provider = 0;
}
freePlaneData(layerTreeHostImpl()->resourceProvider());
-#if !ASSERT_DISABLED
+#if CC_DCHECK_ENABLED()
for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i)
- ASSERT(!m_framePlanes[i].resourceId);
- ASSERT(!m_externalTextureResource);
+ DCHECK(!m_framePlanes[i].resourceId);
+ DCHECK(!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);
- ASSERT(!m_frame);
+ DCHECK(!m_frame);
m_provider = 0;
}
@@ -88,7 +88,7 @@ static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame)
void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(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)
{
- ASSERT(CCProxy::isImplThread());
- ASSERT(!m_externalTextureResource);
+ DCHECK(CCProxy::isImplThread());
+ DCHECK(!m_externalTextureResource);
if (!m_provider) {
m_frame = 0;
@@ -154,7 +154,7 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider)
void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
if (!m_frame)
return;
@@ -217,18 +217,18 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe
void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider)
{
- ASSERT(CCProxy::isImplThread());
+ DCHECK(CCProxy::isImplThread());
CCLayerImpl::didDraw(resourceProvider);
if (!m_frame)
return;
if (m_format == GraphicsContext3D::TEXTURE_2D) {
- ASSERT(m_externalTextureResource);
+ DCHECK(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.
- ASSERT(!resourceProvider->inUseByConsumer(m_externalTextureResource));
+ DCHECK(!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 41d5490..eec671b 100644
--- a/cc/yuv_video_draw_quad.cc
+++ b/cc/yuv_video_draw_quad.cc
@@ -6,6 +6,8 @@
#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)
@@ -23,7 +25,7 @@ CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState,
const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const CCDrawQuad* quad)
{
- ASSERT(quad->material() == CCDrawQuad::YUVVideoContent);
+ DCHECK(quad->material() == CCDrawQuad::YUVVideoContent);
return static_cast<const CCYUVVideoDrawQuad*>(quad);
}