summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-18 09:40:26 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-18 09:40:26 +0000
commit584abe77f84b1bf56e9633e63d4fe60947eabe27 (patch)
tree8f362a9a98484c54f67968d42705c82f16328b0c /printing
parent5a260744b81b9d3be148c2ac2b9387ab2f015213 (diff)
downloadchromium_src-584abe77f84b1bf56e9633e63d4fe60947eabe27.zip
chromium_src-584abe77f84b1bf56e9633e63d4fe60947eabe27.tar.gz
chromium_src-584abe77f84b1bf56e9633e63d4fe60947eabe27.tar.bz2
Only use skia::RefPtr for refcounting
For consistency and sanity in Chromium, only use skia::RefPtr in Chromium to ref count skia classes. SkRefPtr is unsafe to use for newly created objects because it refs the object that is passed to its constructor. skia::RefPtr makes this adoption explicit it via skia::AdoptRef and so is much clearer. This patch also adds a skia::ShareRef function which makes it explicit that the callsite is adopting a ref which is already owned somewhere else. Using AdoptRef vs. ShareRef seems much clearer than using SkRefPtr vs. skia::RefPtr. These are the remaining code sites that use internal Skia reference counted classes. Once these have been removed, then we can use a PRESUBMIT rule to prevent new uses from being added. BUG=none Review URL: https://chromiumcodereview.appspot.com/15004024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/pdf_metafile_skia.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index e4027ed..258ed90 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -10,6 +10,7 @@
#include "base/metrics/histogram.h"
#include "base/posix/eintr_wrapper.h"
#include "base/safe_numerics.h"
+#include "skia/ext/refptr.h"
#include "skia/ext/vector_platform_device_skia.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -29,7 +30,7 @@
namespace printing {
struct PdfMetafileSkiaData {
- SkRefPtr<SkPDFDevice> current_page_;
+ skia::RefPtr<SkPDFDevice> current_page_;
SkPDFDocument pdf_doc_;
SkDynamicMemoryWStream pdf_stream_;
#if defined(OS_MACOSX)
@@ -63,9 +64,9 @@ SkDevice* PdfMetafileSkia::StartPageForVectorCanvas(
SkISize pdf_page_size = SkISize::Make(page_size.width(), page_size.height());
SkISize pdf_content_size =
SkISize::Make(content_area.width(), content_area.height());
- SkRefPtr<SkPDFDevice> pdf_device =
- new skia::VectorPlatformDeviceSkia(pdf_page_size, pdf_content_size,
- transform);
+ skia::RefPtr<SkPDFDevice> pdf_device =
+ skia::AdoptRef(new skia::VectorPlatformDeviceSkia(
+ pdf_page_size, pdf_content_size, transform));
data_->current_page_ = pdf_device;
return pdf_device.get();
}
@@ -93,7 +94,7 @@ bool PdfMetafileSkia::FinishDocument() {
if (page_outstanding_)
FinishPage();
- data_->current_page_ = NULL;
+ data_->current_page_.clear();
int font_counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1];
data_->pdf_doc_.getCountOfFontTypes(font_counts);