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

Unified Diff: blimp/engine/mojo/blob_channel_service.cc

Issue 2033013003: Use shared memory for moving data over BlobChannel Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-master
Patch Set: Switch to new Mojo shared buffer API Created 4 years, 6 months 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
Index: blimp/engine/mojo/blob_channel_service.cc
diff --git a/blimp/engine/mojo/blob_channel_service.cc b/blimp/engine/mojo/blob_channel_service.cc
index 0234df60698b3a2c2628537b7e66cfd9ae44bfd9..34d35ee2ae6e5a2fb2a10129df6d4e0ff827a67d 100644
--- a/blimp/engine/mojo/blob_channel_service.cc
+++ b/blimp/engine/mojo/blob_channel_service.cc
@@ -5,6 +5,7 @@
#include "blimp/engine/mojo/blob_channel_service.h"
#include "blimp/net/blob_channel/blob_channel_sender.h"
+#include "mojo/public/cpp/system/buffer.h"
namespace blimp {
namespace engine {
@@ -19,8 +20,14 @@ BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender,
BlobChannelService::~BlobChannelService() {}
void BlobChannelService::PutBlob(const mojo::String& id,
- const mojo::String& data) {
- blob_channel_sender_->PutBlob(id, new BlobData(data));
+ mojo::ScopedSharedBufferHandle data,
+ uint32_t size) {
+ // Map |data| into the address space and copy out its contents.
+ DCHECK(data.is_valid());
dcheng 2016/06/25 01:06:31 The comments imply this is coming from the rendere
Kevin M 2016/06/27 17:31:12 Done.
+ scoped_refptr<BlobData> new_blob(new BlobData);
+ auto mapping = data->Map(size);
+ new_blob->data.assign(reinterpret_cast<const char*>(mapping.get()), size);
+ blob_channel_sender_->PutBlob(id, std::move(new_blob));
}
void BlobChannelService::DeliverBlob(const mojo::String& id) {

Powered by Google App Engine
This is Rietveld 408576698