Source/WebCore/ChangeLog

 12012-06-29 Sergey Rogulenko <rogulenko@google.com>
 2
 3 Web Inspector: added DecodeImage and ResizeImage events to TimelineAgent
 4 https://bugs.webkit.org/show_bug.cgi?id=90277
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * English.lproj/localizedStrings.js:
 9 * inspector/InspectorInstrumentation.cpp:
 10 (WebCore::InspectorInstrumentation::willDecodeImageImpl):
 11 (WebCore):
 12 (WebCore::InspectorInstrumentation::didDecodeImageImpl):
 13 (WebCore::InspectorInstrumentation::willResizeImageImpl):
 14 (WebCore::InspectorInstrumentation::didResizeImageImpl):
 15 * inspector/InspectorInstrumentation.h:
 16 (InspectorInstrumentation):
 17 (WebCore::InspectorInstrumentation::willDecodeImage):
 18 (WebCore):
 19 (WebCore::InspectorInstrumentation::didDecodeImage):
 20 (WebCore::InspectorInstrumentation::willResizeImage):
 21 (WebCore::InspectorInstrumentation::didResizeImage):
 22 (WebCore::InspectorInstrumentation::willComposite):
 23 * inspector/InspectorTimelineAgent.cpp:
 24 (TimelineRecordType):
 25 (WebCore::InspectorTimelineAgent::ThreadSpecificInstance):
 26 (WebCore::InspectorTimelineAgent::willDecodeImage):
 27 (WebCore):
 28 (WebCore::InspectorTimelineAgent::didDecodeImage):
 29 (WebCore::InspectorTimelineAgent::willResizeImage):
 30 (WebCore::InspectorTimelineAgent::didResizeImage):
 31 * inspector/InspectorTimelineAgent.h:
 32 (InspectorTimelineAgent):
 33 (WebCore::InspectorTimelineAgent::instance):
 34 (WebCore::InspectorTimelineAgent::setInstance):
 35 * inspector/front-end/TimelineModel.js:
 36 * inspector/front-end/TimelinePanel.js:
 37 (WebInspector.TimelinePanel.prototype._mouseMove):
 38 * inspector/front-end/TimelinePresentationModel.js:
 39 (WebInspector.TimelinePresentationModel.recordStyle):
 40 (WebInspector.TimelinePresentationModel.Record.prototype.generatePopupContent):
 41 (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails):
 42 * platform/graphics/skia/ImageSkia.cpp:
 43 (WebCore::computeResamplingMode):
 44 (WebCore::BitmapImage::draw):
 45
 462012-06-29 Sergey Rogulenko <rogulenko@google.com>
 47
 48 Web Inspector: added low-level instrumentation support for TimelineAgent
 49 https://bugs.webkit.org/show_bug.cgi?id=90264
 50
 51 Reviewed by NOBODY (OOPS!).
 52
 53 * inspector/InspectorInstrumentation.cpp:
 54 (WebCore::InspectorInstrumentation::startLowlevelInspectingForFrame):
 55 (WebCore):
 56 * inspector/InspectorInstrumentation.h:
 57 (InspectorInstrumentation):
 58 (WebCore::InspectorInstrumentation::stopLowlevelInspecting):
 59 (WebCore):
 60 * inspector/InspectorTimelineAgent.cpp:
 61 (WebCore):
 62 * inspector/InspectorTimelineAgent.h:
 63 (WebCore::InspectorTimelineAgent::instance):
 64 (WebCore::InspectorTimelineAgent::setInstance):
 65 (InspectorTimelineAgent):
 66
1672012-06-28 Balazs Kelemen <kbalazs@webkit.org>
268
369 [Qt] plugin is loaded to the web process via MainResourceLoader::substituteMIMETypeFromPluginDatabase

Source/WebCore/English.lproj/localizedStrings.js

@@localizedStrings["Open link in Resources panel"] = "Open link in Resources panel
286286localizedStrings["Other"] = "Other";
287287localizedStrings["Override device metrics"] = "Override device metrics";
288288localizedStrings["Paint"] = "Paint";
 289localizedStrings["Decode Image"] = "Decode Image";
 290localizedStrings["Resize Image"] = "Resize Image";
289291localizedStrings["Parse"] = "Parse";
290292localizedStrings["Parser"] = "Parser";
291293localizedStrings["Path"] = "Path";

Source/WebCore/inspector/InspectorInstrumentation.cpp

