summaryrefslogtreecommitdiffstats
path: root/extensions/browser/mojo
diff options
context:
space:
mode:
authoryzshen <yzshen@chromium.org>2016-02-12 17:10:46 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-13 01:13:27 +0000
commit48f0c963ba40f0b3b7768c9d7f36bd51346ebeb5 (patch)
treee3b4d4f5458bb914cf6798eece128b3608055535 /extensions/browser/mojo
parent07eb2f07100d7439592d80471454b8e2ecb83388 (diff)
downloadchromium_src-48f0c963ba40f0b3b7768c9d7f36bd51346ebeb5.zip
chromium_src-48f0c963ba40f0b3b7768c9d7f36bd51346ebeb5.tar.gz
chromium_src-48f0c963ba40f0b3b7768c9d7f36bd51346ebeb5.tar.bz2
Mojo C++ bindings: make Array/Map/String non-null by default.
Array<X> a; // Default construct an empty array. Array<X> b(nullptr); // Construct a null array. a.clear(); // Set to an empty array. a = nullptr; // Set to a null array. BUG=579634 TEST=None Review URL: https://codereview.chromium.org/1693943002 Cr-Commit-Position: refs/heads/master@{#375304}
Diffstat (limited to 'extensions/browser/mojo')
-rw-r--r--extensions/browser/mojo/stash_backend.cc4
-rw-r--r--extensions/browser/mojo/stash_backend_unittest.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/extensions/browser/mojo/stash_backend.cc b/extensions/browser/mojo/stash_backend.cc
index 2a092f3..340d42b 100644
--- a/extensions/browser/mojo/stash_backend.cc
+++ b/extensions/browser/mojo/stash_backend.cc
@@ -54,7 +54,7 @@ void StashServiceImpl::AddToStash(
void StashServiceImpl::RetrieveStash(
const mojo::Callback<void(mojo::Array<StashedObjectPtr>)>& callback) {
if (!backend_) {
- callback.Run(mojo::Array<StashedObjectPtr>(0));
+ callback.Run(mojo::Array<StashedObjectPtr>());
return;
}
callback.Run(backend_->RetrieveStash());
@@ -114,7 +114,7 @@ void StashBackend::AddToStash(mojo::Array<StashedObjectPtr> stashed_objects) {
mojo::Array<StashedObjectPtr> StashBackend::RetrieveStash() {
has_notified_ = false;
- mojo::Array<StashedObjectPtr> result(0);
+ mojo::Array<StashedObjectPtr> result;
for (auto& entry : stashed_objects_) {
result.push_back(entry->Release());
}
diff --git a/extensions/browser/mojo/stash_backend_unittest.cc b/extensions/browser/mojo/stash_backend_unittest.cc
index d460d79..cf69f98 100644
--- a/extensions/browser/mojo/stash_backend_unittest.cc
+++ b/extensions/browser/mojo/stash_backend_unittest.cc
@@ -112,14 +112,14 @@ TEST_F(StashServiceTest, AddTwiceAndRetrieve) {
StashedObjectPtr stashed_object(StashedObject::New());
stashed_object->id = "test type";
stashed_object->data.push_back(1);
- stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>(0);
+ stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>();
stashed_objects.push_back(std::move(stashed_object));
stash_service_->AddToStash(std::move(stashed_objects));
stashed_object = StashedObject::New();
stashed_object->id = "test type2";
stashed_object->data.push_back(2);
stashed_object->data.push_back(3);
- stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>(0);
+ stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>();
stashed_objects.push_back(std::move(stashed_object));
stash_service_->AddToStash(std::move(stashed_objects));
stashed_objects = RetrieveStash();