summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 10:31:03 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 10:31:03 +0000
commit4260c386f35b3b99fbcd1a97a67eab3eb5d8b86a (patch)
treeddbb28b031e1517c56a15f48665724d9cf7e2b68 /webkit
parent5e6fd2084d754ab8b4308352a648c91976b80eeb (diff)
downloadchromium_src-4260c386f35b3b99fbcd1a97a67eab3eb5d8b86a.zip
chromium_src-4260c386f35b3b99fbcd1a97a67eab3eb5d8b86a.tar.gz
chromium_src-4260c386f35b3b99fbcd1a97a67eab3eb5d8b86a.tar.bz2
Fix leak in ScopedClipboardWriterGlue.
BUG=123117 TEST=none Review URL: http://codereview.chromium.org/10078001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/clipboard_client.h4
-rw-r--r--webkit/glue/scoped_clipboard_writer_glue.cc10
-rw-r--r--webkit/glue/scoped_clipboard_writer_glue.h5
3 files changed, 10 insertions, 9 deletions
diff --git a/webkit/glue/clipboard_client.h b/webkit/glue/clipboard_client.h
index 6c9856c..9d69c98 100644
--- a/webkit/glue/clipboard_client.h
+++ b/webkit/glue/clipboard_client.h
@@ -23,8 +23,8 @@ class ClipboardClient {
const void* pixels,
const gfx::Size& size) = 0;
- // Flushes all gathered data, and destroys the context.
- virtual void FlushAndDestroy(const ui::Clipboard::ObjectMap& objects) = 0;
+ // Flushes all gathered data.
+ virtual void Flush(const ui::Clipboard::ObjectMap& objects) = 0;
};
virtual ~ClipboardClient() { }
diff --git a/webkit/glue/scoped_clipboard_writer_glue.cc b/webkit/glue/scoped_clipboard_writer_glue.cc
index e5ac211..f648b7b 100644
--- a/webkit/glue/scoped_clipboard_writer_glue.cc
+++ b/webkit/glue/scoped_clipboard_writer_glue.cc
@@ -11,19 +11,19 @@ ScopedClipboardWriterGlue::ScopedClipboardWriterGlue(
ui::Clipboard::BUFFER_STANDARD),
context_(client->CreateWriteContext()) {
// We should never have an instance where both are set.
- DCHECK((clipboard_ && !context_) ||
- (!clipboard_ && context_));
+ DCHECK((clipboard_ && !context_.get()) ||
+ (!clipboard_ && context_.get()));
}
ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
- if (!objects_.empty() && context_) {
- context_->FlushAndDestroy(objects_);
+ if (!objects_.empty() && context_.get()) {
+ context_->Flush(objects_);
}
}
void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels,
const gfx::Size& size) {
- if (context_) {
+ if (context_.get()) {
context_->WriteBitmapFromPixels(&objects_, pixels, size);
} else {
ScopedClipboardWriter::WriteBitmapFromPixels(pixels, size);
diff --git a/webkit/glue/scoped_clipboard_writer_glue.h b/webkit/glue/scoped_clipboard_writer_glue.h
index cee1669..0eb13fc 100644
--- a/webkit/glue/scoped_clipboard_writer_glue.h
+++ b/webkit/glue/scoped_clipboard_writer_glue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,6 +6,7 @@
#define WEBKIT_GLUE_SCOPED_CLIPBOARD_WRITER_GLUE_H_
#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#include "base/memory/scoped_ptr.h"
#include "webkit/glue/clipboard_client.h"
class ScopedClipboardWriterGlue : public ui::ScopedClipboardWriter {
@@ -17,7 +18,7 @@ class ScopedClipboardWriterGlue : public ui::ScopedClipboardWriter {
void WriteBitmapFromPixels(const void* pixels, const gfx::Size& size);
private:
- webkit_glue::ClipboardClient::WriteContext* context_;
+ scoped_ptr<webkit_glue::ClipboardClient::WriteContext> context_;
DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriterGlue);
};