summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-17 23:34:21 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-17 23:34:21 +0000
commit134cb296e99e2c3375c8da8a2ece4114cbbe9111 (patch)
tree318ed702211c417a6da396aac5ab035440d875ce /webkit/glue
parent79b21169af39bf068339538d20c77c12972487bd (diff)
downloadchromium_src-134cb296e99e2c3375c8da8a2ece4114cbbe9111.zip
chromium_src-134cb296e99e2c3375c8da8a2ece4114cbbe9111.tar.gz
chromium_src-134cb296e99e2c3375c8da8a2ece4114cbbe9111.tar.bz2
Lazy-initialize Clipboard, since we can't use it until we have an X connection.
Review URL: http://codereview.chromium.org/11429 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/simple_clipboard_impl.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/webkit/glue/simple_clipboard_impl.cc b/webkit/glue/simple_clipboard_impl.cc
index b60a36808..bc8c7c5 100644
--- a/webkit/glue/simple_clipboard_impl.cc
+++ b/webkit/glue/simple_clipboard_impl.cc
@@ -7,8 +7,9 @@
#include <string>
#include "base/clipboard.h"
-#include "webkit/glue/scoped_clipboard_writer_glue.h"
+#include "base/lazy_instance.h"
#include "googleurl/src/gurl.h"
+#include "webkit/glue/scoped_clipboard_writer_glue.h"
#include "SkBitmap.h"
@@ -28,27 +29,27 @@ ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
namespace webkit_glue {
-Clipboard clipboard;
+base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED);
Clipboard* ClipboardGetClipboard() {
- return &clipboard;
+ return clipboard.Pointer();
}
bool ClipboardIsFormatAvailable(Clipboard::FormatType format) {
- return clipboard.IsFormatAvailable(format);
+ return ClipboardGetClipboard()->IsFormatAvailable(format);
}
void ClipboardReadText(std::wstring* result) {
- clipboard.ReadText(result);
+ ClipboardGetClipboard()->ReadText(result);
}
void ClipboardReadAsciiText(std::string* result) {
- clipboard.ReadAsciiText(result);
+ ClipboardGetClipboard()->ReadAsciiText(result);
}
void ClipboardReadHTML(std::wstring* markup, GURL* url) {
std::string url_str;
- clipboard.ReadHTML(markup, url ? &url_str : NULL);
+ ClipboardGetClipboard()->ReadHTML(markup, url ? &url_str : NULL);
if (url)
*url = GURL(url_str);
}