Index: content/shell/utility/shell_content_utility_client.cc |
diff --git a/content/shell/utility/shell_content_utility_client.cc b/content/shell/utility/shell_content_utility_client.cc |
index daec25c93759c18856fe302ea496afd878f8be18..5eb2dadfc436bade33b820351fc35dc816f1f54b 100644 |
--- a/content/shell/utility/shell_content_utility_client.cc |
+++ b/content/shell/utility/shell_content_utility_client.cc |
@@ -13,6 +13,7 @@ |
#include "content/public/test/test_mojo_app.h" |
#include "content/public/test/test_mojo_service.mojom.h" |
#include "mojo/public/cpp/bindings/strong_binding.h" |
+#include "mojo/public/cpp/system/buffer.h" |
#include "services/shell/public/cpp/interface_registry.h" |
namespace content { |
@@ -45,6 +46,20 @@ class TestMojoServiceImpl : public mojom::TestMojoService { |
NOTREACHED(); |
} |
+ void CreateSharedBuffer(const std::string& message, |
+ const CreateSharedBufferCallback& callback) override { |
+ mojo::ScopedSharedBufferHandle buffer = |
+ mojo::SharedBufferHandle::Create(message.size()); |
+ CHECK(buffer.is_valid()); |
+ |
+ mojo::ScopedSharedBufferMapping mapping = buffer->Map(message.size()); |
+ CHECK(mapping); |
+ std::copy(message.begin(), message.end(), |
+ reinterpret_cast<char*>(mapping.get())); |
+ |
+ callback.Run(std::move(buffer)); |
+ } |
+ |
private: |
explicit TestMojoServiceImpl() {} |