@@void InspectorInstrumentation::didPaintImpl(const InspectorInstrumentationCookie
472472 pageAgent->didPaint();
473473}
474474
 475void InspectorInstrumentation::willDecodeImageImpl(const LayoutRect& rect)
 476{
 477 InspectorTimelineAgent::willDecodeImage(rect);
 478}
 479
 480void InspectorInstrumentation::didDecodeImageImpl()
 481{
 482 InspectorTimelineAgent::didDecodeImage();
 483}
 484
 485void InspectorInstrumentation::willResizeImageImpl(const LayoutRect& rect)
 486{
 487 InspectorTimelineAgent::willResizeImage(rect);
 488}
 489
 490void InspectorInstrumentation::didResizeImageImpl()
 491{
 492 InspectorTimelineAgent::didResizeImage();
 493}
 494
475495void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents* instrumentingAgents)
476496{
477497 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())

Source/WebCore/inspector/InspectorInstrumentation.h

@@public:
144144 static void didLoadXHR(const InspectorInstrumentationCookie&);
145145 static InspectorInstrumentationCookie willPaint(Frame*, GraphicsContext*, const LayoutRect&);
146146 static void didPaint(const InspectorInstrumentationCookie&);
 147 static void willDecodeImage(const LayoutRect&);
 148 static void didDecodeImage();
 149 static void willResizeImage(const LayoutRect&);
 150 static void didResizeImage();
147151 static void willComposite(Page*);
148152 static void didComposite(Page*);
149153 static InspectorInstrumentationCookie willRecalculateStyle(Document*);

@@private:
309313 static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
310314 static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, GraphicsContext*, const LayoutRect&, Frame*);
311315 static void didPaintImpl(const InspectorInstrumentationCookie&);
 316 static void willDecodeImageImpl(const LayoutRect&);
 317 static void didDecodeImageImpl();
 318 static void willResizeImageImpl(const LayoutRect&);
 319 static void didResizeImageImpl();
312320 static void willCompositeImpl(InstrumentingAgents*);
313321 static void didCompositeImpl(InstrumentingAgents*);
314322 static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);

@@inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCoo
831839#endif
832840}
833841
 842inline void InspectorInstrumentation::willDecodeImage(const LayoutRect& rect)
 843{
 844#if ENABLE(INSPECTOR)
 845 FAST_RETURN_IF_NO_FRONTENDS(void());
 846 willDecodeImageImpl(rect);
 847#endif
 848}
 849
 850inline void InspectorInstrumentation::didDecodeImage()
 851{
 852#if ENABLE(INSPECTOR)
 853 FAST_RETURN_IF_NO_FRONTENDS(void());
 854 didDecodeImageImpl();
 855#endif
 856}
 857
 858inline void InspectorInstrumentation::willResizeImage(const LayoutRect& rect)
 859{
 860#if ENABLE(INSPECTOR)
 861 FAST_RETURN_IF_NO_FRONTENDS(void());
 862 willResizeImageImpl(rect);
 863#endif
 864}
 865
 866inline void InspectorInstrumentation::didResizeImage()
 867{
 868#if ENABLE(INSPECTOR)
 869 FAST_RETURN_IF_NO_FRONTENDS(void());
 870 didResizeImageImpl();
 871#endif
 872}
 873
834874inline void InspectorInstrumentation::willComposite(Page* page)
835875{
836876#if ENABLE(INSPECTOR)

Source/WebCore/inspector/InspectorTimelineAgent.cpp

4949#include "TimelineRecordFactory.h"
5050
5151#include <wtf/CurrentTime.h>
 52#include <wtf/ThreadSpecific.h>
5253
5354namespace WebCore {
5455

@@static const char BeginFrame[] = "BeginFrame";
6566static const char Layout[] = "Layout";
6667static const char RecalculateStyles[] = "RecalculateStyles";
6768static const char Paint[] = "Paint";
 69static const char DecodeImage[] = "DecodeImage";
 70static const char ResizeImage[] = "ResizeImage";
6871static const char CompositeLayers[] = "CompositeLayers";
6972
7073static const char ParseHTML[] = "ParseHTML";

@@static const char CancelAnimationFrame[] = "CancelAnimationFrame";
97100static const char FireAnimationFrame[] = "FireAnimationFrame";
98101}
99102
 103WTF::ThreadSpecific<InspectorTimelineAgent*>* InspectorTimelineAgent::ThreadSpecificInstance()
 104{
 105 AtomicallyInitializedStatic(WTF::ThreadSpecific<InspectorTimelineAgent*>*, instance = new WTF::ThreadSpecific<InspectorTimelineAgent*>());
 106 return instance;
 107}
 108
100109void InspectorTimelineAgent::pushGCEventRecords()
101110{
102111 if (!m_gcEvents.size())

@@void InspectorTimelineAgent::didPaint()
250259 didCompleteCurrentRecord(TimelineRecordType::Paint);
251260}
252261
 262void InspectorTimelineAgent::willDecodeImage(const LayoutRect& rect)
 263{
 264 if (instance())
 265 instance()->pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), TimelineRecordType::DecodeImage, true, 0);
 266}
 267
 268void InspectorTimelineAgent::didDecodeImage()
 269{
 270 if (instance())
 271 instance()->didCompleteCurrentRecord(TimelineRecordType::DecodeImage);
 272}
 273
 274void InspectorTimelineAgent::willResizeImage(const LayoutRect& rect)
 275{
 276 if (instance())
 277 instance()->pushCurrentRecord(TimelineRecordFactory::createPaintData(rect), TimelineRecordType::ResizeImage, true, 0);
 278}
 279
 280void InspectorTimelineAgent::didResizeImage()
 281{
 282 if (instance())
 283 instance()->didCompleteCurrentRecord(TimelineRecordType::ResizeImage);
 284}
 285
