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

Unified Diff: mojo/public/cpp/bindings/lib/synchronous_connector.cc

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/cpp/bindings/lib/synchronous_connector.h ('k') | mojo/public/cpp/bindings/lib/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/synchronous_connector.cc
diff --git a/mojo/public/cpp/bindings/lib/synchronous_connector.cc b/mojo/public/cpp/bindings/lib/synchronous_connector.cc
deleted file mode 100644
index 42582af924c5cc8626beb56ab09341f08bae235c..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/lib/synchronous_connector.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 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/lib/synchronous_connector.h"
-
-#include <mojo/system/handle.h>
-#include <mojo/system/time.h>
-
-#include <utility>
-
-#include "mojo/public/cpp/bindings/message.h"
-#include "mojo/public/cpp/environment/logging.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/cpp/system/wait.h"
-
-namespace mojo {
-namespace internal {
-
-SynchronousConnector::SynchronousConnector(ScopedMessagePipeHandle handle)
- : handle_(std::move(handle)) {}
-
-SynchronousConnector::~SynchronousConnector() {}
-
-bool SynchronousConnector::Write(Message* msg_to_send) {
- MOJO_DCHECK(handle_.is_valid());
- MOJO_DCHECK(msg_to_send);
-
- auto result = WriteMessageRaw(
- handle_.get(), msg_to_send->data(), msg_to_send->data_num_bytes(),
- msg_to_send->mutable_handles()->empty()
- ? nullptr
- : reinterpret_cast<const MojoHandle*>(
- msg_to_send->mutable_handles()->data()),
- static_cast<uint32_t>(msg_to_send->mutable_handles()->size()),
- MOJO_WRITE_MESSAGE_FLAG_NONE);
-
- switch (result) {
- case MOJO_RESULT_OK:
- break;
-
- case MOJO_RESULT_INVALID_ARGUMENT:
- case MOJO_RESULT_RESOURCE_EXHAUSTED:
- case MOJO_RESULT_FAILED_PRECONDITION:
- case MOJO_RESULT_UNIMPLEMENTED:
- case MOJO_RESULT_BUSY:
- default:
- MOJO_LOG(WARNING) << "WriteMessageRaw unsuccessful. error = " << result;
- return false;
- }
-
- return true;
-}
-
-bool SynchronousConnector::BlockingRead(Message* received_msg) {
- MOJO_DCHECK(handle_.is_valid());
- MOJO_DCHECK(received_msg);
-
- MojoResult rv = Wait(handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,
- MOJO_DEADLINE_INDEFINITE, nullptr);
-
- if (rv != MOJO_RESULT_OK) {
- MOJO_LOG(WARNING) << "Failed waiting for a response. error = " << rv;
- return false;
- }
-
- rv = ReadMessage(handle_.get(), received_msg);
- if (rv != MOJO_RESULT_OK) {
- MOJO_LOG(WARNING) << "Failed reading the response message. error = " << rv;
- return false;
- }
-
- return true;
-}
-
-} // namespace internal
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/lib/synchronous_connector.h ('k') | mojo/public/cpp/bindings/lib/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698