Commit b207f31f authored by piman@chromium.org's avatar piman@chromium.org

Add traces in compositor, views and skia

BUG=None
TEST=None


Review URL: http://codereview.chromium.org/8440008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108174 0039d316-1c4b-4281-b951-d872f2087c98
parent f3ddcadf
......@@ -4,6 +4,7 @@
#include "skia/ext/platform_canvas.h"
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/platform_device.h"
#include "third_party/skia/include/core/SkTypes.h"
......@@ -11,12 +12,16 @@
namespace skia {
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
if (!initialize(width, height, is_opaque))
SK_CRASH();
}
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
if (!initialize(width, height, is_opaque, data))
SK_CRASH();
}
......
......@@ -4,12 +4,15 @@
#include "skia/ext/platform_canvas.h"
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device.h"
#include "third_party/skia/include/core/SkTypes.h"
namespace skia {
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(width, height, is_opaque);
}
......@@ -17,6 +20,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
CGContextRef context) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(context, width, height, is_opaque);
}
......@@ -24,6 +29,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
uint8_t* data) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
initialize(width, height, is_opaque, data);
}
......
......@@ -5,6 +5,7 @@
#include <windows.h>
#include <psapi.h>
#include "base/debug/trace_event.h"
#include "skia/ext/bitmap_platform_device_win.h"
#include "skia/ext/platform_canvas.h"
......@@ -77,6 +78,8 @@ void CrashIfInvalidSection(HANDLE shared_section) {
#pragma optimize("", on)
PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
bool initialized = initialize(width, height, is_opaque, NULL);
if (!initialized)
CrashForBitmapAllocationFailure(width, height);
......@@ -86,6 +89,8 @@ PlatformCanvas::PlatformCanvas(int width,
int height,
bool is_opaque,
HANDLE shared_section) {
TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
"width", width, "height", height);
bool initialized = initialize(width, height, is_opaque, shared_section);
if (!initialized) {
CrashIfInvalidSection(shared_section);
......
......@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
......@@ -336,6 +337,7 @@ TextureGL::~TextureGL() {
void TextureGL::SetCanvas(const SkCanvas& canvas,
const gfx::Point& origin,
const gfx::Size& overall_size) {
TRACE_EVENT0("ui", "TextureGL::SetCanvas");
const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false);
// Verify bitmap pixels are contiguous.
DCHECK_EQ(bitmap.rowBytes(),
......@@ -374,6 +376,7 @@ void TextureGL::SetCanvas(const SkCanvas& canvas,
void TextureGL::Draw(const ui::TextureDrawParams& params,
const gfx::Rect& clip_bounds_in_texture) {
TRACE_EVENT0("ui", "TextureGL::Draw");
SharedResourcesGL* instance = SharedResourcesGL::GetInstance();
DCHECK(instance);
DrawInternal(*instance->program_swizzle(),
......@@ -515,6 +518,7 @@ Texture* CompositorGL::CreateTexture() {
}
void CompositorGL::OnNotifyStart(bool clear) {
TRACE_EVENT0("ui", "CompositorGL::OnNotifyStart");
started_ = true;
gl_context_->MakeCurrent(gl_surface_.get());
glViewport(0, 0, size().width(), size().height());
......@@ -535,6 +539,7 @@ void CompositorGL::OnNotifyStart(bool clear) {
}
void CompositorGL::OnNotifyEnd() {
TRACE_EVENT0("ui", "CompositorGL::OnNotifyEnd");
DCHECK(started_);
gl_surface_->SwapBuffers();
started_ = false;
......
......@@ -6,6 +6,7 @@
#include <algorithm>
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h"
......@@ -304,6 +305,7 @@ void Layer::ScheduleDraw() {
}
void Layer::Draw() {
TRACE_EVENT0("ui", "Layer::Draw");
#if defined(USE_WEBKIT_COMPOSITOR)
NOTREACHED();
#else
......@@ -376,6 +378,7 @@ void Layer::notifyNeedsComposite() {
void Layer::paintContents(WebKit::WebCanvas* web_canvas,
const WebKit::WebRect& clip) {
TRACE_EVENT0("ui", "Layer::paintContents");
#if defined(USE_WEBKIT_COMPOSITOR)
gfx::CanvasSkia canvas(web_canvas);
delegate_->OnPaintLayer(&canvas);
......@@ -395,6 +398,7 @@ float Layer::GetCombinedOpacity() const {
}
void Layer::UpdateLayerCanvas() {
TRACE_EVENT0("ui", "Layer::UpdateLayerCanvas");
#if defined(USE_WEBKIT_COMPOSITOR)
NOTREACHED();
#else
......
......@@ -652,7 +652,7 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) {
}
void View::Paint(gfx::Canvas* canvas) {
TRACE_EVENT0("View", "Paint");
TRACE_EVENT0("views", "View::Paint");
ScopedCanvas scoped_canvas(canvas);
......@@ -1044,30 +1044,44 @@ void View::NativeViewHierarchyChanged(bool attached,
// Painting --------------------------------------------------------------------
void View::PaintChildren(gfx::Canvas* canvas) {
TRACE_EVENT0("views", "View::PaintChildren");
for (int i = 0, count = child_count(); i < count; ++i)
if (!child_at(i)->layer())
child_at(i)->Paint(canvas);
}
void View::OnPaint(gfx::Canvas* canvas) {
TRACE_EVENT0("views", "View::OnPaint");
OnPaintBackground(canvas);
OnPaintFocusBorder(canvas);
OnPaintBorder(canvas);
}
void View::OnPaintBackground(gfx::Canvas* canvas) {
if (background_.get())
if (background_.get()) {
TRACE_EVENT2("views", "View::OnPaintBackground",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
background_->Paint(canvas, this);
}
}
void View::OnPaintBorder(gfx::Canvas* canvas) {
if (border_.get())
if (border_.get()) {
TRACE_EVENT2("views", "View::OnPaintBorder",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
border_->Paint(*this, canvas);
}
}
void View::OnPaintFocusBorder(gfx::Canvas* canvas) {
if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus())
if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) {
TRACE_EVENT2("views", "views::OnPaintFocusBorder",
"width", canvas->GetSkCanvas()->getDevice()->width(),
"height", canvas->GetSkCanvas()->getDevice()->height());
canvas->DrawFocusRect(GetLocalBounds());
}
}
// Accelerated Painting --------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment