Skip to content

Commit

Permalink
Update mojo sdk to rev a05bfef8096006056b2fff78092faf14d1319782
Browse files Browse the repository at this point in the history
Reland which fixes a clang/win compile error.

BUG=None
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1217443018

Cr-Commit-Position: refs/heads/master@{#337766}
  • Loading branch information
krockot authored and Commit bot committed Jul 8, 2015
1 parent 768f0c0 commit f3c539b
Show file tree
Hide file tree
Showing 171 changed files with 1,937 additions and 1,008 deletions.
1 change: 0 additions & 1 deletion components/view_manager/view_manager_client_apptest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ class ViewTracker : public ViewObserver {
view_ = nullptr;
}

int id_;
View* view_;

MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTracker);
Expand Down
3 changes: 2 additions & 1 deletion components/view_manager/view_manager_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ bool ViewManagerServiceImpl::Embed(const ViewId& view_id,
if (!client.get() || !CanEmbed(view_id))
return false;
PrepareForEmbed(view_id);
ignore_result(connection_manager_->EmbedAtView(id_, view_id, client.Pass()));
::ignore_result(
connection_manager_->EmbedAtView(id_, view_id, client.Pass()));
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion content/browser/webui/web_ui_mojo_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/data/web_ui_test_mojo_bindings.mojom.h"
#include "third_party/mojo/src/mojo/edk/test/test_utils.h"
#include "mojo/test/test_utils.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
#include "third_party/mojo/src/mojo/public/js/constants.h"
Expand Down
1 change: 1 addition & 0 deletions content/content_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@
'../media/media.gyp:shared_memory_support',
'../mojo/mojo_base.gyp:mojo_application_base',
'../mojo/mojo_base.gyp:mojo_environment_chromium',
'../mojo/mojo_base.gyp:mojo_test_support',
'../net/net.gyp:net_test_support',
'../ppapi/ppapi_internal.gyp:ppapi_host',
'../ppapi/ppapi_internal.gyp:ppapi_ipc',
Expand Down
1 change: 1 addition & 0 deletions content/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ if (!is_mac) {
"//media:shared_memory_support",
"//mojo/application/public/cpp:cpp_for_chromium",
"//mojo/environment:chromium",
"//mojo/test:test_support",
"//net:test_support",
"//ppapi/host",
"//ppapi/proxy",
Expand Down
2 changes: 1 addition & 1 deletion ipc/mojo/async_handle_waiter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ TEST_F(AsyncHandleWaiterTest, RestartWaitingWhileSignaled) {
EXPECT_TRUE(handler.IsClosingHandled());

// |HandlerThatReenters::RestartAndClose| already closed it.
ignore_result(pipe_to_read_.release());
::ignore_result(pipe_to_read_.release());
}

class AsyncHandleWaiterIOObserverTest : public testing::Test {
Expand Down
13 changes: 13 additions & 0 deletions mojo/mojo_base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@
'mojo_services.gyp:network_service_bindings_lib',
],
},
{
# GN version: //mojo/test:test_support
'target_name': 'mojo_test_support',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
],
'sources': [
'test/test_utils.h',
'test/test_utils_posix.cc',
'test/test_utils_win.cc',
],
},
{
# GN version: //mojo/application/public/cpp/tests
'target_name': 'mojo_public_application_unittests',
Expand Down
15 changes: 15 additions & 0 deletions mojo/test/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2015 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.

source_set("test_support") {
sources = [
"test_utils.h",
"test_utils_posix.cc",
"test_utils_win.cc",
]

public_deps = [
"//base",
]
}
21 changes: 21 additions & 0 deletions mojo/test/test_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2015 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.

#ifndef MOJO_TEST_TEST_UTILS_H_
#define MOJO_TEST_TEST_UTILS_H_

#include <string>

#include "base/files/file_path.h"

namespace mojo {
namespace test {

// Returns the path to the mojom js bindings file.
base::FilePath GetFilePathForJSResource(const std::string& path);

} // namespace test
} // namespace mojo

#endif // MOJO_TEST_TEST_UTILS_H_
21 changes: 21 additions & 0 deletions mojo/test/test_utils_posix.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2015 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/test/test_utils.h"

#include "base/base_paths.h"
#include "base/path_service.h"

namespace mojo {
namespace test {

base::FilePath GetFilePathForJSResource(const std::string& path) {
std::string binding_path = "gen/" + path + ".js";
base::FilePath exe_dir;
PathService::Get(base::DIR_EXE, &exe_dir);
return exe_dir.AppendASCII(binding_path);
}

} // namespace test
} // namespace mojo
22 changes: 22 additions & 0 deletions mojo/test/test_utils_win.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2015 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/test/test_utils.h"

#include "base/base_paths.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
namespace mojo {
namespace test {

base::FilePath GetFilePathForJSResource(const std::string& path) {
std::string binding_path = "gen/" + path + ".js";
base::ReplaceChars(binding_path, "//", "\\", &binding_path);
base::FilePath exe_dir;
PathService::Get(base::DIR_EXE, &exe_dir);
return exe_dir.AppendASCII(binding_path);
}

} // namespace test
} // namespace mojo
2 changes: 2 additions & 0 deletions third_party/mojo/mojom_bindings_generator_variables.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/js_templates/struct_definition.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/js_templates/union_definition.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/js_templates/validation_macros.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py',
Expand Down
6 changes: 3 additions & 3 deletions third_party/mojo/src/mojo/edk/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ mojo_edk_source_set("platform") {

mojo_edk_configs = [ "mojo/edk/system:system_config" ]

mojo_sdk_public_deps = [ "mojo/public/cpp/system" ]

deps = [
"//base",
"//crypto",
Expand Down Expand Up @@ -112,9 +114,7 @@ mojo_edk_source_set("delegates") {

mojo_edk_configs = [ "mojo/edk/system:system_config" ]

deps = [
"//base",
]
mojo_sdk_public_deps = [ "mojo/public/cpp/system" ]
}

mojo_edk_source_set("embedder_unittests") {
Expand Down
43 changes: 23 additions & 20 deletions third_party/mojo/src/mojo/edk/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ MojoResult CreatePlatformHandleWrapper(
MojoHandle* platform_handle_wrapper_handle) {
DCHECK(platform_handle_wrapper_handle);

scoped_refptr<system::Dispatcher> dispatcher(
new system::PlatformHandleDispatcher(platform_handle.Pass()));
scoped_refptr<system::Dispatcher> dispatcher =
system::PlatformHandleDispatcher::Create(platform_handle.Pass());

DCHECK(internal::g_core);
MojoHandle h = internal::g_core->AddDispatcher(dispatcher);
Expand Down Expand Up @@ -173,8 +173,8 @@ void ShutdownIPCSupport() {
ScopedMessagePipeHandle ConnectToSlave(
SlaveInfo slave_info,
ScopedPlatformHandle platform_handle,
const DidConnectToSlaveCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner,
const base::Closure& did_connect_to_slave_callback,
scoped_refptr<base::TaskRunner> did_connect_to_slave_runner,
std::string* platform_connection_id,
ChannelInfo** channel_info) {
DCHECK(platform_connection_id);
Expand All @@ -187,8 +187,9 @@ ScopedMessagePipeHandle ConnectToSlave(
system::ChannelId channel_id = system::kInvalidChannelId;
scoped_refptr<system::MessagePipeDispatcher> dispatcher =
internal::g_ipc_support->ConnectToSlave(
connection_id, slave_info, platform_handle.Pass(), callback,
callback_thread_task_runner.Pass(), &channel_id);
connection_id, slave_info, platform_handle.Pass(),
did_connect_to_slave_callback, did_connect_to_slave_runner.Pass(),
&channel_id);
*channel_info = new ChannelInfo(channel_id);

ScopedMessagePipeHandle rv(
Expand All @@ -201,8 +202,8 @@ ScopedMessagePipeHandle ConnectToSlave(

ScopedMessagePipeHandle ConnectToMaster(
const std::string& platform_connection_id,
const DidConnectToMasterCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner,
const base::Closure& did_connect_to_master_callback,
scoped_refptr<base::TaskRunner> did_connect_to_master_runner,
ChannelInfo** channel_info) {
DCHECK(channel_info);
DCHECK(internal::g_ipc_support);
Expand All @@ -215,8 +216,8 @@ ScopedMessagePipeHandle ConnectToMaster(
system::ChannelId channel_id = system::kInvalidChannelId;
scoped_refptr<system::MessagePipeDispatcher> dispatcher =
internal::g_ipc_support->ConnectToMaster(
connection_id, callback, callback_thread_task_runner.Pass(),
&channel_id);
connection_id, did_connect_to_master_callback,
did_connect_to_master_runner.Pass(), &channel_id);
*channel_info = new ChannelInfo(channel_id);

ScopedMessagePipeHandle rv(
Expand Down Expand Up @@ -253,10 +254,10 @@ ScopedMessagePipeHandle CreateChannelOnIOThread(

ScopedMessagePipeHandle CreateChannel(
ScopedPlatformHandle platform_handle,
const DidCreateChannelCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
const base::Callback<void(ChannelInfo*)>& did_create_channel_callback,
scoped_refptr<base::TaskRunner> did_create_channel_runner) {
DCHECK(platform_handle.is_valid());
DCHECK(!callback.is_null());
DCHECK(!did_create_channel_callback.is_null());
DCHECK(internal::g_ipc_support);

system::ChannelManager* channel_manager =
Expand All @@ -267,8 +268,9 @@ ScopedMessagePipeHandle CreateChannel(
scoped_refptr<system::MessagePipeDispatcher> dispatcher =
channel_manager->CreateChannel(
channel_id, platform_handle.Pass(),
base::Bind(callback, base::Unretained(channel_info.release())),
callback_thread_task_runner);
base::Bind(did_create_channel_callback,
base::Unretained(channel_info.release())),
did_create_channel_runner);

ScopedMessagePipeHandle rv(
MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
Expand All @@ -293,17 +295,18 @@ void DestroyChannelOnIOThread(ChannelInfo* channel_info) {
// TODO(vtl): Write tests for this.
void DestroyChannel(
ChannelInfo* channel_info,
const DidDestroyChannelCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner) {
const base::Closure& did_destroy_channel_callback,
scoped_refptr<base::TaskRunner> did_destroy_channel_runner) {
DCHECK(channel_info);
DCHECK(channel_info->channel_id);
DCHECK(!callback.is_null());
DCHECK(!did_destroy_channel_callback.is_null());
DCHECK(internal::g_ipc_support);

system::ChannelManager* channel_manager =
internal::g_ipc_support->channel_manager();
channel_manager->ShutdownChannel(channel_info->channel_id, callback,
callback_thread_task_runner);
channel_manager->ShutdownChannel(channel_info->channel_id,
did_destroy_channel_callback,
did_destroy_channel_runner);
delete channel_info;
}

Expand Down
49 changes: 23 additions & 26 deletions third_party/mojo/src/mojo/edk/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport();
// returns a handle), an ID string (returned in |*platform_connection_id|) that
// must be passed to the slave (e.g., on the command line), and a
// |ChannelInfo*| (in |*channel_info|) which should eventually be given to
// |DestroyChannel()|/|DestroyChannelOnIOThread()|, but only after |callback|
// has been run.
// |DestroyChannel()|/|DestroyChannelOnIOThread()|, but only after
// |did_connect_to_slave_callback| has been run.
//
// |callback| will be run either using |callback_thread_task_runner| (if
// non-null) or on the I/O thread, once the |ChannelInfo*| is valid.
// |did_connect_to_slave_callback| will be run either using
// |did_connect_to_slave_runner| (if non-null) or on the I/O thread, once the
// |ChannelInfo*| is valid.
//
// TODO(vtl): The API is a little crazy with respect to the |ChannelInfo*|.
using DidConnectToSlaveCallback = base::Closure;
MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle
ConnectToSlave(SlaveInfo slave_info,
ScopedPlatformHandle platform_handle,
const DidConnectToSlaveCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner,
const base::Closure& did_connect_to_slave_callback,
scoped_refptr<base::TaskRunner> did_connect_to_slave_runner,
std::string* platform_connection_id,
ChannelInfo** channel_info);

Expand All @@ -146,15 +146,14 @@ ConnectToSlave(SlaveInfo slave_info,
//
// See |ConnectToSlave()| for details. (Note that if this fails in any way,
// e.g., if |platform_connection_id| is invalid, this will CHECK-fail and
// terminate the process.) |channel_info|, |callback|, and
// |callback_thread_task_runner| are as in |ConnectToSlave()|.
// terminate the process.) |channel_info|, |did_connect_to_master_callback|, and
// |did_connect_to_master_runner| are analagous to in |ConnectToSlave()|.
//
// TODO(vtl): The API is a little crazy with respect to the |ChannelInfo*|.
using DidConnectToMasterCallback = base::Closure;
MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle
ConnectToMaster(const std::string& platform_connection_id,
const DidConnectToMasterCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner,
const base::Closure& did_connect_to_master_callback,
scoped_refptr<base::TaskRunner> did_connect_to_master_runner,
ChannelInfo** channel_info);

// A "channel" is a connection on top of an OS "pipe", on top of which Mojo
Expand Down Expand Up @@ -201,21 +200,20 @@ MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle
CreateChannelOnIOThread(ScopedPlatformHandle platform_handle,
ChannelInfo** channel_info);

using DidCreateChannelCallback = base::Callback<void(ChannelInfo*)>;
// Creates a channel asynchronously; may be called from any thread.
// |platform_handle| should be a handle to a connected OS "pipe".
// |callback| should be the callback to call with the |ChannelInfo*|, which
// should eventually be passed to |DestroyChannel()| to tear down the channel;
// the callback will be called using |callback_thread_task_runner| if that is
// non-null, or otherwise it will be posted to the I/O thread. Returns a handle
// to the bootstrap message pipe.
// |did_create_channel_callback| should be the callback to call with the
// |ChannelInfo*|, which should eventually be passed to |DestroyChannel()| to
// tear down the channel; the callback will be called using
// |did_create_channel_runner| if that is non-null, or otherwise it will be
// posted to the I/O thread. Returns a handle to the bootstrap message pipe.
//
// Note: This should only be used to establish a channel with a process of type
// |ProcessType::NONE|. This function may be removed in the future.
MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle
CreateChannel(ScopedPlatformHandle platform_handle,
const DidCreateChannelCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner);
MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle CreateChannel(
ScopedPlatformHandle platform_handle,
const base::Callback<void(ChannelInfo*)>& did_create_channel_callback,
scoped_refptr<base::TaskRunner> did_create_channel_runner);

// Destroys a channel that was created using |ConnectToMaster()|,
// |ConnectToSlave()|, |CreateChannel()|, or |CreateChannelOnIOThread()|; must
Expand All @@ -224,16 +222,15 @@ CreateChannel(ScopedPlatformHandle platform_handle,
MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread(
ChannelInfo* channel_info);

using DidDestroyChannelCallback = base::Closure;
// Like |DestroyChannelOnIOThread()|, but asynchronous and may be called from
// any thread. The callback will be called using |callback_thread_task_runner|
// any thread. The callback will be called using |did_destroy_channel_runner|
// if that is non-null, or otherwise it will be called on the "channel thread".
// The "channel thread" must remain alive and continue to process tasks until
// the callback has been executed.
MOJO_SYSTEM_IMPL_EXPORT void DestroyChannel(
ChannelInfo* channel_info,
const DidDestroyChannelCallback& callback,
scoped_refptr<base::TaskRunner> callback_thread_task_runner);
const base::Closure& did_destroy_channel_callback,
scoped_refptr<base::TaskRunner> did_destroy_channel_runner);

// Inform the channel that it will soon be destroyed (doing so is optional).
// This may be called from any thread, but the caller must ensure that this is
Expand Down
Loading

0 comments on commit f3c539b

Please sign in to comment.