253286void InspectorTimelineAgent::willComposite()
254287{
255288 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::CompositeLayers, false, 0);

@@void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumbe
318351{
319352 pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, frame);
320353}
321 
 354
322355void InspectorTimelineAgent::didEvaluateScript()
323356{
324357 didCompleteCurrentRecord(TimelineRecordType::EvaluateScript);

@@void InspectorTimelineAgent::didReceiveResourceData()
356389{
357390 didCompleteCurrentRecord(TimelineRecordType::ResourceReceivedData);
358391}
359 
 392
360393void InspectorTimelineAgent::willReceiveResourceResponse(unsigned long identifier, const ResourceResponse& response, Frame* frame)
361394{
362395 String requestId = IdentifiersFactory::requestId(identifier);

@@void InspectorTimelineAgent::didCompleteCurrentRecord(const String& type)
478511 entry.record->setNumber("endTime", timestamp());
479512 addRecordToTimeline(entry.record, type, entry.frameId);
480513 }
 514 if (m_recordStack.isEmpty())
 515 setInstance(0);
481516}
482517
483518InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* state, InspectorType type, InspectorClient* client)

@@void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data,
513548 if (frame && m_pageAgent)
514549 frameId = m_pageAgent->frameId(frame);
515550 m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type, frameId));
 551 setInstance(this);
516552}
517553
518554void InspectorTimelineAgent::pushCancelableRecord(PassRefPtr<InspectorObject> data, const String& type, Frame* frame)

Source/WebCore/inspector/InspectorTimelineAgent.h

4040#include "ScriptGCEvent.h"
4141#include "ScriptGCEventListener.h"
4242#include <wtf/PassOwnPtr.h>
 43#include <wtf/ThreadSpecific.h>
4344#include <wtf/Vector.h>
4445
4546namespace WebCore {

@@public:
99100
100101 void willPaint(const LayoutRect&, Frame*);
101102 void didPaint();
 103 static void willDecodeImage(const LayoutRect&);
 104 static void didDecodeImage();
 105 static void willResizeImage(const LayoutRect&);
 106 static void didResizeImage();
102107
103108 void willComposite();
104109 void didComposite();

@@public:
144149 void didProcessTask();
145150
146151private:
 152 static WTF::ThreadSpecific<InspectorTimelineAgent*>* ThreadSpecificInstance();
 153 static InspectorTimelineAgent* instance() { return **ThreadSpecificInstance(); }
 154 static void setInstance(InspectorTimelineAgent* inspectorTimelineAgent) { **ThreadSpecificInstance() = inspectorTimelineAgent; }
 155
147156 struct TimelineRecordEntry {
148157 TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, bool cancelable = false)
149158 : record(record), data(data), children(children), type(type), frameId(frameId), cancelable(cancelable)

@@private:
156165 String frameId;
157166 bool cancelable;
158167 };
159 
 168
160169 InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InspectorType, InspectorClient*);
161170
162171 void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*);
163172 void setHeapSizeStatistic(InspectorObject* record);
164 
 173
165174 void didCompleteCurrentRecord(const String& type);
166175 void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
167176 void pushCancelableRecord(PassRefPtr<InspectorObject>, const String& type, Frame*);

Source/WebCore/inspector/front-end/TimelineModel.js

