summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@chromium.org>2019-03-28 15:15:30 +0900
committerQijiang Fan <fqj@google.com>2020-06-06 03:51:35 +0900
commit2a7a6bd6b522736dd750c873580ba982dacacd89 (patch)
treea4f342b71162b26d69acdfe95d12d1dd11e92ccd
parent866a61d36b2de6d3ad3f799434f82113db5d475f (diff)
downloadlibchrome-2a7a6bd6b522736dd750c873580ba982dacacd89.tar.gz
libchrome: Uprev libchrome to r576279.
BUG=chromium:909719 TEST=None Change-Id: Ia0de6a705cd666985675c2885ab7d2ef938c94a6 (Reconstructed from 1cedaefedb63833985136e3e6fabfe4326c39657)
-rw-r--r--base/android/java/src/org/chromium/base/ContextUtils.java7
-rw-r--r--base/android/jni_android.cc3
-rwxr-xr-xbase/android/jni_generator/jni_registration_generator.py2
-rw-r--r--base/debug/task_annotator.h1
-rw-r--r--base/files/file_posix.cc2
-rw-r--r--base/files/file_util_posix.cc2
-rw-r--r--base/lazy_instance.h2
-rw-r--r--base/memory/shared_memory_mapping.cc10
-rw-r--r--base/message_loop/message_loop.h6
-rw-r--r--base/message_loop/message_loop_unittest.cc39
-rw-r--r--base/message_loop/message_pump_for_ui.h8
-rw-r--r--base/observer_list_unittest.cc15
-rw-r--r--base/process/memory_linux.cc4
-rw-r--r--base/strings/string_number_conversions.cc19
-rw-r--r--base/strings/string_number_conversions_unittest.cc4
-rw-r--r--base/test/test_mock_time_task_runner.h1
-rw-r--r--base/threading/thread_id_name_manager.cc3
-rw-r--r--base/values.cc32
-rw-r--r--base/values.h2
-rw-r--r--build/android/gyp/util/build_utils.py6
-rw-r--r--mojo/core/core.cc10
-rw-r--r--mojo/core/handle_table.cc90
-rw-r--r--mojo/core/handle_table.h11
-rw-r--r--mojo/core/user_message_impl.cc48
-rw-r--r--mojo/public/cpp/bindings/lib/message_dumper.cc48
-rw-r--r--mojo/public/cpp/system/file_data_pipe_producer.cc16
-rw-r--r--mojo/public/mojom/base/file_path.mojom8
-rw-r--r--mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl4
-rwxr-xr-xmojo/public/tools/bindings/mojom_bindings_generator.py16
29 files changed, 286 insertions, 133 deletions
diff --git a/base/android/java/src/org/chromium/base/ContextUtils.java b/base/android/java/src/org/chromium/base/ContextUtils.java
index 8284cd1273..c648e01ff9 100644
--- a/base/android/java/src/org/chromium/base/ContextUtils.java
+++ b/base/android/java/src/org/chromium/base/ContextUtils.java
@@ -100,9 +100,10 @@ public class ContextUtils {
// that use Robolectric and set the application context manually. Instead of changing all
// tests that do so, the call was put here instead.
// TODO(mheikal): Require param to be of type Application
- if (appContext instanceof Application) {
- ApplicationStatus.initialize((Application) appContext);
- }
+ // Disabled on libchrome
+ // if (appContext instanceof Application) {
+ // ApplicationStatus.initialize((Application) appContext);
+ // }
initJavaSideApplicationContext(appContext);
Holder.sSharedPreferences = fetchAppSharedPreferences();
}
diff --git a/base/android/jni_android.cc b/base/android/jni_android.cc
index aad84fba11..721b143976 100644
--- a/base/android/jni_android.cc
+++ b/base/android/jni_android.cc
@@ -253,7 +253,8 @@ void CheckException(JNIEnv* env) {
}
// Now, feel good about it and die.
- LOG(FATAL) << "Please include Java exception stack in crash report";
+ if (java_throwable)
+ LOG(FATAL) << GetJavaExceptionInfo(env, java_throwable);
}
std::string GetJavaExceptionInfo(JNIEnv* env, jthrowable java_throwable) {
diff --git a/base/android/jni_generator/jni_registration_generator.py b/base/android/jni_generator/jni_registration_generator.py
index dec56ee660..8c545f6d1b 100755
--- a/base/android/jni_generator/jni_registration_generator.py
+++ b/base/android/jni_generator/jni_registration_generator.py
@@ -316,7 +316,7 @@ def main(argv):
help='The output file path.')
arg_parser.add_argument('--no_register_java',
help='A list of Java files which should be ignored '
- 'by the parser.')
+ 'by the parser.', default=[])
args = arg_parser.parse_args(build_utils.ExpandFileArgs(argv[1:]))
args.sources_files = build_utils.ParseGnList(args.sources_files)
diff --git a/base/debug/task_annotator.h b/base/debug/task_annotator.h
index fedca7d599..9ff5c7bbb1 100644
--- a/base/debug/task_annotator.h
+++ b/base/debug/task_annotator.h
@@ -20,6 +20,7 @@ class BASE_EXPORT TaskAnnotator {
public:
class ObserverForTesting {
public:
+ virtual ~ObserverForTesting() = default;
// Invoked just before RunTask() in the scope in which the task is about to
// be executed.
virtual void BeforeRunTask(const PendingTask* pending_task) = 0;
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index 83018f2f34..3eab061cc1 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -275,7 +275,7 @@ int File::Write(int64_t offset, const char* data, int size) {
int bytes_written = 0;
int rv;
do {
-#if defined(OS_ANDROID)
+#if _FILE_OFFSET_BITS != 64 || defined(__BIONIC__)
// In case __USE_FILE_OFFSET64 is not used, we need to call pwrite64()
// instead of pwrite().
static_assert(sizeof(int64_t) == sizeof(off64_t),
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index 130048760e..f5f32674e0 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -596,6 +596,8 @@ bool GetTempDir(FilePath* path) {
#if 0 // This is for building Chromium browser on Android.
return PathService::Get(DIR_CACHE, path);
#endif
+ *path = FilePath("/data/local/tmp");
+ return true;
#else
*path = FilePath("/tmp");
return true;
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 36d3158600..4449373ead 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -55,7 +55,7 @@
// LazyInstance uses its own struct initializer-list style static
// initialization, which does not require a constructor.
-#define LAZY_INSTANCE_INITIALIZER {0}
+#define LAZY_INSTANCE_INITIALIZER {}
namespace base {
diff --git a/base/memory/shared_memory_mapping.cc b/base/memory/shared_memory_mapping.cc
index 005e3fcc31..2b42928076 100644
--- a/base/memory/shared_memory_mapping.cc
+++ b/base/memory/shared_memory_mapping.cc
@@ -7,7 +7,8 @@
#include <utility>
#include "base/logging.h"
-#include "base/memory/shared_memory_tracker.h"
+// Unsupported in libchrome
+// #include "base/memory/shared_memory_tracker.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
@@ -62,14 +63,15 @@ SharedMemoryMapping::SharedMemoryMapping(void* memory,
size_t mapped_size,
const UnguessableToken& guid)
: memory_(memory), size_(size), mapped_size_(mapped_size), guid_(guid) {
- SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
+ // Unsupported in libchrome.
+ // SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
}
void SharedMemoryMapping::Unmap() {
if (!IsValid())
return;
-
- SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
+ // Unsupported in libchrome.
+ // SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
#if defined(OS_WIN)
if (!UnmapViewOfFile(memory_))
DPLOG(ERROR) << "UnmapViewOfFile";
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 16f6ebb1b8..cfd62f9eb6 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -28,6 +28,10 @@
#include "base/time/time.h"
#include "build/build_config.h"
+// Just in libchrome
+namespace brillo {
+class BaseMessageLoop;
+}
namespace base {
class ThreadTaskRunnerHandle;
@@ -214,6 +218,8 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate,
void BindToCurrentThread();
private:
+ //only in libchrome
+ friend class brillo::BaseMessageLoop;
friend class internal::IncomingTaskQueue;
friend class MessageLoopCurrent;
friend class MessageLoopCurrentForIO;
diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc
index 3857db855a..168db23cb1 100644
--- a/base/message_loop/message_loop_unittest.cc
+++ b/base/message_loop/message_loop_unittest.cc
@@ -22,7 +22,8 @@
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
-#include "base/task_scheduler/task_scheduler.h"
+// Unsupported in libchrome
+// #include "base/task_scheduler/task_scheduler.h"
#include "base/test/gtest_util.h"
#include "base/test/test_simple_task_runner.h"
#include "base/test/test_timeouts.h"
@@ -260,7 +261,8 @@ void PostNTasks(int posts_remaining) {
enum class TaskSchedulerAvailability {
NO_TASK_SCHEDULER,
- WITH_TASK_SCHEDULER,
+ // Unsupported in libchrome.
+ // WITH_TASK_SCHEDULER,
};
std::string TaskSchedulerAvailabilityToString(
@@ -268,8 +270,9 @@ std::string TaskSchedulerAvailabilityToString(
switch (availability) {
case TaskSchedulerAvailability::NO_TASK_SCHEDULER:
return "NoTaskScheduler";
- case TaskSchedulerAvailability::WITH_TASK_SCHEDULER:
- return "WithTaskScheduler";
+ // Unsupported in libchrome.
+ // case TaskSchedulerAvailability::WITH_TASK_SCHEDULER:
+ // return "WithTaskScheduler";
}
NOTREACHED();
return "Unknown";
@@ -282,11 +285,16 @@ class MessageLoopTest
~MessageLoopTest() override = default;
void SetUp() override {
+ // Unsupported in libchrome.
+#if 0
if (GetParam() == TaskSchedulerAvailability::WITH_TASK_SCHEDULER)
TaskScheduler::CreateAndStartWithDefaultParams("MessageLoopTest");
+#endif
}
void TearDown() override {
+ // Unsupported in libchrome.
+#if 0
if (GetParam() == TaskSchedulerAvailability::WITH_TASK_SCHEDULER) {
// Failure to call FlushForTesting() could result in task leaks as tasks
// are skipped on shutdown.
@@ -295,6 +303,7 @@ class MessageLoopTest
base::TaskScheduler::GetInstance()->JoinForTesting();
base::TaskScheduler::SetInstance(nullptr);
}
+#endif
}
static std::string ParamInfoToString(
@@ -776,13 +785,18 @@ class MessageLoopTypedTest
~MessageLoopTypedTest() = default;
void SetUp() override {
+// Unsupported in libchrome.
+#if 0
if (GetTaskSchedulerAvailability() ==
TaskSchedulerAvailability::WITH_TASK_SCHEDULER) {
TaskScheduler::CreateAndStartWithDefaultParams("MessageLoopTypedTest");
}
+#endif
}
void TearDown() override {
+// Unsupported in libchrome.
+#if 0
if (GetTaskSchedulerAvailability() ==
TaskSchedulerAvailability::WITH_TASK_SCHEDULER) {
// Failure to call FlushForTesting() could result in task leaks as tasks
@@ -792,6 +806,7 @@ class MessageLoopTypedTest
base::TaskScheduler::GetInstance()->JoinForTesting();
base::TaskScheduler::SetInstance(nullptr);
}
+#endif
}
static std::string ParamInfoToString(
@@ -1769,8 +1784,10 @@ INSTANTIATE_TEST_CASE_P(
TaskSchedulerAvailability::NO_TASK_SCHEDULER),
MessageLoopTypedTestParams(
MessageLoop::TYPE_UI,
- TaskSchedulerAvailability::NO_TASK_SCHEDULER),
- MessageLoopTypedTestParams(
+ TaskSchedulerAvailability::NO_TASK_SCHEDULER)
+// Unsupported in libchrome.
+#if 0
+ ,MessageLoopTypedTestParams(
MessageLoop::TYPE_DEFAULT,
TaskSchedulerAvailability::WITH_TASK_SCHEDULER),
MessageLoopTypedTestParams(
@@ -1778,7 +1795,9 @@ INSTANTIATE_TEST_CASE_P(
TaskSchedulerAvailability::WITH_TASK_SCHEDULER),
MessageLoopTypedTestParams(
MessageLoop::TYPE_UI,
- TaskSchedulerAvailability::WITH_TASK_SCHEDULER)),
+ TaskSchedulerAvailability::WITH_TASK_SCHEDULER)
+#endif
+ ),
MessageLoopTypedTest::ParamInfoToString);
#if defined(OS_WIN)
@@ -2210,8 +2229,10 @@ TEST_P(MessageLoopTest, SequenceLocalStorageDifferentMessageLoops) {
INSTANTIATE_TEST_CASE_P(
,
MessageLoopTest,
- ::testing::Values(TaskSchedulerAvailability::NO_TASK_SCHEDULER,
- TaskSchedulerAvailability::WITH_TASK_SCHEDULER),
+ ::testing::Values(TaskSchedulerAvailability::NO_TASK_SCHEDULER
+ // Unsupported in libchrome
+ //, TaskSchedulerAvailability::WITH_TASK_SCHEDULER
+ ),
MessageLoopTest::ParamInfoToString);
namespace {
diff --git a/base/message_loop/message_pump_for_ui.h b/base/message_loop/message_pump_for_ui.h
index 54830f598b..ff6f788317 100644
--- a/base/message_loop/message_pump_for_ui.h
+++ b/base/message_loop/message_pump_for_ui.h
@@ -18,9 +18,9 @@
#include "base/message_loop/message_pump.h"
#elif defined(OS_NACL) || defined(OS_AIX)
// No MessagePumpForUI, see below.
-#elif defined(USE_GLIB)
+#elif defined(USE_GLIB) && !defined(ANDROID)
#include "base/message_loop/message_pump_glib.h"
-#elif defined(OS_LINUX) || defined(OS_BSD)
+#elif defined(OS_LINUX) || defined(OS_BSD)|| defined(ANDROID)
#include "base/message_loop/message_pump_libevent.h"
#elif defined(OS_FUCHSIA)
#include "base/message_loop/message_pump_fuchsia.h"
@@ -44,9 +44,9 @@ using MessagePumpForUI = MessagePump;
#elif defined(OS_NACL) || defined(OS_AIX)
// Currently NaCl and AIX don't have a MessagePumpForUI.
// TODO(abarth): Figure out if we need this.
-#elif defined(USE_GLIB)
+#elif defined(USE_GLIB) && !defined(ANDROID)
using MessagePumpForUI = MessagePumpGlib;
-#elif defined(OS_LINUX) || defined(OS_BSD)
+#elif defined(OS_LINUX) || defined(OS_BSD) || defined(ANDROID)
using MessagePumpForUI = MessagePumpLibevent;
#elif defined(OS_FUCHSIA)
using MessagePumpForUI = MessagePumpFuchsia;
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 1470b90e25..50d7e7e9b3 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -17,9 +17,11 @@
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/string_piece.h"
#include "base/synchronization/waitable_event.h"
-#include "base/task_scheduler/post_task.h"
-#include "base/task_scheduler/task_scheduler.h"
+// TaskScheduler not supported in libchrome
+// #include "base/task_scheduler/post_task.h"
+// #include "base/task_scheduler/task_scheduler.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/platform_thread.h"
@@ -690,6 +692,8 @@ class SequenceVerificationObserver : public Foo {
} // namespace
// Verify that observers are notified on the correct sequence.
+// TaskScheduler not supported in libchrome
+#if 0
TEST(ObserverListThreadSafeTest, NotificationOnValidSequence) {
test::ScopedTaskEnvironment scoped_task_environment;
@@ -717,9 +721,12 @@ TEST(ObserverListThreadSafeTest, NotificationOnValidSequence) {
EXPECT_TRUE(observer_1.called_on_valid_sequence());
EXPECT_TRUE(observer_2.called_on_valid_sequence());
}
+#endif
// Verify that when an observer is added to a NOTIFY_ALL ObserverListThreadSafe
// from a notification, it is itself notified.
+// TaskScheduler not supported in libchrome
+#if 0
TEST(ObserverListThreadSafeTest, AddObserverFromNotificationNotifyAll) {
test::ScopedTaskEnvironment scoped_task_environment;
auto observer_list = MakeRefCounted<ObserverListThreadSafe<Foo>>();
@@ -737,6 +744,7 @@ TEST(ObserverListThreadSafeTest, AddObserverFromNotificationNotifyAll) {
EXPECT_EQ(1, observer_added_from_notification.GetValue());
}
+#endif
namespace {
@@ -769,6 +777,8 @@ class RemoveWhileNotificationIsRunningObserver : public Foo {
// Verify that there is no crash when an observer is removed while it is being
// notified.
+// TaskScheduler not supported in libchrome
+#if 0
TEST(ObserverListThreadSafeTest, RemoveWhileNotificationIsRunning) {
auto observer_list = MakeRefCounted<ObserverListThreadSafe<Foo>>();
RemoveWhileNotificationIsRunningObserver observer;
@@ -793,6 +803,7 @@ TEST(ObserverListThreadSafeTest, RemoveWhileNotificationIsRunning) {
observer.Unblock();
}
+#endif
TEST(ObserverListTest, Existing) {
ObserverList<Foo> observer_list(ObserverListPolicy::EXISTING_ONLY);
diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc
index 171753c71e..11e482b2e8 100644
--- a/base/process/memory_linux.cc
+++ b/base/process/memory_linux.cc
@@ -22,6 +22,10 @@
#include "third_party/tcmalloc/gperftools-2.0/chromium/src/gperftools/tcmalloc.h"
#endif
+extern "C" {
+void* __libc_malloc(size_t size);
+}
+
namespace base {
size_t g_oom_size = 0U;
diff --git a/base/strings/string_number_conversions.cc b/base/strings/string_number_conversions.cc
index 86fa2e34af..f7fc7b394f 100644
--- a/base/strings/string_number_conversions.cc
+++ b/base/strings/string_number_conversions.cc
@@ -368,13 +368,20 @@ std::string NumberToString(double value) {
}
base::string16 NumberToString16(double value) {
- // According to g_fmt.cc, it is sufficient to declare a buffer of size 32.
- char buffer[32];
- dmg_fp::g_fmt(buffer, value);
+ auto tmp = std::to_string(value);
+ base::string16 ret(tmp.c_str(), tmp.c_str() + tmp.length());
- // The number will be ASCII. This creates the string using the "input
- // iterator" variant which promotes from 8-bit to 16-bit via "=".
- return base::string16(&buffer[0], &buffer[strlen(buffer)]);
+ // If this returned an integer, don't do anything.
+ if (ret.find('.') == std::string::npos) {
+ return ret;
+ }
+ // Otherwise, it has an annoying tendency to leave trailing zeros.
+ size_t len = ret.size();
+ while (len >= 2 && ret[len - 1] == '0' && ret[len - 2] != '.') {
+ --len;
+ }
+ ret.erase(len);
+ return ret;
}
bool StringToInt(StringPiece input, int* output) {
diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc
index d969450667..762c86e9dc 100644
--- a/base/strings/string_number_conversions_unittest.cc
+++ b/base/strings/string_number_conversions_unittest.cc
@@ -836,12 +836,12 @@ TEST(StringNumberConversionsTest, DoubleToString) {
const char input_bytes[8] = {0, 0, 0, 0, '\xee', '\x6d', '\x73', '\x42'};
double input = 0;
memcpy(&input, input_bytes, arraysize(input_bytes));
- EXPECT_EQ("1335179083776", NumberToString(input));
+ EXPECT_EQ("1335179083776.0", NumberToString(input));
const char input_bytes2[8] =
{0, 0, 0, '\xa0', '\xda', '\x6c', '\x73', '\x42'};
input = 0;
memcpy(&input, input_bytes2, arraysize(input_bytes2));
- EXPECT_EQ("1334890332160", NumberToString(input));
+ EXPECT_EQ("1334890332160.0", NumberToString(input));
}
TEST(StringNumberConversionsTest, HexEncode) {
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h
index dd7274cf42..dcfbcbdae7 100644
--- a/base/test/test_mock_time_task_runner.h
+++ b/base/test/test_mock_time_task_runner.h
@@ -17,6 +17,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/test/test_pending_task.h"
#include "base/threading/thread_checker_impl.h"
diff --git a/base/threading/thread_id_name_manager.cc b/base/threading/thread_id_name_manager.cc
index ca1979d155..c1065a9b00 100644
--- a/base/threading/thread_id_name_manager.cc
+++ b/base/threading/thread_id_name_manager.cc
@@ -94,8 +94,7 @@ void ThreadIdNameManager::SetName(const std::string& name) {
// call GetName(which holds a lock) during the first allocation because it can
// cause a deadlock when the first allocation happens in the
// ThreadIdNameManager itself when holding the lock.
- trace_event::AllocationContextTracker::SetCurrentThreadName(
- leaked_str->c_str());
+ // leaked_str->c_str());
}
const char* ThreadIdNameManager::GetName(PlatformThreadId id) {
diff --git a/base/values.cc b/base/values.cc
index 085f0f0461..a48af5eb61 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -18,7 +18,8 @@
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/trace_event/memory_usage_estimator.h"
+// Unsupported in libchrome
+// #include "base/trace_event/memory_usage_estimator.h"
namespace base {
@@ -632,20 +633,21 @@ bool Value::Equals(const Value* other) const {
return *this == *other;
}
-size_t Value::EstimateMemoryUsage() const {
- switch (type_) {
- case Type::STRING:
- return base::trace_event::EstimateMemoryUsage(string_value_);
- case Type::BINARY:
- return base::trace_event::EstimateMemoryUsage(binary_value_);
- case Type::DICTIONARY:
- return base::trace_event::EstimateMemoryUsage(dict_);
- case Type::LIST:
- return base::trace_event::EstimateMemoryUsage(list_);
- default:
- return 0;
- }
-}
+// Unsupported in libchrome
+// size_t Value::EstimateMemoryUsage() const {
+// switch (type_) {
+// case Type::STRING:
+// return base::trace_event::EstimateMemoryUsage(string_value_);
+// case Type::BINARY:
+// return base::trace_event::EstimateMemoryUsage(binary_value_);
+// case Type::DICTIONARY:
+// return base::trace_event::EstimateMemoryUsage(dict_);
+// case Type::LIST:
+// return base::trace_event::EstimateMemoryUsage(list_);
+// default:
+// return 0;
+// }
+// }
void Value::InternalMoveConstructFrom(Value&& that) {
type_ = that.type_;
diff --git a/base/values.h b/base/values.h
index e9253db42c..85113d99be 100644
--- a/base/values.h
+++ b/base/values.h
@@ -352,7 +352,7 @@ class BASE_EXPORT Value {
// Estimates dynamic memory usage.
// See base/trace_event/memory_usage_estimator.h for more info.
- size_t EstimateMemoryUsage() const;
+ // size_t EstimateMemoryUsage() const;
protected:
// TODO(crbug.com/646113): Make these private once DictionaryValue and
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index f1764b9c89..a1dbecff25 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -25,8 +25,10 @@ import zipfile
# Some clients do not add //build/android/gyp to PYTHONPATH.
import md5_check # pylint: disable=relative-import
-sys.path.append(os.path.join(os.path.dirname(__file__),
- os.pardir, os.pardir, os.pardir))
+#sys.path.append(os.path.join(os.path.dirname(__file__),
+# os.pardir, os.pardir, os.pardir))
+sys.path.insert(0, os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir))
import gn_helpers
# Definition copied from pylib/constants/__init__.py to avoid adding
diff --git a/mojo/core/core.cc b/mojo/core/core.cc
index 8422ec247a..3ffa640ed3 100644
--- a/mojo/core/core.cc
+++ b/mojo/core/core.cc
@@ -21,7 +21,7 @@
#include "base/strings/string_piece.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "base/trace_event/memory_dump_manager.h"
+// #include "base/trace_event/memory_dump_manager.h"
#include "build/build_config.h"
#include "mojo/core/channel.h"
#include "mojo/core/configuration.h"
@@ -127,8 +127,8 @@ void RunMojoProcessErrorHandler(ProcessDisconnectHandler* disconnect_handler,
Core::Core() {
handles_.reset(new HandleTable);
- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
- handles_.get(), "MojoHandleTable", nullptr);
+ // base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
+ // handles_.get(), "MojoHandleTable", nullptr);
}
Core::~Core() {
@@ -142,8 +142,8 @@ Core::~Core() {
base::BindOnce(&Core::PassNodeControllerToIOThread,
base::Passed(&node_controller_)));
}
- base::trace_event::MemoryDumpManager::GetInstance()
- ->UnregisterAndDeleteDumpProviderSoon(std::move(handles_));
+ // base::trace_event::MemoryDumpManager::GetInstance()
+ // ->UnregisterAndDeleteDumpProviderSoon(std::move(handles_));
}
void Core::SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner) {
diff --git a/mojo/core/handle_table.cc b/mojo/core/handle_table.cc
index 62419a9236..5dbbf98b50 100644
--- a/mojo/core/handle_table.cc
+++ b/mojo/core/handle_table.cc
@@ -8,35 +8,35 @@
#include <limits>
-#include "base/trace_event/memory_dump_manager.h"
+// #include "base/trace_event/memory_dump_manager.h"
namespace mojo {
namespace core {
namespace {
-const char* GetNameForDispatcherType(Dispatcher::Type type) {
- switch (type) {
- case Dispatcher::Type::UNKNOWN:
- return "unknown";
- case Dispatcher::Type::MESSAGE_PIPE:
- return "message_pipe";
- case Dispatcher::Type::DATA_PIPE_PRODUCER:
- return "data_pipe_producer";
- case Dispatcher::Type::DATA_PIPE_CONSUMER:
- return "data_pipe_consumer";
- case Dispatcher::Type::SHARED_BUFFER:
- return "shared_buffer";
- case Dispatcher::Type::WATCHER:
- return "watcher";
- case Dispatcher::Type::PLATFORM_HANDLE:
- return "platform_handle";
- case Dispatcher::Type::INVITATION:
- return "invitation";
- }
- NOTREACHED();
- return "unknown";
-}
+// const char* GetNameForDispatcherType(Dispatcher::Type type) {
+// switch (type) {
+// case Dispatcher::Type::UNKNOWN:
+// return "unknown";
+// case Dispatcher::Type::MESSAGE_PIPE:
+// return "message_pipe";
+// case Dispatcher::Type::DATA_PIPE_PRODUCER:
+// return "data_pipe_producer";
+// case Dispatcher::Type::DATA_PIPE_CONSUMER:
+// return "data_pipe_consumer";
+// case Dispatcher::Type::SHARED_BUFFER:
+// return "shared_buffer";
+// case Dispatcher::Type::WATCHER:
+// return "watcher";
+// case Dispatcher::Type::PLATFORM_HANDLE:
+// return "platform_handle";
+// case Dispatcher::Type::INVITATION:
+// return "invitation";
+// }
+// NOTREACHED();
+// return "unknown";
+// }
} // namespace
@@ -158,18 +158,38 @@ void HandleTable::GetActiveHandlesForTest(std::vector<MojoHandle>* handles) {
}
// MemoryDumpProvider implementation.
-bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
- base::trace_event::ProcessMemoryDump* pmd) {
- // Create entries for all relevant dispatcher types to ensure they are present
- // in the final dump.
- std::map<Dispatcher::Type, int> handle_count;
- handle_count[Dispatcher::Type::MESSAGE_PIPE];
- handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER];
- handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER];
- handle_count[Dispatcher::Type::SHARED_BUFFER];
- handle_count[Dispatcher::Type::WATCHER];
- handle_count[Dispatcher::Type::PLATFORM_HANDLE];
- handle_count[Dispatcher::Type::INVITATION];
+// bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
+// base::trace_event::ProcessMemoryDump* pmd) {
+// // Create entries for all relevant dispatcher types to ensure they are present
+// // in the final dump.
+// std::map<Dispatcher::Type, int> handle_count;
+// handle_count[Dispatcher::Type::MESSAGE_PIPE];
+// handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER];
+// handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER];
+// handle_count[Dispatcher::Type::SHARED_BUFFER];
+// handle_count[Dispatcher::Type::WATCHER];
+// handle_count[Dispatcher::Type::PLATFORM_HANDLE];
+// handle_count[Dispatcher::Type::INVITATION];
+
+// // Count the number of each dispatcher type.
+// {
+// base::AutoLock lock(GetLock());
+// for (const auto& entry : handles_) {
+// ++handle_count[entry.second.dispatcher->GetType()];
+// }
+// }
+
+// for (const auto& entry : handle_count) {
+// base::trace_event::MemoryAllocatorDump* inner_dump =
+// pmd->CreateAllocatorDump(std::string("mojo/") +
+// GetNameForDispatcherType(entry.first));
+// inner_dump->AddScalar(
+// base::trace_event::MemoryAllocatorDump::kNameObjectCount,
+// base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second);
+// }
+
+// return true;
+// }
// Count the number of each dispatcher type.
{
diff --git a/mojo/core/handle_table.h b/mojo/core/handle_table.h
index 234bdac239..e4747a9617 100644
--- a/mojo/core/handle_table.h
+++ b/mojo/core/handle_table.h
@@ -13,7 +13,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/synchronization/lock.h"
-#include "base/trace_event/memory_dump_provider.h"
+// #include "base/trace_event/memory_dump_provider.h"
#include "mojo/core/dispatcher.h"
#include "mojo/core/system_impl_export.h"
#include "mojo/public/c/system/types.h"
@@ -21,8 +21,7 @@
namespace mojo {
namespace core {
-class MOJO_SYSTEM_IMPL_EXPORT HandleTable
- : public base::trace_event::MemoryDumpProvider {
+class MOJO_SYSTEM_IMPL_EXPORT HandleTable {
public:
HandleTable();
~HandleTable() override;
@@ -58,11 +57,11 @@ class MOJO_SYSTEM_IMPL_EXPORT HandleTable
void GetActiveHandlesForTest(std::vector<MojoHandle>* handles);
private:
- FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump);
+ // FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump);
// MemoryDumpProvider implementation.
- bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
- base::trace_event::ProcessMemoryDump* pmd) override;
+ // bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
+ // base::trace_event::ProcessMemoryDump* pmd) override;
struct Entry {
Entry();
diff --git a/mojo/core/user_message_impl.cc b/mojo/core/user_message_impl.cc
index d4a4da16a2..8ad1aea01d 100644
--- a/mojo/core/user_message_impl.cc
+++ b/mojo/core/user_message_impl.cc
@@ -13,10 +13,10 @@
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
-#include "base/trace_event/memory_allocator_dump.h"
-#include "base/trace_event/memory_dump_manager.h"
-#include "base/trace_event/memory_dump_provider.h"
-#include "base/trace_event/trace_event.h"
+// #include "base/trace_event/memory_allocator_dump.h"
+// #include "base/trace_event/memory_dump_manager.h"
+// #include "base/trace_event/memory_dump_provider.h"
+// #include "base/trace_event/trace_event.h"
#include "mojo/core/core.h"
#include "mojo/core/node_channel.h"
#include "mojo/core/node_controller.h"
@@ -271,12 +271,36 @@ void DecrementMessageCount() {
base::subtle::NoBarrier_AtomicIncrement(&g_message_count, -1);
}
-class MessageMemoryDumpProvider : public base::trace_event::MemoryDumpProvider {
- public:
- MessageMemoryDumpProvider() {
- base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
- this, "MojoMessages", nullptr);
- }
+// class MessageMemoryDumpProvider : public base::trace_event::MemoryDumpProvider {
+// public:
+// MessageMemoryDumpProvider() {
+// base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
+// this, "MojoMessages", nullptr);
+// }
+
+// ~MessageMemoryDumpProvider() override {
+// base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
+// this);
+// }
+
+// private:
+// // base::trace_event::MemoryDumpProvider:
+// bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
+// base::trace_event::ProcessMemoryDump* pmd) override {
+// auto* dump = pmd->CreateAllocatorDump("mojo/messages");
+// dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
+// base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+// base::subtle::NoBarrier_Load(&g_message_count));
+// return true;
+// }
+
+// DISALLOW_COPY_AND_ASSIGN(MessageMemoryDumpProvider);
+// };
+
+// void EnsureMemoryDumpProviderExists() {
+// static base::NoDestructor<MessageMemoryDumpProvider> provider;
+// ALLOW_UNUSED_LOCAL(provider);
+// }
~MessageMemoryDumpProvider() override {
base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
@@ -648,7 +672,7 @@ void UserMessageImpl::FailHandleSerializationForTesting(bool fail) {
UserMessageImpl::UserMessageImpl(ports::UserMessageEvent* message_event)
: ports::UserMessage(&kUserMessageTypeInfo), message_event_(message_event) {
- EnsureMemoryDumpProviderExists();
+ // EnsureMemoryDumpProviderExists();
IncrementMessageCount();
}
@@ -667,7 +691,7 @@ UserMessageImpl::UserMessageImpl(ports::UserMessageEvent* message_event,
header_size_(header_size),
user_payload_(user_payload),
user_payload_size_(user_payload_size) {
- EnsureMemoryDumpProviderExists();
+ // EnsureMemoryDumpProviderExists();
IncrementMessageCount();
}
diff --git a/mojo/public/cpp/bindings/lib/message_dumper.cc b/mojo/public/cpp/bindings/lib/message_dumper.cc
index f187e4569b..c4f32b1490 100644
--- a/mojo/public/cpp/bindings/lib/message_dumper.cc
+++ b/mojo/public/cpp/bindings/lib/message_dumper.cc
@@ -22,9 +22,33 @@ base::FilePath& DumpDirectory() {
return *dump_directory;
}
-void WriteMessage(uint32_t identifier,
- const mojo::MessageDumper::MessageEntry& entry) {
- static uint64_t num = 0;
+// void WriteMessage(uint32_t identifier,
+// const mojo::MessageDumper::MessageEntry& entry) {
+// static uint64_t num = 0;
+
+// if (!entry.interface_name)
+// return;
+
+// base::FilePath message_directory =
+// DumpDirectory()
+// .AppendASCII(entry.interface_name)
+// .AppendASCII(base::NumberToString(identifier));
+
+// if (!base::DirectoryExists(message_directory) &&
+// !base::CreateDirectory(message_directory)) {
+// LOG(ERROR) << "Failed to create" << message_directory.value();
+// return;
+// }
+
+// std::string filename =
+// base::NumberToString(num++) + "." + entry.method_name + ".mojomsg";
+// base::FilePath path = message_directory.AppendASCII(filename);
+// base::File file(path,
+// base::File::FLAG_WRITE | base::File::FLAG_CREATE_ALWAYS);
+
+// file.WriteAtCurrentPos(reinterpret_cast<const char*>(entry.data_bytes.data()),
+// static_cast<int>(entry.data_bytes.size()));
+// }
if (!entry.interface_name)
return;
@@ -71,17 +95,17 @@ MessageDumper::MessageDumper() : identifier_(base::RandUint64()) {}
MessageDumper::~MessageDumper() {}
bool MessageDumper::Accept(mojo::Message* message) {
- MessageEntry entry(message->data(), message->data_num_bytes(),
- message->interface_name(), message->method_name());
+ // MessageEntry entry(message->data(), message->data_num_bytes(),
+ // "unknown interface", "unknown name");
- static base::NoDestructor<scoped_refptr<base::TaskRunner>> task_runner(
- base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::USER_BLOCKING,
- base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
+ // static base::NoDestructor<scoped_refptr<base::TaskRunner>> task_runner(
+ // base::CreateSequencedTaskRunnerWithTraits(
+ // {base::MayBlock(), base::TaskPriority::USER_BLOCKING,
+ // base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
- (*task_runner)
- ->PostTask(FROM_HERE,
- base::BindOnce(&WriteMessage, identifier_, std::move(entry)));
+ // (*task_runner)
+ // ->PostTask(FROM_HERE,
+ // base::BindOnce(&WriteMessage, identifier_, std::move(entry)));
return true;
}
diff --git a/mojo/public/cpp/system/file_data_pipe_producer.cc b/mojo/public/cpp/system/file_data_pipe_producer.cc
index 842fe8f299..6038bbe16b 100644
--- a/mojo/public/cpp/system/file_data_pipe_producer.cc
+++ b/mojo/public/cpp/system/file_data_pipe_producer.cc
@@ -266,13 +266,15 @@ void FileDataPipeProducer::WriteFromPath(const base::FilePath& path,
void FileDataPipeProducer::InitializeNewRequest(CompletionCallback callback) {
DCHECK(!file_sequence_state_);
- auto file_task_runner = base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::BACKGROUND});
- file_sequence_state_ = new FileSequenceState(
- std::move(producer_), file_task_runner,
- base::BindOnce(&FileDataPipeProducer::OnWriteComplete,
- weak_factory_.GetWeakPtr(), std::move(callback)),
- base::SequencedTaskRunnerHandle::Get(), std::move(observer_));
+
+ LOG(FATAL) << "unsupported in libchrome";
+ // auto file_task_runner = base::CreateSequencedTaskRunnerWithTraits(
+ // {base::MayBlock(), base::TaskPriority::BACKGROUND});
+ // file_sequence_state_ = new FileSequenceState(
+ // std::move(producer_), file_task_runner,
+ // base::BindOnce(&FileDataPipeProducer::OnWriteComplete,
+ // weak_factory_.GetWeakPtr(), std::move(callback)),
+ // base::SequencedTaskRunnerHandle::Get(), std::move(observer_));
}
void FileDataPipeProducer::OnWriteComplete(
diff --git a/mojo/public/mojom/base/file_path.mojom b/mojo/public/mojom/base/file_path.mojom
index 674d8cdee1..097b37eeb9 100644
--- a/mojo/public/mojom/base/file_path.mojom
+++ b/mojo/public/mojom/base/file_path.mojom
@@ -5,7 +5,13 @@
module mojo_base.mojom;
struct FilePath {
- [EnableIf=file_path_is_string]
+ // In chrome, ninja have a goal that can define file_path_is_string for a set
+ // of mojom files.
+ // In android we don't have such ability ,one would have to add
+ // "--enable_feature file_path_is_string" to all targets generating pickle
+ // files, headers and sources, and also in all project including them.
+ // Faster solution was to just remove this "EnableIf" definition in libchrome.
+ // [EnableIf=file_path_is_string]
string path;
// This duplicates the contents of mojo_base.mojom.String16. String16 isn't
diff --git a/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
index 59c6fee758..7af57bd968 100644
--- a/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
@@ -175,6 +175,7 @@ if ({{variable}} != null) {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new {{struct|name}}(elementsOrVersion);
+
{%- set prev_ver = [0] %}
{%- for byte in struct.bytes %}
{%- for packed_field in byte.packed_fields %}
@@ -183,7 +184,9 @@ if ({{variable}} != null) {
}
{%- endif %}
{%- set _ = prev_ver.append(packed_field.min_version) %}
+{%- if prev_ver[-1] != 0 %}
if (elementsOrVersion >= {{packed_field.min_version}}) {
+{%- endif %}
{%- endif %}
{
{{decode('result.' ~ packed_field.field|name, packed_field.field.kind, 8+packed_field.offset, packed_field.bit)|indent(16)}}
@@ -193,6 +196,7 @@ if ({{variable}} != null) {
{%- if prev_ver[-1] != 0 %}
}
{%- endif %}
+
} finally {
decoder0.decreaseStackDepth();
}
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.py b/mojo/public/tools/bindings/mojom_bindings_generator.py
index affbe79d91..57a803178e 100755
--- a/mojo/public/tools/bindings/mojom_bindings_generator.py
+++ b/mojo/public/tools/bindings/mojom_bindings_generator.py
@@ -174,7 +174,8 @@ class MojomProcessor(object):
MakeImportStackMessage(imported_filename_stack + [rel_filename.path])
sys.exit(1)
- tree = _UnpickleAST(_GetPicklePath(rel_filename, args.output_dir))
+ tree = _UnpickleAST(_FindPicklePath(rel_filename, args.gen_directories +
+ [args.output_dir]))
dirname = os.path.dirname(rel_filename.path)
# Process all our imports first and collect the module object for each.
@@ -256,6 +257,16 @@ def _Generate(args, remaining_args):
return 0
+def _FindPicklePath(rel_filename, search_dirs):
+ filename, _ = os.path.splitext(rel_filename.relative_path())
+ pickle_path = filename + '.p'
+ for search_dir in search_dirs:
+ path = os.path.join(search_dir, pickle_path)
+ if os.path.isfile(path):
+ return path
+ raise Exception("%s: Error: Could not find file in %r" % (pickle_path, search_dirs))
+
+
def _GetPicklePath(rel_filename, output_dir):
filename, _ = os.path.splitext(rel_filename.relative_path())
pickle_path = filename + '.p'
@@ -403,6 +414,9 @@ def main():
default="c++,javascript,java",
help="comma-separated list of generators")
generate_parser.add_argument(
+ "--gen_dir", dest="gen_directories", action="append", metavar="directory",
+ default=[], help="add a directory to be searched for the syntax trees.")
+ generate_parser.add_argument(
"-I", dest="import_directories", action="append", metavar="directory",
default=[],
help="add a directory to be searched for import files. The depth from "