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

Unified Diff: mojo/public/bindings/lib/message.cc

Issue 220243007: Mojo: Move mojo/public/bindings/lib to mojo/public/cpp/bindings/lib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « mojo/public/bindings/lib/interface.cc ('k') | mojo/public/bindings/lib/message_builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/lib/message.cc
diff --git a/mojo/public/bindings/lib/message.cc b/mojo/public/bindings/lib/message.cc
deleted file mode 100644
index 8ec188e2c798d18d7a3fca46cf863224fa04f76e..0000000000000000000000000000000000000000
--- a/mojo/public/bindings/lib/message.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2013 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.
-
-#include "mojo/public/cpp/bindings/message.h"
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <algorithm>
-
-namespace mojo {
-
-Message::Message()
- : data_num_bytes_(0),
- data_(NULL) {
-}
-
-Message::~Message() {
- free(data_);
-
- for (std::vector<Handle>::iterator it = handles_.begin();
- it != handles_.end(); ++it) {
- if (it->is_valid())
- CloseRaw(*it);
- }
-}
-
-void Message::AllocUninitializedData(uint32_t num_bytes) {
- assert(!data_);
- data_num_bytes_ = num_bytes;
- data_ = static_cast<internal::MessageData*>(malloc(num_bytes));
-}
-
-void Message::AdoptData(uint32_t num_bytes, internal::MessageData* data) {
- assert(!data_);
- data_num_bytes_ = num_bytes;
- data_ = data;
-}
-
-void Message::Swap(Message* other) {
- std::swap(data_num_bytes_, other->data_num_bytes_);
- std::swap(data_, other->data_);
- std::swap(handles_, other->handles_);
-}
-
-MojoResult ReadAndDispatchMessage(MessagePipeHandle handle,
- MessageReceiver* receiver,
- bool* receiver_result) {
- MojoResult rv;
-
- uint32_t num_bytes = 0, num_handles = 0;
- rv = ReadMessageRaw(handle,
- NULL,
- &num_bytes,
- NULL,
- &num_handles,
- MOJO_READ_MESSAGE_FLAG_NONE);
- if (rv != MOJO_RESULT_RESOURCE_EXHAUSTED)
- return rv;
-
- Message message;
- message.AllocUninitializedData(num_bytes);
- message.mutable_handles()->resize(num_handles);
-
- rv = ReadMessageRaw(handle,
- message.mutable_data(),
- &num_bytes,
- message.mutable_handles()->empty()
- ? NULL
- : reinterpret_cast<MojoHandle*>(
- &message.mutable_handles()->front()),
- &num_handles,
- MOJO_READ_MESSAGE_FLAG_NONE);
- if (receiver && rv == MOJO_RESULT_OK) {
- bool result = receiver->Accept(&message);
- if (receiver_result)
- *receiver_result = result;
- }
-
- return rv;
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/public/bindings/lib/interface.cc ('k') | mojo/public/bindings/lib/message_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698