Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: experimental/PdfViewer/src/SkPdfContext.cpp

Issue 83183004: Simplify SkPdfTokenLooper behavior. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comment (FIXME) Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/inc/SkPdfTokenLooper.h ('k') | experimental/PdfViewer/src/SkPdfOps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/src/SkPdfContext.cpp
diff --git a/experimental/PdfViewer/src/SkPdfContext.cpp b/experimental/PdfViewer/src/SkPdfContext.cpp
index f29afe52a0a5981ac3a800dd0007659dc325b2c6..b033e7a7685561b4dc3026034b9ca3ca737373f5 100644
--- a/experimental/PdfViewer/src/SkPdfContext.cpp
+++ b/experimental/PdfViewer/src/SkPdfContext.cpp
@@ -14,14 +14,16 @@
class PdfMainLooper : public SkPdfTokenLooper {
public:
- PdfMainLooper(SkPdfTokenLooper* parent,
- SkPdfNativeTokenizer* tokenizer,
+ PdfMainLooper(SkPdfNativeTokenizer* tokenizer,
SkPdfContext* pdfContext,
SkCanvas* canvas)
- : SkPdfTokenLooper(parent, tokenizer, pdfContext, canvas) {}
+ : INHERITED(tokenizer, pdfContext, canvas) {}
- virtual SkPdfResult consumeToken(PdfToken& token);
- virtual void loop();
+ virtual SkPdfResult consumeToken(PdfToken& token) SK_OVERRIDE;
+ virtual void loop() SK_OVERRIDE;
+
+private:
+ typedef SkPdfTokenLooper INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@@ -38,7 +40,7 @@ void SkPdfContext::parseStream(SkPdfNativeObject* stream, SkCanvas* canvas) {
// Nothing to parse.
return;
}
- PdfMainLooper looper(NULL, tokenizer, this, canvas);
+ PdfMainLooper looper(tokenizer, this, canvas);
looper.loop();
// FIXME (scroggo): Will restructure to put tokenizer on the stack.
delete tokenizer;
@@ -87,19 +89,12 @@ SkPdfResult PdfMainLooper::consumeToken(PdfToken& token) {
PdfOperatorRenderer pdfOperatorRenderer = NULL;
if (gPdfOps.find(token.fKeyword, token.fKeywordLength, &pdfOperatorRenderer) &&
pdfOperatorRenderer) {
- SkPdfTokenLooper* childLooper = NULL;
// Main work is done by pdfOperatorRenderer(...)
- SkPdfResult result = pdfOperatorRenderer(fPdfContext, fCanvas, &childLooper);
+ SkPdfResult result = pdfOperatorRenderer(fPdfContext, fCanvas, this);
int cnt = 0;
gRenderStats[result].find(token.fKeyword, token.fKeywordLength, &cnt);
gRenderStats[result].set(token.fKeyword, token.fKeywordLength, cnt + 1);
- if (childLooper) {
- // FIXME (scroggo): Auto delete this.
- childLooper->setUp(this);
- childLooper->loop();
- delete childLooper;
- }
} else {
int cnt = 0;
gRenderStats[kUnsupported_SkPdfResult].find(token.fKeyword,
« no previous file with comments | « experimental/PdfViewer/inc/SkPdfTokenLooper.h ('k') | experimental/PdfViewer/src/SkPdfOps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698