summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 01:54:04 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 01:54:04 +0000
commitd2a2a409f713ce9f28b8d40b3ed2ef9140057a38 (patch)
tree4e0f6cf3097fd7dd09e726fac7bd791409fd493b /content/renderer
parent7cb5029c99a5b3164e7b190538c245e0617b4fd9 (diff)
downloadchromium_src-d2a2a409f713ce9f28b8d40b3ed2ef9140057a38.zip
chromium_src-d2a2a409f713ce9f28b8d40b3ed2ef9140057a38.tar.gz
chromium_src-d2a2a409f713ce9f28b8d40b3ed2ef9140057a38.tar.bz2
Implement Clipboard::ReadImage on Linux.
I split the IPC up into two parts on Linux--one that reads the image on the UI thread, and a second part that encodes the image on the file thread before replying. I've also switched it to send the data over shared memory instead of passing a (potentially) huge blob of data over IPC. BUG=75237 TEST=Local testing. Review URL: http://codereview.chromium.org/6871001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/renderer_glue.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc
index 60a8d47..5ad03fd 100644
--- a/content/renderer/renderer_glue.cc
+++ b/content/renderer/renderer_glue.cc
@@ -14,6 +14,7 @@
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
+#include "base/shared_memory.h"
#include "base/string_util.h"
#include "content/common/clipboard_messages.h"
#include "content/common/content_switches.h"
@@ -168,7 +169,15 @@ void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup,
}
void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data) {
- RenderThread::current()->Send(new ClipboardHostMsg_ReadImage(buffer, data));
+ base::SharedMemoryHandle image_handle;
+ uint32 image_size;
+ RenderThread::current()->Send(
+ new ClipboardHostMsg_ReadImage(buffer, &image_handle, &image_size));
+ if (base::SharedMemory::IsHandleValid(image_handle)) {
+ base::SharedMemory buffer(image_handle, true);
+ buffer.Map(image_size);
+ data->append(static_cast<char*>(buffer.memory()), image_size);
+ }
}
bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type,