@@WebInspector.TimelineModel.RecordType = {
5050 Layout: "Layout",
5151 RecalculateStyles: "RecalculateStyles",
5252 Paint: "Paint",
 53 DecodeImage: "DecodeImage",
 54 ResizeImage: "ResizeImage",
5355 CompositeLayers: "CompositeLayers",
5456
5557 ParseHTML: "ParseHTML",

Source/WebCore/inspector/front-end/TimelinePanel.js

@@WebInspector.TimelinePanel.prototype = {
767767 {
768768 var anchor = this._getPopoverAnchor(e.target);
769769
770  if (anchor && anchor.row && anchor.row._record.type === "Paint")
 770 if (anchor && anchor.row && (anchor.row._record.type === "Paint" || anchor.row._record.type === "DecodeImage" || anchor.row._record.type === "ResizeImage"))
771771 this._highlightRect(anchor.row._record);
772772 else
773773 this._hideRectHighlight();

Source/WebCore/inspector/front-end/TimelinePresentationModel.js

@@WebInspector.TimelinePresentationModel.recordStyle = function(record)
7373 recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
7474 recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] };
7575 recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
 76 recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Decode Image"), category: categories["painting"] };
 77 recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Resize Image"), category: categories["painting"] };
7678 recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] };
7779 recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: categories["loading"] };
7880 recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: categories["scripting"] };

@@WebInspector.TimelinePresentationModel.Record.prototype = {
523525 case recordTypes.Paint:
524526 contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
525527 contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
 528 break;
 529 case recordTypes.DecodeImage:
 530 contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
 531 contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
 532 break;
 533 case recordTypes.ResizeImage:
 534 contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
 535 contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
 536 break;
526537 case recordTypes.RecalculateStyles: // We don't want to see default details.
527538 break;
528539 default:

@@WebInspector.TimelinePresentationModel.Record.prototype = {
566577 return this.data ? this.data["type"] : null;
567578 case WebInspector.TimelineModel.RecordType.Paint:
568579 return this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"];
 580 case WebInspector.TimelineModel.RecordType.DecodeImage:
 581 return this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"];
 582 case WebInspector.TimelineModel.RecordType.ResizeImage:
 583 return this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"];
569584 case WebInspector.TimelineModel.RecordType.TimerInstall:
570585 case WebInspector.TimelineModel.RecordType.TimerRemove:
571586 return this._linkifyTopCallFrame(this.data["timerId"]);

Source/WebCore/platform/graphics/skia/ImageSkia.cpp

11/*
22 * Copyright (c) 2008, Google Inc. All rights reserved.
3  *
 3 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions are
66 * met:
7  *
 7 *
88 * * Redistributions of source code must retain the above copyright
99 * notice, this list of conditions and the following disclaimer.
1010 * * Redistributions in binary form must reproduce the above

1414 * * Neither the name of Google Inc. nor the names of its
1515 * contributors may be used to endorse or promote products derived from
1616 * this software without specific prior written permission.
17  *
 17 *
1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2020 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

3737#include "FloatRect.h"
3838#include "GraphicsContext.h"
3939#include "ImageObserver.h"
 40#include "InspectorInstrumentation.h"
4041#include "Logging.h"
4142#include "NativeImageSkia.h"
4243#include "PlatformContextSkia.h"

@@static ResamplingMode computeResamplingMode(PlatformContextSkia* platformContext
149150 // High quality interpolation only enabled for scaling and translation.
150151 if (!(platformContext->canvas()->getTotalMatrix().getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)))
151152 return RESAMPLE_AWESOME;
152 
 153
153154 return RESAMPLE_LINEAR;
154155}
155156

@@void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
443444 // causing flicker and wasting CPU.
444445 startAnimation();
445446
 447 InspectorInstrumentation::willDecodeImage(IntRect(dstRect));
 448
446449 NativeImageSkia* bm = nativeImageForCurrentFrame();
 450
 451 InspectorInstrumentation::didDecodeImage();
 452
447453 if (!bm)
448454 return; // It's too early and we don't have an image yet.
449455

@@void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
453459 if (normSrcRect.isEmpty() || normDstRect.isEmpty())
454460 return; // Nothing to draw.
455461
 462 InspectorInstrumentation::willResizeImage(IntRect(dstRect));
 463
456464 paintSkBitmap(ctxt->platformContext(),
457465 *bm,
458466 enclosingIntRect(normSrcRect),
459467 normDstRect,
460468 WebCoreCompositeToSkiaComposite(compositeOp));
461469
 470 InspectorInstrumentation::didResizeImage();
 471
462472 if (ImageObserver* observer = imageObserver())
463473 observer->didDraw(this);
464474}