diff options
136 files changed, 19 insertions, 2654 deletions
@@ -179,7 +179,6 @@ group("both_gn_and_gyp") { "//mojo/common:mojo_common_unittests", "//mojo/edk/system:mojo_system_unittests", "//mojo/edk/test:mojo_public_bindings_unittests", - "//mojo/edk/test:mojo_public_environment_unittests", "//mojo/edk/test:mojo_public_system_unittests", "//mojo/edk/test:mojo_public_utility_unittests", "//mojo/shell/public/cpp", diff --git a/build/all.gyp b/build/all.gyp index 169bd5a..68a52f4 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -54,10 +54,8 @@ # javascript-related targets cause v8 to be built. '../mojo/mojo_base.gyp:mojo_common_lib', '../mojo/mojo_base.gyp:mojo_common_unittests', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_edk_tests.gyp:mojo_public_bindings_unittests', - '../mojo/mojo_edk_tests.gyp:mojo_public_environment_unittests', '../mojo/mojo_edk_tests.gyp:mojo_public_system_unittests', '../mojo/mojo_edk_tests.gyp:mojo_public_utility_unittests', '../mojo/mojo_edk_tests.gyp:mojo_system_unittests', diff --git a/build/gn_migration.gypi b/build/gn_migration.gypi index d9211de..924e533 100644 --- a/build/gn_migration.gypi +++ b/build/gn_migration.gypi @@ -283,7 +283,6 @@ '../mojo/mojo.gyp:mojo', '../mojo/mojo_edk_tests.gyp:mojo_system_unittests', '../mojo/mojo_edk_tests.gyp:mojo_public_bindings_unittests', - '../mojo/mojo_edk_tests.gyp:mojo_public_environment_unittests', '../mojo/mojo_edk_tests.gyp:mojo_public_system_perftests', '../mojo/mojo_edk_tests.gyp:mojo_public_system_unittests', '../mojo/mojo_edk_tests.gyp:mojo_public_utility_unittests', @@ -566,7 +565,6 @@ '../media/media.gyp:media_unittests_run', '../media/midi/midi.gyp:midi_unittests_run', '../mojo/mojo_edk_tests.gyp:mojo_public_bindings_unittests_run', - '../mojo/mojo_edk_tests.gyp:mojo_public_environment_unittests_run', '../mojo/mojo_edk_tests.gyp:mojo_public_system_unittests_run', '../mojo/mojo_edk_tests.gyp:mojo_public_utility_unittests_run', '../net/net.gyp:net_unittests_run', diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 3aaab5f..db1a329 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -367,7 +367,6 @@ source_set("browser") { "//media/midi", "//mojo/common", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/public/js", "//mojo/shell/public/cpp", diff --git a/chrome/browser/ui/libgtk2ui/BUILD.gn b/chrome/browser/ui/libgtk2ui/BUILD.gn index df0649d..318f307 100644 --- a/chrome/browser/ui/libgtk2ui/BUILD.gn +++ b/chrome/browser/ui/libgtk2ui/BUILD.gn @@ -101,7 +101,6 @@ component("libgtk2ui") { "//components/resources", "//content/public/browser", "//mojo/edk/system", - "//mojo/environment:chromium", "//printing", "//skia", "//ui/aura", diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index d6f7ca9..4daba22 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3365,7 +3365,6 @@ '../media/mojo/interfaces/mojo_bindings.gyp:platform_verification_api', '../mojo/mojo_base.gyp:mojo_application_base', '../mojo/mojo_base.gyp:mojo_common_lib', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_base.gyp:mojo_url_type_converters', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_public.gyp:mojo_cpp_bindings', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 9328cf7..b64dd6e83 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -645,7 +645,6 @@ 'common/resource_usage_reporter.mojom', ], 'dependencies': [ - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_public.gyp:mojo_cpp_bindings', ], }, diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index c0bbb80..636b0f7 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -2171,7 +2171,6 @@ 'common', 'test_support_common', '../base/base.gyp:base', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../skia/skia.gyp:skia', '../sync/sync.gyp:sync', diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index c57b98c..2f0e7ab 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -2223,7 +2223,6 @@ source_set("test_support_unit") { "//chrome/browser", "//chrome/common", "//mojo/edk/system", - "//mojo/environment:chromium", ] if (!is_android && use_ash) { diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index 7e8349d..47ff249 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn @@ -110,7 +110,6 @@ source_set("unit_tests") { "//base", "//chromeos", "//ipc/mojo:mojo", - "//mojo/public/cpp/environment:environment", "//mojo/public/cpp/system:system", "//testing/gtest", "//ui/aura", diff --git a/components/arc/arc_bridge_service_unittest.cc b/components/arc/arc_bridge_service_unittest.cc index 79b1fd0..c753f23 100644 --- a/components/arc/arc_bridge_service_unittest.cc +++ b/components/arc/arc_bridge_service_unittest.cc @@ -12,7 +12,6 @@ #include "components/arc/arc_bridge_service_impl.h" #include "components/arc/test/fake_arc_bridge_instance.h" #include "ipc/mojo/scoped_ipc_support.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/message_pipe.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/components/contextual_search/BUILD.gn b/components/contextual_search/BUILD.gn index 096c54a..8d54602 100644 --- a/components/contextual_search/BUILD.gn +++ b/components/contextual_search/BUILD.gn @@ -40,7 +40,6 @@ static_library("renderer") { "//content/public/common", "//content/public/renderer", "//gin", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//third_party/WebKit/public:blink_headers", "//v8", diff --git a/components/dom_distiller.gypi b/components/dom_distiller.gypi index b6d25e3..adf078e 100644 --- a/components/dom_distiller.gypi +++ b/components/dom_distiller.gypi @@ -162,7 +162,6 @@ 'dom_distiller_protos', '../base/base.gyp:base', '../content/content.gyp:content_browser', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../net/net.gyp:net', '../skia/skia.gyp:skia', @@ -214,7 +213,6 @@ '../base/base.gyp:base', '../content/content.gyp:content_browser', '../gin/gin.gyp:gin', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_public.gyp:mojo_cpp_bindings', ], 'include_dirs': [ diff --git a/components/dom_distiller/content/browser/BUILD.gn b/components/dom_distiller/content/browser/BUILD.gn index db8c9fe..db24bc2 100644 --- a/components/dom_distiller/content/browser/BUILD.gn +++ b/components/dom_distiller/content/browser/BUILD.gn @@ -36,7 +36,6 @@ static_library("browser") { "//components/strings", "//content/public/browser", "//content/public/common", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//net", "//skia", diff --git a/components/dom_distiller/content/renderer/BUILD.gn b/components/dom_distiller/content/renderer/BUILD.gn index f4e1f1e..a442dec 100644 --- a/components/dom_distiller/content/renderer/BUILD.gn +++ b/components/dom_distiller/content/renderer/BUILD.gn @@ -26,7 +26,6 @@ static_library("renderer") { "//content/public/common", "//content/public/renderer", "//gin", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//skia", "//third_party/WebKit/public:blink_headers", diff --git a/components/filesystem/BUILD.gn b/components/filesystem/BUILD.gn index 5cfeed2..ff28424 100644 --- a/components/filesystem/BUILD.gn +++ b/components/filesystem/BUILD.gn @@ -44,7 +44,6 @@ mojo_native_application("filesystem") { "//base", "//components/filesystem/public/interfaces", "//mojo/common", - "//mojo/environment:chromium", "//mojo/platform_handle:for_shared_library", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", diff --git a/components/leveldb/BUILD.gn b/components/leveldb/BUILD.gn index d713fa3..32787b4 100644 --- a/components/leveldb/BUILD.gn +++ b/components/leveldb/BUILD.gn @@ -42,7 +42,6 @@ mojo_native_application("leveldb") { ":manifest", "//components/leveldb/public/interfaces", "//mojo/common", - "//mojo/environment:chromium", "//mojo/platform_handle:for_shared_library", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", diff --git a/components/mus/public/cpp/BUILD.gn b/components/mus/public/cpp/BUILD.gn index d750a9d..7df9d20 100644 --- a/components/mus/public/cpp/BUILD.gn +++ b/components/mus/public/cpp/BUILD.gn @@ -55,7 +55,6 @@ source_set("cpp") { "//mojo/gles2", "//mojo/gpu:mojo_gles2_implementation", "//mojo/public/cpp/bindings:bindings", - "//mojo/public/cpp/environment", "//mojo/public/cpp/system", "//mojo/shell/public/cpp", "//mojo/shell/public/interfaces", diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn index 8543f97..e9f94f0 100644 --- a/components/mus/ws/BUILD.gn +++ b/components/mus/ws/BUILD.gn @@ -174,7 +174,6 @@ test("window_manager_unittests") { "//mojo/converters/input_events", "//mojo/converters/transform", "//mojo/edk/test:run_all_unittests", - "//mojo/environment:chromium", "//mojo/gles2", "//mojo/platform_handle:for_shared_library", "//mojo/public/cpp/bindings:bindings", diff --git a/components/resource_provider/BUILD.gn b/components/resource_provider/BUILD.gn index 6a7a7e5..bcdb01a 100644 --- a/components/resource_provider/BUILD.gn +++ b/components/resource_provider/BUILD.gn @@ -34,7 +34,6 @@ if (is_android) { "//base", "//build/config/sanitizers:deps", "//components/resource_provider/public/interfaces", - "//mojo/environment:chromium", "//mojo/platform_handle:for_shared_library", "//mojo/public/c/system:for_shared_library", "//mojo/shell/public/cpp", @@ -75,7 +74,6 @@ if (is_android) { ":manifest", "//base", "//components/resource_provider/public/interfaces", - "//mojo/environment:chromium", "//mojo/shell/public/cpp", "//url", ] @@ -119,7 +117,6 @@ test("resource_provider_unittests") { "//base/test:test_config", "//components/resource_provider/public/interfaces", "//mojo/edk/test:run_all_unittests", - "//mojo/environment:chromium", "//mojo/platform_handle:for_shared_library", "//testing/gtest", "//url", diff --git a/content/app/BUILD.gn b/content/app/BUILD.gn index 435a39e..96dca6d 100644 --- a/content/app/BUILD.gn +++ b/content/app/BUILD.gn @@ -59,7 +59,6 @@ if (is_ios) { content_app_deps += [ "//mojo/shell/public/interfaces", "//mojo/edk/system", - "//mojo/environment:chromium", ] } diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index 0ab48e1..0c8384f 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn @@ -32,7 +32,6 @@ source_set("child") { "//components/webcrypto", "//content/common:mojo_bindings", "//mojo/common", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/shell/public/interfaces", "//net", diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index 3dbb130..e5e1929 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn @@ -195,7 +195,6 @@ source_set("common") { "//media/midi", "//mojo/common:common_base", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/shell/public/interfaces", "//sandbox", "//storage/common", diff --git a/content/content_app.gypi b/content/content_app.gypi index 7f64025..cca9124 100644 --- a/content/content_app.gypi +++ b/content/content_app.gypi @@ -10,7 +10,6 @@ '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../crypto/crypto.gyp:crypto', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../ui/base/ui_base.gyp:ui_base', '../ui/gfx/gfx.gyp:gfx', diff --git a/content/content_child.gypi b/content/content_child.gypi index 2d296ef..9fb7380 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -10,7 +10,6 @@ '../components/tracing.gyp:tracing', '../components/webcrypto/webcrypto.gyp:webcrypto', '../ipc/ipc.gyp:ipc', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_base.gyp:mojo_common_lib', '../mojo/mojo_public.gyp:mojo_message_pump_lib', '../skia/skia.gyp:skia', diff --git a/content/content_common.gypi b/content/content_common.gypi index 07dcea9..6e93ca9 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -24,7 +24,6 @@ '../media/media.gyp:shared_memory_support', '../media/midi/midi.gyp:midi', '../mojo/mojo_base.gyp:mojo_application_bindings', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../mojo/mojo_shell.gyp:mojo_runner_connection_lib', diff --git a/content/content_common_mojo_bindings.gyp b/content/content_common_mojo_bindings.gyp index a174591..6e5aade 100644 --- a/content/content_common_mojo_bindings.gyp +++ b/content/content_common_mojo_bindings.gyp @@ -37,7 +37,6 @@ 'dependencies': [ '../components/leveldb/leveldb.gyp:leveldb_bindings_mojom', '../mojo/mojo_base.gyp:mojo_application_bindings', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../skia/skia.gyp:skia_mojo', '../ui/mojo/geometry/mojo_bindings.gyp:mojo_geometry_bindings', diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 6a8486f..adf3d1d 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -24,7 +24,6 @@ '../media/blink/media_blink.gyp:media_blink', '../media/media.gyp:media', '../mojo/mojo_base.gyp:mojo_application_bindings', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_base.gyp:mojo_geometry_lib', '../mojo/mojo_base.gyp:mojo_url_type_converters', '../mojo/mojo_edk.gyp:mojo_js_lib', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 4716c1c..fcc0c38 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -842,7 +842,6 @@ 'type': 'static_library', 'dependencies': [ '../mojo/mojo_base.gyp:mojo_application_base', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../net/net.gyp:net_test_support', @@ -934,7 +933,6 @@ '../media/media.gyp:media', '../media/midi/midi.gyp:midi', '../mojo/mojo_base.gyp:mojo_application_base', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_common_test_support', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../ppapi/ppapi_internal.gyp:ppapi_host', @@ -1163,7 +1161,6 @@ '../ipc/ipc.gyp:test_support_ipc', '../media/media.gyp:media_test_support', '../media/media.gyp:shared_memory_support', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_common_test_support', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../net/net.gyp:net_extras', @@ -1508,7 +1505,6 @@ '../media/media.gyp:media_test_support', '../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', '../mojo/mojo_edk.gyp:mojo_common_test_support', '../mojo/mojo_edk.gyp:mojo_system_impl', diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index 3e64933..bd41605 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn @@ -57,7 +57,6 @@ source_set("renderer") { "//mojo/common", "//mojo/converters/geometry", "//mojo/edk/js", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/public/js", "//mojo/shell/public/cpp", diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 55e264e..9058233 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -101,7 +101,6 @@ source_set("test_support") { "//ipc/mojo", "//media", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//mojo/shell/public/cpp:cpp_for_chromium", "//storage/browser", "//storage/common", @@ -436,7 +435,6 @@ test("content_browsertests") { "//media/base:test_support", "//mojo/edk/system", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/public/js", "//mojo/shell/public/cpp:cpp_for_chromium", @@ -610,7 +608,6 @@ test("content_unittests") { "//device/battery:mojo_bindings", "//device/bluetooth", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//net:extras", "//net:test_support", diff --git a/device/BUILD.gn b/device/BUILD.gn index 4b52e52..a65caaf 100644 --- a/device/BUILD.gn +++ b/device/BUILD.gn @@ -58,7 +58,6 @@ test("device_unittests") { "//device/nfc", "//mojo/common", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//net", "//testing/gmock", diff --git a/device/battery/BUILD.gn b/device/battery/BUILD.gn index 5bf49ce..9876bc6 100644 --- a/device/battery/BUILD.gn +++ b/device/battery/BUILD.gn @@ -32,7 +32,6 @@ if (!is_android) { "//base", "//base/third_party/dynamic_annotations", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", ] diff --git a/device/battery/battery.gyp b/device/battery/battery.gyp index 32f7adf..6028f33 100644 --- a/device/battery/battery.gyp +++ b/device/battery/battery.gyp @@ -89,7 +89,6 @@ 'dependencies': [ '../../base/base.gyp:base', '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', 'device_battery_mojo_bindings', diff --git a/device/device_tests.gyp b/device/device_tests.gyp index c4ad2d8..7a22fb3 100644 --- a/device/device_tests.gyp +++ b/device/device_tests.gyp @@ -13,7 +13,6 @@ 'dependencies': [ '../base/base.gyp:test_support_base', '../mojo/mojo_base.gyp:mojo_url_type_converters', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_public.gyp:mojo_cpp_bindings', '../testing/gmock.gyp:gmock', diff --git a/device/serial/data_sink_unittest.cc b/device/serial/data_sink_unittest.cc index a5872f5..54067dc 100644 --- a/device/serial/data_sink_unittest.cc +++ b/device/serial/data_sink_unittest.cc @@ -15,7 +15,6 @@ #include "device/serial/data_sink_receiver.h" #include "device/serial/data_stream.mojom.h" #include "mojo/public/cpp/bindings/interface_ptr.h" -#include "mojo/public/cpp/environment/async_waiter.h" #include "testing/gtest/include/gtest/gtest.h" namespace device { diff --git a/device/serial/data_source_unittest.cc b/device/serial/data_source_unittest.cc index 5f30a6c..7dacbed 100644 --- a/device/serial/data_source_unittest.cc +++ b/device/serial/data_source_unittest.cc @@ -15,7 +15,6 @@ #include "device/serial/data_source_sender.h" #include "device/serial/data_stream.mojom.h" #include "mojo/public/cpp/bindings/interface_ptr.h" -#include "mojo/public/cpp/environment/async_waiter.h" #include "testing/gtest/include/gtest/gtest.h" namespace device { diff --git a/device/vibration/BUILD.gn b/device/vibration/BUILD.gn index d783940..443e2dd 100644 --- a/device/vibration/BUILD.gn +++ b/device/vibration/BUILD.gn @@ -21,7 +21,6 @@ component("vibration") { "//base", "//base/third_party/dynamic_annotations", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", ] diff --git a/device/vibration/vibration.gyp b/device/vibration/vibration.gyp index acef5d5..d31072d 100644 --- a/device/vibration/vibration.gyp +++ b/device/vibration/vibration.gyp @@ -25,7 +25,6 @@ 'dependencies': [ '../../base/base.gyp:base', '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', 'device_vibration_mojo_bindings', diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 5741f96..9e7e2fe 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -184,7 +184,6 @@ test("extensions_unittests") { "//extensions/utility", "//mojo/edk/js", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/shell/public/interfaces", "//testing/gmock", @@ -244,7 +243,6 @@ test("extensions_browsertests") { "//device/usb:mocks", "//mojo/edk/js", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//testing/gmock", "//testing/gtest", diff --git a/extensions/extensions_tests.gyp b/extensions/extensions_tests.gyp index 87ef374..11a27ca 100644 --- a/extensions/extensions_tests.gyp +++ b/extensions/extensions_tests.gyp @@ -27,7 +27,6 @@ '../device/serial/serial.gyp:device_serial', '../device/serial/serial.gyp:device_serial_test_util', '../mojo/mojo_base.gyp:mojo_application_bindings', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_edk.gyp:mojo_js_lib', '../mojo/mojo_edk.gyp:mojo_system_impl', '../mojo/mojo_public.gyp:mojo_cpp_bindings', diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index c2f57e9..fca3ec3 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -55,7 +55,6 @@ source_set("app_shell_lib") { "//extensions/shell/common/api:api_registration", "//extensions/utility", "//mojo/edk/system", - "//mojo/environment:chromium", "//skia", "//third_party/WebKit/public:blink", "//ui/base", diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index 9d085db..fb8f054 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp @@ -46,7 +46,6 @@ '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources', '<(DEPTH)/extensions/shell/browser/api/api_registration.gyp:shell_api_registration', '<(DEPTH)/extensions/shell/common/api/api.gyp:shell_api', - '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_edk.gyp:mojo_system_impl', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', diff --git a/ipc/mojo/BUILD.gn b/ipc/mojo/BUILD.gn index 4966b90..9804845 100644 --- a/ipc/mojo/BUILD.gn +++ b/ipc/mojo/BUILD.gn @@ -37,8 +37,6 @@ component("mojo") { "//base/third_party/dynamic_annotations", "//ipc", "//mojo/edk/system", - "//mojo/environment:chromium", - "//mojo/public/c/environment:environment", "//mojo/public/cpp/bindings", ] } @@ -63,7 +61,6 @@ test("ipc_mojo_unittests") { "//ipc:test_support", "//mojo/edk/system", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//testing/gtest", "//url", ] @@ -86,7 +83,6 @@ test("ipc_mojo_perftests") { "//mojo/edk/system", "//mojo/edk/test:test_support", "//mojo/edk/test:test_support_impl", - "//mojo/environment:chromium", "//url", ] diff --git a/ipc/mojo/ipc_message_pipe_reader.h b/ipc/mojo/ipc_message_pipe_reader.h index 7120fc60..38ca6a8 100644 --- a/ipc/mojo/ipc_message_pipe_reader.h +++ b/ipc/mojo/ipc_message_pipe_reader.h @@ -17,7 +17,6 @@ #include "base/threading/thread_checker.h" #include "ipc/ipc_message.h" #include "ipc/mojo/ipc.mojom.h" -#include "mojo/public/c/environment/async_waiter.h" #include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/system/core.h" diff --git a/ipc/mojo/ipc_mojo.gyp b/ipc/mojo/ipc_mojo.gyp index c471d37..cb22889 100644 --- a/ipc/mojo/ipc_mojo.gyp +++ b/ipc/mojo/ipc_mojo.gyp @@ -22,7 +22,6 @@ '../ipc.gyp:ipc', '../../base/base.gyp:base', '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', ], @@ -60,7 +59,6 @@ '../../base/base.gyp:base', '../../base/base.gyp:base_i18n', '../../base/base.gyp:test_support_base', - '../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../mojo/mojo_edk.gyp:mojo_common_test_support', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', @@ -92,7 +90,6 @@ '../../base/base.gyp:base_i18n', '../../base/base.gyp:test_support_base', '../../base/base.gyp:test_support_perf', - '../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../mojo/mojo_edk.gyp:mojo_common_test_support', '../../mojo/mojo_edk.gyp:mojo_system_impl', '../../mojo/mojo_public.gyp:mojo_cpp_bindings', diff --git a/media/mojo/common/BUILD.gn b/media/mojo/common/BUILD.gn index eed3ae3..1d0fa81 100644 --- a/media/mojo/common/BUILD.gn +++ b/media/mojo/common/BUILD.gn @@ -21,7 +21,6 @@ source_set("common") { "//media/mojo/interfaces", "//mojo/common", "//mojo/converters/geometry", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//ui/gfx/geometry", "//ui/mojo/geometry:interfaces", @@ -43,7 +42,6 @@ test("media_mojo_unittests") { "//media/mojo/interfaces", "//mojo/edk/system", "//mojo/edk/test:run_all_unittests", - "//mojo/environment:chromium", "//testing/gmock", "//testing/gtest", ] diff --git a/media/mojo/interfaces/mojo_bindings.gyp b/media/mojo/interfaces/mojo_bindings.gyp index c4d0679..6a57a53 100644 --- a/media/mojo/interfaces/mojo_bindings.gyp +++ b/media/mojo/interfaces/mojo_bindings.gyp @@ -18,7 +18,6 @@ 'dependencies': [ 'platform_verification_mojo_bindings', '../../../mojo/mojo_base.gyp:mojo_application_bindings', - '../../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../../mojo/mojo_public.gyp:mojo_cpp_bindings', ], 'sources': [ @@ -41,7 +40,6 @@ 'dependencies': [ 'provision_fetcher_mojo_bindings', '../../../mojo/mojo_base.gyp:mojo_application_bindings', - '../../../mojo/mojo_base.gyp:mojo_environment_chromium', '../../../mojo/mojo_public.gyp:mojo_cpp_bindings', ], 'sources': [ diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index a2e6f53..d0e4f9d 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn @@ -75,7 +75,6 @@ source_set("proxy") { "//media/mojo/common", "//media/mojo/interfaces", "//mojo/common", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//mojo/shell/public/interfaces", ] @@ -88,7 +87,6 @@ source_set("cdm_service") { "//media/mojo/common", "//media/mojo/interfaces", "//mojo/common", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//mojo/shell/public/interfaces", ] diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn index 7c2b9d2..779cb89 100644 --- a/mojo/BUILD.gn +++ b/mojo/BUILD.gn @@ -39,7 +39,6 @@ group("tests") { "//mojo/edk/system:mojo_system_unittests", "//mojo/edk/test:mojo_public_bindings_perftests", "//mojo/edk/test:mojo_public_bindings_unittests", - "//mojo/edk/test:mojo_public_environment_unittests", "//mojo/edk/test:mojo_public_system_perftests", "//mojo/edk/test:mojo_public_system_unittests", "//mojo/edk/test:mojo_public_utility_unittests", diff --git a/mojo/android/BUILD.gn b/mojo/android/BUILD.gn index 63a1344..020ef6d 100644 --- a/mojo/android/BUILD.gn +++ b/mojo/android/BUILD.gn @@ -46,7 +46,6 @@ source_set("libsystem_java") { ":system_java_jni_headers", "//base", "//mojo/edk/system", - "//mojo/environment:chromium", "//mojo/message_pump", ] } @@ -125,7 +124,6 @@ shared_library("mojo_java_unittests") { "//mojo/edk/system", "//mojo/message_pump", "//mojo/public/cpp/bindings/tests:mojo_public_bindings_test_utils", - "//mojo/public/cpp/environment", "//mojo/public/cpp/test_support:test_utils", ] defines = [ "UNIT_TEST" ] diff --git a/mojo/android/javatests/mojo_test_case.cc b/mojo/android/javatests/mojo_test_case.cc index 631cf976..176e9bc 100644 --- a/mojo/android/javatests/mojo_test_case.cc +++ b/mojo/android/javatests/mojo_test_case.cc @@ -14,7 +14,6 @@ #include "base/test/test_support_android.h" #include "jni/MojoTestCase_jni.h" #include "mojo/message_pump/message_pump_mojo.h" -#include "mojo/public/cpp/environment/environment.h" namespace { diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn index 6a12118..bffb612 100644 --- a/mojo/common/BUILD.gn +++ b/mojo/common/BUILD.gn @@ -36,11 +36,9 @@ component("common_base") { deps = [ "//base", "//base/third_party/dynamic_annotations", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/public/c/system:for_component", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/environment", ] } @@ -69,7 +67,6 @@ test("mojo_common_unittests") { "//base/test:test_support", "//mojo/edk/test:run_all_unittests", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/public/cpp/bindings", "//mojo/public/cpp/test_support:test_utils", @@ -97,7 +94,6 @@ test("mojo_common_perftests") { ":common", "//base", "//mojo/edk/test:run_all_perftests", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/public/cpp/test_support:test_utils", "//testing/gtest", diff --git a/mojo/converters/blink/BUILD.gn b/mojo/converters/blink/BUILD.gn index f5486f05..7f6b412 100644 --- a/mojo/converters/blink/BUILD.gn +++ b/mojo/converters/blink/BUILD.gn @@ -16,7 +16,6 @@ component("blink") { deps = [ "//base", "//components/mus/public/interfaces", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//third_party/WebKit/public:blink", "//ui/events", diff --git a/mojo/converters/geometry/BUILD.gn b/mojo/converters/geometry/BUILD.gn index efe39c1..ce047c3 100644 --- a/mojo/converters/geometry/BUILD.gn +++ b/mojo/converters/geometry/BUILD.gn @@ -11,7 +11,6 @@ component("geometry") { "//ui/gfx/geometry", ] deps = [ - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//ui/mojo/geometry:interfaces", ] diff --git a/mojo/converters/ime/BUILD.gn b/mojo/converters/ime/BUILD.gn index d3c1d86..3914ee3 100644 --- a/mojo/converters/ime/BUILD.gn +++ b/mojo/converters/ime/BUILD.gn @@ -12,7 +12,6 @@ component("ime") { ] deps = [ "//base", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//ui/mojo/ime:interfaces", "//ui/platform_window", diff --git a/mojo/converters/input_events/BUILD.gn b/mojo/converters/input_events/BUILD.gn index fb59cb7..b724bbe 100644 --- a/mojo/converters/input_events/BUILD.gn +++ b/mojo/converters/input_events/BUILD.gn @@ -17,7 +17,6 @@ component("input_events") { "//base", "//components/mus/public/interfaces", "//mojo/converters/geometry", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//ui/events", "//ui/events:dom_keycode_converter", diff --git a/mojo/converters/surfaces/BUILD.gn b/mojo/converters/surfaces/BUILD.gn index c95fdba..6609e8e 100644 --- a/mojo/converters/surfaces/BUILD.gn +++ b/mojo/converters/surfaces/BUILD.gn @@ -30,7 +30,6 @@ component("surfaces") { "//cc/surfaces:surface_id", "//components/mus/public/interfaces", "//gpu", - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//skia", "//ui/gfx/geometry", diff --git a/mojo/converters/surfaces/tests/BUILD.gn b/mojo/converters/surfaces/tests/BUILD.gn index edfe3ba..4cb915d 100644 --- a/mojo/converters/surfaces/tests/BUILD.gn +++ b/mojo/converters/surfaces/tests/BUILD.gn @@ -17,7 +17,6 @@ test("mojo_surfaces_lib_unittests") { "//mojo/converters/surfaces", "//mojo/converters/transform", "//mojo/edk/test:run_all_unittests", - "//mojo/environment:chromium", "//skia", "//testing/gtest", "//ui/gfx", diff --git a/mojo/converters/transform/BUILD.gn b/mojo/converters/transform/BUILD.gn index d3e29a1..34da111 100644 --- a/mojo/converters/transform/BUILD.gn +++ b/mojo/converters/transform/BUILD.gn @@ -9,7 +9,6 @@ component("transform") { "//ui/gfx", ] deps = [ - "//mojo/environment:chromium", "//mojo/public/c/system:for_component", "//skia", "//ui/mojo/geometry:interfaces", diff --git a/mojo/edk/js/test/BUILD.gn b/mojo/edk/js/test/BUILD.gn index 758edb4..0ac9945 100644 --- a/mojo/edk/js/test/BUILD.gn +++ b/mojo/edk/js/test/BUILD.gn @@ -13,8 +13,6 @@ test("js_unittests") { "//mojo/edk/js", "//mojo/edk/test:run_all_unittests", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", - "//mojo/public/cpp/environment", "//mojo/public/cpp/system", "//mojo/public/cpp/utility", "//mojo/public/interfaces/bindings/tests:test_interfaces", @@ -36,7 +34,6 @@ test("js_integration_tests") { "//mojo/edk/js/tests:js_to_cpp_tests", "//mojo/edk/test:run_all_unittests", "//mojo/edk/test:test_support", - "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/public/interfaces/bindings/tests:test_interfaces", ] diff --git a/mojo/edk/js/tests/BUILD.gn b/mojo/edk/js/tests/BUILD.gn index 4bbd138..5761bcb 100644 --- a/mojo/edk/js/tests/BUILD.gn +++ b/mojo/edk/js/tests/BUILD.gn @@ -30,6 +30,4 @@ mojom("js_to_cpp_bindings") { sources = [ "js_to_cpp.mojom", ] - - with_environment = false } diff --git a/mojo/edk/system/BUILD.gn b/mojo/edk/system/BUILD.gn index b9cac17..1bd597f 100644 --- a/mojo/edk/system/BUILD.gn +++ b/mojo/edk/system/BUILD.gn @@ -168,7 +168,6 @@ test("mojo_system_unittests") { "//mojo/edk/system", "//mojo/edk/test:run_all_unittests", "//mojo/edk/test:test_support", - "//mojo/public/cpp/environment:standalone", "//testing/gtest", ] @@ -187,7 +186,6 @@ test("mojo_message_pipe_perftests") { "//mojo/edk/system", "//mojo/edk/test:run_all_perftests", "//mojo/edk/test:test_support", - "//mojo/public/cpp/environment:standalone", "//testing/gtest", ] } diff --git a/mojo/edk/test/BUILD.gn b/mojo/edk/test/BUILD.gn index d81ff02..171d087 100644 --- a/mojo/edk/test/BUILD.gn +++ b/mojo/edk/test/BUILD.gn @@ -92,7 +92,6 @@ group("public_tests") { testonly = true deps = [ ":mojo_public_bindings_unittests", - ":mojo_public_environment_unittests", ":mojo_public_system_perftests", ":mojo_public_system_unittests", ":mojo_public_utility_unittests", @@ -115,13 +114,6 @@ test("mojo_public_bindings_unittests") { ] } -test("mojo_public_environment_unittests") { - deps = [ - ":run_all_unittests", - "//mojo/public/cpp/environment/tests", - ] -} - test("mojo_public_system_perftests") { deps = [ ":run_all_perftests", diff --git a/mojo/environment/BUILD.gn b/mojo/environment/BUILD.gn deleted file mode 100644 index d794af7..0000000 --- a/mojo/environment/BUILD.gn +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2014 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. - -# GYP version: mojo_base.gyp:mojo_environment_chromium -source_set("chromium") { - output_name = "mojo_environment_chromium" - - sources = [ - "environment.cc", - - # TODO(vtl): This is kind of ugly. (See TODO in logging.h.) - "//mojo/public/cpp/environment/async_waiter.h", - "//mojo/public/cpp/environment/lib/async_waiter.cc", - "//mojo/public/cpp/environment/lib/logging.cc", - "//mojo/public/cpp/environment/lib/scoped_task_tracking.cc", - "//mojo/public/cpp/environment/lib/scoped_task_tracking.h", - "//mojo/public/cpp/environment/logging.h", - "//mojo/public/cpp/environment/task_tracker.h", - ] - - public_deps = [ - ":chromium_impl", - ] - - deps = [ - "//mojo/public/c/environment", - "//mojo/public/cpp/bindings:callback", - "//mojo/public/cpp/environment", - "//mojo/public/cpp/system", - ] -} - -# GYP version: mojo_base.gyp:mojo_environment_chromium_impl -component("chromium_impl") { - output_name = "mojo_environment_impl" - visibility = [ "//mojo/*" ] - - sources = [ - "default_async_waiter_impl.cc", - "default_async_waiter_impl.h", - "default_logger_impl.cc", - "default_logger_impl.h", - "default_run_loop_impl.cc", - "default_run_loop_impl.h", - "default_task_tracker_impl.cc", - "default_task_tracker_impl.h", - ] - - defines = [ "MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION" ] - - deps = [ - "//base", - "//base/third_party/dynamic_annotations", - "//mojo/message_pump", - "//mojo/public/c/system:for_component", - "//mojo/public/cpp/environment:environment", - ] -} diff --git a/mojo/environment/default_async_waiter_impl.cc b/mojo/environment/default_async_waiter_impl.cc deleted file mode 100644 index a27aa93..0000000 --- a/mojo/environment/default_async_waiter_impl.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 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/environment/default_async_waiter_impl.h" - -#include "base/bind.h" -#include "mojo/message_pump/handle_watcher.h" - -namespace mojo { -namespace internal { -namespace { - -void OnHandleReady(common::HandleWatcher* watcher, - MojoAsyncWaitCallback callback, - void* closure, - MojoResult result) { - delete watcher; - callback(closure, result); -} - -MojoAsyncWaitID AsyncWait(MojoHandle handle, - MojoHandleSignals signals, - MojoDeadline deadline, - MojoAsyncWaitCallback callback, - void* closure) { - CHECK(handle != MOJO_HANDLE_INVALID); - // This instance will be deleted when done or cancelled. - common::HandleWatcher* watcher = new common::HandleWatcher(); - watcher->Start(Handle(handle), signals, deadline, - base::Bind(&OnHandleReady, watcher, callback, closure)); - return reinterpret_cast<MojoAsyncWaitID>(watcher); -} - -void CancelWait(MojoAsyncWaitID wait_id) { - delete reinterpret_cast<common::HandleWatcher*>(wait_id); -} - -const MojoAsyncWaiter kDefaultAsyncWaiter = { - AsyncWait, - CancelWait -}; - -} // namespace - -const MojoAsyncWaiter* GetDefaultAsyncWaiterImpl() { - return &kDefaultAsyncWaiter; -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/environment/default_async_waiter_impl.h b/mojo/environment/default_async_waiter_impl.h deleted file mode 100644 index 5140e35..0000000 --- a/mojo/environment/default_async_waiter_impl.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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_ENVIRONMENT_DEFAULT_ASYNC_WAITER_IMPL_H_ -#define MOJO_ENVIRONMENT_DEFAULT_ASYNC_WAITER_IMPL_H_ - -#include "mojo/environment/mojo_environment_impl_export.h" -#include "mojo/public/c/environment/async_waiter.h" - -namespace mojo { -namespace internal { - -MOJO_ENVIRONMENT_IMPL_EXPORT const MojoAsyncWaiter* GetDefaultAsyncWaiterImpl(); - -} // namespace internal -} // namespace mojo - -#endif // MOJO_ENVIRONMENT_DEFAULT_ASYNC_WAITER_IMPL_H_ diff --git a/mojo/environment/default_logger_impl.cc b/mojo/environment/default_logger_impl.cc deleted file mode 100644 index e1fda43..0000000 --- a/mojo/environment/default_logger_impl.cc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 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/environment/default_logger_impl.h" - -#include <stdint.h> - -#include "base/logging.h" -#include "base/macros.h" - -namespace mojo { -namespace internal { -namespace { - -// We rely on log levels being the same numerically: -static_assert(logging::LOG_VERBOSE == MOJO_LOG_LEVEL_VERBOSE, - "verbose log level value mismatch"); -static_assert(logging::LOG_INFO == MOJO_LOG_LEVEL_INFO, - "info log level value mismatch"); -static_assert(logging::LOG_WARNING == MOJO_LOG_LEVEL_WARNING, - "warning log level value mismatch"); -static_assert(logging::LOG_ERROR == MOJO_LOG_LEVEL_ERROR, - "error log level value mismatch"); -static_assert(logging::LOG_FATAL == MOJO_LOG_LEVEL_FATAL, - "fatal log level value mismatch"); - -int MojoToChromiumLogLevel(MojoLogLevel log_level) { - // See the compile asserts above. - return static_cast<int>(log_level); -} - -MojoLogLevel ChromiumToMojoLogLevel(int chromium_log_level) { - // See the compile asserts above. - return static_cast<MojoLogLevel>(chromium_log_level); -} - -void LogMessage(MojoLogLevel log_level, - const char* source_file, - uint32_t source_line, - const char* message) { - int chromium_log_level = MojoToChromiumLogLevel(log_level); - int chromium_min_log_level = logging::GetMinLogLevel(); - // "Fatal" errors aren't suppressable. - DCHECK_LE(chromium_min_log_level, logging::LOG_FATAL); - if (chromium_log_level < chromium_min_log_level) - return; - - // TODO(vtl): Possibly, we should try to pull out the file and line number - // from |message|. - logging::LogMessage(__FILE__, __LINE__, chromium_log_level).stream() - << message; -} - -MojoLogLevel GetMinimumLogLevel() { - return ChromiumToMojoLogLevel(logging::GetMinLogLevel()); -} - -void SetMinimumLogLevel(MojoLogLevel log_level) { - logging::SetMinLogLevel(MojoToChromiumLogLevel(log_level)); -} - -const MojoLogger kDefaultLogger = { - LogMessage, - GetMinimumLogLevel, - SetMinimumLogLevel -}; - -} // namespace - -const MojoLogger* GetDefaultLoggerImpl() { - return &kDefaultLogger; -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/environment/default_logger_impl.h b/mojo/environment/default_logger_impl.h deleted file mode 100644 index c87a727..0000000 --- a/mojo/environment/default_logger_impl.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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_ENVIRONMENT_DEFAULT_LOGGER_IMPL_H_ -#define MOJO_ENVIRONMENT_DEFAULT_LOGGER_IMPL_H_ - -#include "mojo/environment/mojo_environment_impl_export.h" -#include "mojo/public/c/environment/logger.h" - -namespace mojo { -namespace internal { - -MOJO_ENVIRONMENT_IMPL_EXPORT const MojoLogger* GetDefaultLoggerImpl(); - -} // namespace internal -} // namespace mojo - -#endif // MOJO_ENVIRONMENT_DEFAULT_LOGGER_IMPL_H_ diff --git a/mojo/environment/default_run_loop_impl.cc b/mojo/environment/default_run_loop_impl.cc deleted file mode 100644 index 4fa9ffd..0000000 --- a/mojo/environment/default_run_loop_impl.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 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/environment/default_run_loop_impl.h" - -#include "base/logging.h" -#include "base/message_loop/message_loop.h" - -namespace mojo { -namespace internal { - -void InstantiateDefaultRunLoopImpl() { - CHECK(!base::MessageLoop::current()); - // Not leaked: accessible from |base::MessageLoop::current()|. - base::MessageLoop* message_loop = new base::MessageLoop(); - CHECK_EQ(message_loop, base::MessageLoop::current()); -} - -void DestroyDefaultRunLoopImpl() { - CHECK(base::MessageLoop::current()); - delete base::MessageLoop::current(); - CHECK(!base::MessageLoop::current()); -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/environment/default_run_loop_impl.h b/mojo/environment/default_run_loop_impl.h deleted file mode 100644 index ca868bf..0000000 --- a/mojo/environment/default_run_loop_impl.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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_ENVIRONMENT_DEFAULT_RUN_LOOP_IMPL_H_ -#define MOJO_ENVIRONMENT_DEFAULT_RUN_LOOP_IMPL_H_ - -#include "mojo/environment/mojo_environment_impl_export.h" - -namespace mojo { -namespace internal { - -MOJO_ENVIRONMENT_IMPL_EXPORT void InstantiateDefaultRunLoopImpl(); -MOJO_ENVIRONMENT_IMPL_EXPORT void DestroyDefaultRunLoopImpl(); - -} // namespace internal -} // namespace mojo - -#endif // MOJO_ENVIRONMENT_DEFAULT_RUN_LOOP_IMPL_H_ diff --git a/mojo/environment/default_task_tracker_impl.cc b/mojo/environment/default_task_tracker_impl.cc deleted file mode 100644 index a53f1b9..0000000 --- a/mojo/environment/default_task_tracker_impl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 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/environment/default_task_tracker_impl.h" - -namespace mojo { -namespace internal { -namespace { - -TaskTrackingId StartTracking(const char* function_name, - const char* file_name, - int line_number, - const void* program_counter) { - return TaskTrackingId(0); -} - -void EndTracking(const TaskTrackingId id) { -} - -void SetEnabled(bool enabled) { -} - -const TaskTracker kDefaultTaskTracker = {&StartTracking, - &EndTracking, - &SetEnabled}; - -} // namespace - -const TaskTracker* GetDefaultTaskTracker() { - return &kDefaultTaskTracker; -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/environment/default_task_tracker_impl.h b/mojo/environment/default_task_tracker_impl.h deleted file mode 100644 index 34d7f04..0000000 --- a/mojo/environment/default_task_tracker_impl.h +++ /dev/null @@ -1,19 +0,0 @@ -// 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_ENVIRONMENT_DEFAULT_TASK_TRACKER_IMPL_H_ -#define MOJO_ENVIRONMENT_DEFAULT_TASK_TRACKER_IMPL_H_ - -#include "mojo/environment/mojo_environment_impl_export.h" -#include "mojo/public/cpp/environment/task_tracker.h" - -namespace mojo { -namespace internal { - -MOJO_ENVIRONMENT_IMPL_EXPORT const TaskTracker* GetDefaultTaskTracker(); - -} // namespace internal -} // namespace mojo - -#endif // MOJO_ENVIRONMENT_DEFAULT_TASK_TRACKER_IMPL_H_ diff --git a/mojo/environment/environment.cc b/mojo/environment/environment.cc deleted file mode 100644 index 7b342e0..0000000 --- a/mojo/environment/environment.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 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/environment/environment.h" - -#include "mojo/environment/default_async_waiter_impl.h" -#include "mojo/environment/default_logger_impl.h" -#include "mojo/environment/default_run_loop_impl.h" -#include "mojo/environment/default_task_tracker_impl.h" - -namespace mojo { - -// These methods are intentionally not implemented so that there is a link -// error if someone uses them in a Chromium-environment. -#if 0 -Environment::Environment() { -} - -Environment::Environment(const MojoAsyncWaiter* default_async_waiter, - const MojoLogger* default_logger) { -} - -Environment::~Environment() { -} -#endif - -// static -const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() { - return internal::GetDefaultAsyncWaiterImpl(); -} - -// static -const MojoLogger* Environment::GetDefaultLogger() { - return internal::GetDefaultLoggerImpl(); -} - -// static -const TaskTracker* Environment::GetDefaultTaskTracker() { - return internal::GetDefaultTaskTracker(); -} - -// static -void Environment::InstantiateDefaultRunLoop() { - internal::InstantiateDefaultRunLoopImpl(); -} - -// static -void Environment::DestroyDefaultRunLoop() { - internal::DestroyDefaultRunLoopImpl(); -} - - - -} // namespace mojo diff --git a/mojo/environment/mojo_environment_impl_export.h b/mojo/environment/mojo_environment_impl_export.h deleted file mode 100644 index 0255425..0000000 --- a/mojo/environment/mojo_environment_impl_export.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 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_ENVIRONMENT_MOJO_ENVIRONMENT_IMPL_EXPORT_H_ -#define MOJO_ENVIRONMENT_MOJO_ENVIRONMENT_IMPL_EXPORT_H_ - -#if defined(COMPONENT_BUILD) - -#if defined(WIN32) - -#if defined(MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION) -#define MOJO_ENVIRONMENT_IMPL_EXPORT __declspec(dllexport) -#else -#define MOJO_ENVIRONMENT_IMPL_EXPORT __declspec(dllimport) -#endif - -#else // !defined(WIN32) - -#if defined(MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION) -#define MOJO_ENVIRONMENT_IMPL_EXPORT __attribute__((visibility("default"))) -#else -#define MOJO_ENVIRONMENT_IMPL_EXPORT -#endif - -#endif // defined(WIN32) - -#else // !defined(COMPONENT_BUILD) -#define MOJO_ENVIRONMENT_IMPL_EXPORT -#endif - -#endif // MOJO_ENVIRONMENT_MOJO_ENVIRONMENT_IMPL_EXPORT_H_ diff --git a/mojo/gles2/BUILD.gn b/mojo/gles2/BUILD.gn index 0bfbfec..0fb54c1 100644 --- a/mojo/gles2/BUILD.gn +++ b/mojo/gles2/BUILD.gn @@ -49,7 +49,6 @@ component("gles2") { "//gpu/command_buffer/client:gles2_implementation", "//gpu/command_buffer/client:gles2_interface", "//gpu/command_buffer/common", - "//mojo/environment:chromium", "//mojo/platform_handle:for_component", "//mojo/public/c/system:for_component", "//mojo/public/cpp/bindings", diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp index 36c38cc..be20479 100644 --- a/mojo/mojo_base.gyp +++ b/mojo/mojo_base.gyp @@ -86,7 +86,6 @@ 'dependencies': [ '../ui/mojo/geometry/mojo_bindings.gyp:mojo_geometry_bindings', '../ui/gfx/gfx.gyp:gfx_geometry', - 'mojo_environment_chromium', '<(mojo_system_for_component)', ], 'sources': [ @@ -109,7 +108,6 @@ 'mojo_edk.gyp:mojo_system_impl', 'mojo_edk.gyp:mojo_common_test_support', 'mojo_edk.gyp:mojo_run_all_unittests', - 'mojo_environment_chromium', 'mojo_public.gyp:mojo_cpp_bindings', 'mojo_public.gyp:mojo_message_pump_lib', 'mojo_public.gyp:mojo_public_test_utils', @@ -122,59 +120,6 @@ ], }, { - # GN version: //mojo/environment:chromium - 'target_name': 'mojo_environment_chromium', - 'type': 'static_library', - 'dependencies': [ - 'mojo_environment_chromium_impl', - 'mojo_public.gyp:mojo_cpp_bindings', - ], - 'sources': [ - # TODO(vtl): This is kind of ugly. (See TODO in logging.h.) - "../mojo/public/cpp/environment/async_waiter.h", - "../mojo/public/cpp/environment/lib/async_waiter.cc", - "../mojo/public/cpp/environment/lib/logging.cc", - "../mojo/public/cpp/environment/lib/scoped_task_tracking.cc", - "../mojo/public/cpp/environment/lib/scoped_task_tracking.cc", - "../mojo/public/cpp/environment/logging.h", - "../mojo/public/cpp/environment/task_tracker.h", - 'environment/environment.cc', - ], - 'include_dirs': [ - '..', - ], - 'export_dependent_settings': [ - 'mojo_environment_chromium_impl', - ], - }, - { - # GN version: //mojo/environment:chromium_impl - 'target_name': 'mojo_environment_chromium_impl', - 'type': '<(component)', - 'defines': [ - 'MOJO_ENVIRONMENT_IMPL_IMPLEMENTATION', - ], - 'dependencies': [ - '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - 'mojo_public.gyp:mojo_message_pump_lib', - '<(mojo_system_for_component)', - ], - 'sources': [ - 'environment/default_async_waiter_impl.cc', - 'environment/default_async_waiter_impl.h', - 'environment/default_logger_impl.cc', - 'environment/default_logger_impl.h', - 'environment/default_run_loop_impl.cc', - 'environment/default_run_loop_impl.h', - 'environment/default_task_tracker_impl.cc', - 'environment/default_task_tracker_impl.h', - ], - 'include_dirs': [ - '..', - ], - }, - { 'target_name': 'mojo_application_bindings_mojom', 'type': 'none', 'variables': { @@ -268,7 +213,6 @@ 'mojo_application_base', 'mojo_edk.gyp:mojo_run_all_unittests', 'mojo_public.gyp:mojo_utility', - 'mojo_public.gyp:mojo_environment_standalone', ], 'sources': [ 'shell/public/cpp/tests/interface_registry_unittest.cc', @@ -342,7 +286,6 @@ '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'mojo_common_lib', 'mojo_edk.gyp:mojo_system_impl', - 'mojo_environment_chromium', 'mojo_jni_headers', 'mojo_public.gyp:mojo_message_pump_lib', ], diff --git a/mojo/mojo_edk_tests.gyp b/mojo/mojo_edk_tests.gyp index e2f92129..82c1d04 100644 --- a/mojo/mojo_edk_tests.gyp +++ b/mojo/mojo_edk_tests.gyp @@ -19,7 +19,6 @@ 'mojo_message_pipe_perftests', 'mojo_public_bindings_perftests', 'mojo_public_bindings_unittests', - 'mojo_public_environment_unittests', 'mojo_public_system_perftests', 'mojo_public_system_unittests', 'mojo_public_utility_unittests', @@ -47,7 +46,6 @@ 'type': 'executable', 'dependencies': [ '../testing/gtest.gyp:gtest', - 'mojo_base.gyp:mojo_environment_chromium', 'mojo_edk.gyp:mojo_run_all_unittests', 'mojo_public.gyp:mojo_cpp_bindings', 'mojo_public.gyp:mojo_message_pump_lib', @@ -113,7 +111,6 @@ 'mojo_base.gyp:mojo_common_lib', 'mojo_edk.gyp:mojo_run_all_perftests', 'mojo_public.gyp:mojo_cpp_bindings', - 'mojo_public.gyp:mojo_environment_standalone', 'mojo_public.gyp:mojo_message_pump_lib', 'mojo_public.gyp:mojo_public_bindings_test_utils', 'mojo_public.gyp:mojo_public_test_interfaces', @@ -126,25 +123,6 @@ ], }, { - # GN version: //mojo/edk/test:mojo_public_environment_unittests - 'target_name': 'mojo_public_environment_unittests', - 'type': 'executable', - 'dependencies': [ - '../testing/gtest.gyp:gtest', - 'mojo_edk.gyp:mojo_run_all_unittests', - 'mojo_public.gyp:mojo_cpp_bindings', - 'mojo_public.gyp:mojo_environment_standalone', - 'mojo_public.gyp:mojo_public_test_utils', - 'mojo_public.gyp:mojo_utility', - ], - 'sources': [ - 'public/cpp/environment/tests/async_wait_unittest.cc', - 'public/cpp/environment/tests/async_waiter_unittest.cc', - 'public/cpp/environment/tests/logger_unittest.cc', - 'public/cpp/environment/tests/logging_unittest.cc', - ], - }, - { # GN version: //mojo/public/cpp/system/tests:mojo_public_system_unittests # and //mojo/public/c/system/tests 'target_name': 'mojo_public_system_unittests', @@ -269,7 +247,6 @@ 'mojo_edk.gyp:mojo_common_test_support', 'mojo_edk.gyp:mojo_run_all_unittests', 'mojo_edk.gyp:mojo_js_lib', - 'mojo_public.gyp:mojo_environment_standalone', 'mojo_public.gyp:mojo_public_test_interfaces', 'mojo_public.gyp:mojo_utility', ], @@ -289,7 +266,6 @@ 'mojo_edk.gyp:mojo_js_lib', 'mojo_edk.gyp:mojo_run_all_unittests', 'mojo_js_to_cpp_bindings', - 'mojo_public.gyp:mojo_environment_standalone', 'mojo_public.gyp:mojo_public_test_interfaces', 'mojo_public.gyp:mojo_utility', ], @@ -326,19 +302,6 @@ ], }, { - 'target_name': 'mojo_public_environment_unittests_run', - 'type': 'none', - 'dependencies': [ - 'mojo_public_environment_unittests', - ], - 'includes': [ - '../build/isolate.gypi', - ], - 'sources': [ - 'mojo_public_environment_unittests.isolate', - ], - }, - { 'target_name': 'mojo_public_system_unittests_run', 'type': 'none', 'dependencies': [ diff --git a/mojo/mojo_public.gyp b/mojo/mojo_public.gyp index b9c5b8b..e72ce0b 100644 --- a/mojo/mojo_public.gyp +++ b/mojo/mojo_public.gyp @@ -232,33 +232,6 @@ ], }, { - # GN version: //mojo/public/cpp/environment:standalone - 'target_name': 'mojo_environment_standalone', - 'type': 'static_library', - 'sources': [ - 'public/c/environment/async_waiter.h', - 'public/c/environment/logger.h', - 'public/cpp/environment/async_waiter.h', - 'public/cpp/environment/environment.h', - 'public/cpp/environment/lib/async_waiter.cc', - 'public/cpp/environment/lib/default_async_waiter.cc', - 'public/cpp/environment/lib/default_async_waiter.h', - 'public/cpp/environment/lib/default_logger.cc', - 'public/cpp/environment/lib/default_logger.h', - 'public/cpp/environment/lib/default_task_tracker.cc', - 'public/cpp/environment/lib/default_task_tracker.h', - 'public/cpp/environment/lib/environment.cc', - 'public/cpp/environment/lib/logging.cc', - 'public/cpp/environment/lib/scoped_task_tracking.cc', - 'public/cpp/environment/lib/scoped_task_tracking.h', - 'public/cpp/environment/logging.h', - 'public/cpp/environment/task_tracker.h', - ], - 'include_dirs': [ - '..', - ], - }, - { # GN version: //mojo/public/cpp/utility 'target_name': 'mojo_utility', 'type': 'static_library', diff --git a/mojo/mojo_public_environment_unittests.isolate b/mojo/mojo_public_environment_unittests.isolate deleted file mode 100644 index d492271..0000000 --- a/mojo/mojo_public_environment_unittests.isolate +++ /dev/null @@ -1,44 +0,0 @@ -# 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. -{ - 'includes': [ - '../base/base.isolate', - ], - 'conditions': [ - ['OS=="win" or OS=="mac" or OS=="linux"', { - 'variables': { - 'command': [ - '../testing/test_env.py', - '<(PRODUCT_DIR)/mojo_public_environment_unittests<(EXECUTABLE_SUFFIX)', - '--brave-new-test-launcher', - '--test-launcher-bot-mode', - ], - 'files': [ - '../testing/test_env.py', - ], - }, - }], - ['OS=="win"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/mojo_public_test_support.dll', - ], - }, - }], - ['OS=="linux"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/lib/libmojo_public_test_support.so', - ], - }, - }], - ['OS=="mac"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/libmojo_public_test_support.dylib', - ], - }, - }], - ], -} diff --git a/mojo/mojo_shell.gyp b/mojo/mojo_shell.gyp index 192c8ac..7ed1d6e 100644 --- a/mojo/mojo_shell.gyp +++ b/mojo/mojo_shell.gyp @@ -31,7 +31,6 @@ '<(DEPTH)/mojo/mojo_base.gyp:mojo_application_base', '<(DEPTH)/mojo/mojo_base.gyp:mojo_application_bindings', '<(DEPTH)/mojo/mojo_base.gyp:mojo_common_lib', - '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_base.gyp:mojo_url_type_converters', '<(DEPTH)/net/net.gyp:net', '<(DEPTH)/url/url.gyp:url_lib', @@ -48,7 +47,6 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/mojo/mojo_base.gyp:mojo_application_base', '<(DEPTH)/mojo/mojo_base.gyp:mojo_common_lib', - '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_base.gyp:mojo_url_type_converters', '<(DEPTH)/mojo/mojo_edk.gyp:mojo_run_all_unittests', '<(DEPTH)/mojo/mojo_public.gyp:mojo_cpp_bindings', diff --git a/mojo/public/BUILD.gn b/mojo/public/BUILD.gn index f87fb94..cbe8c7e 100644 --- a/mojo/public/BUILD.gn +++ b/mojo/public/BUILD.gn @@ -8,7 +8,6 @@ group("public") { deps = [ ":sdk", "cpp/bindings", - "cpp/environment:standalone", "cpp/utility", "interfaces/bindings/tests:test_interfaces", ] @@ -25,7 +24,6 @@ group("sdk") { deps = [ "c/system", "cpp/bindings", - "cpp/environment:standalone", "cpp/utility", "interfaces/bindings", "js", diff --git a/mojo/public/c/README.md b/mojo/public/c/README.md index 8e11545..c02dac6 100644 --- a/mojo/public/c/README.md +++ b/mojo/public/c/README.md @@ -3,18 +3,11 @@ Mojo Public C API This directory contains C language bindings for the Mojo Public API. -Environment ------------ - -The environment/ subdirectory defines some common things that, while not part of -the system API, may be required for GLES2 (for example). These are things that a -Mojo application may be required to provide to the GLES2 (for example) library -in order to use it. (However, the Mojo application may implement these things as -it sees fit.) - GLES2 ----- +TODO(yzshen): move GLES2 to where it belongs (likely components/mus). + The gles2/ subdirectory defines the GLES2 C API that's available to Mojo applications. To use GLES2, Mojo applications must link against a dynamic library (the exact mechanism being platform-dependent) and use the header files diff --git a/mojo/public/c/environment/BUILD.gn b/mojo/public/c/environment/BUILD.gn deleted file mode 100644 index 26e8256..0000000 --- a/mojo/public/c/environment/BUILD.gn +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2014 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("environment") { - sources = [ - "async_waiter.h", - "logger.h", - ] - - deps = [ - "//mojo/public/c/system", - ] -} diff --git a/mojo/public/c/environment/async_waiter.h b/mojo/public/c/environment/async_waiter.h deleted file mode 100644 index 1eb0631..0000000 --- a/mojo/public/c/environment/async_waiter.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 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_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ -#define MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ - -#include "mojo/public/c/system/types.h" - -typedef uintptr_t MojoAsyncWaitID; - -typedef void (*MojoAsyncWaitCallback)(void* closure, MojoResult result); - -struct MojoAsyncWaiter { - // Asynchronously call MojoWait on a background thread, and pass the result - // of MojoWait to the given MojoAsyncWaitCallback on the current thread. - // Returns a non-zero MojoAsyncWaitID that can be used with CancelWait to - // stop waiting. This identifier becomes invalid once the callback runs. - MojoAsyncWaitID (*AsyncWait)(MojoHandle handle, - MojoHandleSignals signals, - MojoDeadline deadline, - MojoAsyncWaitCallback callback, - void* closure); - - // Cancel an existing call to AsyncWait with the given MojoAsyncWaitID. The - // corresponding MojoAsyncWaitCallback will not be called in this case. - void (*CancelWait)(MojoAsyncWaitID wait_id); -}; - -#endif // MOJO_PUBLIC_C_ENVIRONMENT_ASYNC_WAITER_H_ diff --git a/mojo/public/c/environment/logger.h b/mojo/public/c/environment/logger.h deleted file mode 100644 index 2a9b617..0000000 --- a/mojo/public/c/environment/logger.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 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_PUBLIC_C_ENVIRONMENT_LOGGER_H_ -#define MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_ - -#include <stdint.h> - -// |MojoLogLevel|: Used to specify the type of log message. Values are ordered -// by severity (i.e., higher numerical values are more severe). - -typedef int32_t MojoLogLevel; - -#ifdef __cplusplus -const MojoLogLevel MOJO_LOG_LEVEL_VERBOSE = -1; -const MojoLogLevel MOJO_LOG_LEVEL_INFO = 0; -const MojoLogLevel MOJO_LOG_LEVEL_WARNING = 1; -const MojoLogLevel MOJO_LOG_LEVEL_ERROR = 2; -const MojoLogLevel MOJO_LOG_LEVEL_FATAL = 3; -#else -#define MOJO_LOG_LEVEL_VERBOSE ((MojoLogLevel) - 1) -#define MOJO_LOG_LEVEL_INFO ((MojoLogLevel)0) -#define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel)1) -#define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel)2) -#define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel)3) -#endif - -// Structure with basic logging functions (on top of which more friendly logging -// macros may be built). The functions are thread-safe, except for -// |SetMinimumLogLevel()| (see below). -struct MojoLogger { - // Logs |message| (which must not be null) at level |log_level| if |log_level| - // is at least the current minimum log level. If |log_level| is - // |MOJO_LOG_LEVEL_FATAL| (or greater), aborts the application/process. - // |source_file| and |source_line| indicate the source file and (1-based) line - // number, respectively; they are optional: |source_file| may be null and - // |source_line| may be zero (if |source_file| is null, then |source_line| may - // be ignored). - void (*LogMessage)(MojoLogLevel log_level, - const char* source_file, - uint32_t source_line, - const char* message); - - // Gets the minimum log level (see above), which will always be at most - // |MOJO_LOG_LEVEL_FATAL|. (Though |LogMessage()| will automatically avoid - // logging messages below the minimum log level, this may be used to avoid - // extra work.) - MojoLogLevel (*GetMinimumLogLevel)(void); - - // Sets the minimum log level (see above) to the lesser of |minimum_log_level| - // and |MOJO_LOG_LEVEL_FATAL|. - // - // Warning: This function may not be thread-safe, and should not be called - // concurrently with other |MojoLogger| functions. (In some environments -- - // such as Chromium -- that share a logger across applications, this may mean - // that it is almost never safe to call this.) - void (*SetMinimumLogLevel)(MojoLogLevel minimum_log_level); -}; - -#endif // MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_ diff --git a/mojo/public/c/gles2/BUILD.gn b/mojo/public/c/gles2/BUILD.gn index a009d00..538b305 100644 --- a/mojo/public/c/gles2/BUILD.gn +++ b/mojo/public/c/gles2/BUILD.gn @@ -19,7 +19,6 @@ source_set("gles2") { public_configs = [ ":gles2_config" ] public_deps = [ - "//mojo/public/c/environment", "//mojo/public/c/system", ] } diff --git a/mojo/public/c/system/tests/BUILD.gn b/mojo/public/c/system/tests/BUILD.gn index 9f55259..5d852ad 100644 --- a/mojo/public/c/system/tests/BUILD.gn +++ b/mojo/public/c/system/tests/BUILD.gn @@ -17,7 +17,6 @@ source_set("tests") { ] deps = [ - "//mojo/public/c/environment", "//mojo/public/c/system", "//testing/gtest", ] @@ -31,8 +30,6 @@ source_set("perftests") { ] deps = [ - "//mojo/public/c/environment", - "//mojo/public/cpp/environment:standalone", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//mojo/public/cpp/utility", diff --git a/mojo/public/c/system/tests/core_unittest_pure_c.c b/mojo/public/c/system/tests/core_unittest_pure_c.c index 3c0d98e..a01e14b 100644 --- a/mojo/public/c/system/tests/core_unittest_pure_c.c +++ b/mojo/public/c/system/tests/core_unittest_pure_c.c @@ -12,7 +12,6 @@ // Include all the header files that are meant to be compilable as C. Start with // core.h, since it's the most important one. -#include "mojo/public/c/environment/async_waiter.h" #include "mojo/public/c/system/core.h" #include "mojo/public/c/system/macros.h" diff --git a/mojo/public/cpp/README.md b/mojo/public/cpp/README.md index 4404c24..fbbf86c 100644 --- a/mojo/public/cpp/README.md +++ b/mojo/public/cpp/README.md @@ -23,31 +23,6 @@ code generated by the bindings generator tool (in mojo/public/tools/bindings/), which translates Mojo IDL (.mojom) files into idiomatic C++ (among other languages). -This library depends on the Environment library. - -Environment ------------ - -The environment/ subdirectory contains a support (static) library that -represents shared state needed to support the Bindings and GLES2 libraries. - -This library depends on the Utility library. - - -GLES2 ------ - -The gles2/ subdirectory contains C++ wrappers (and some additional helpers) of -the API defined in mojo/public/c/gles2/ (which provides access to GLES2). - -These wrappers depend on the Environment library. - -Shell ------ - -The shell/ subdirectory contains a support (static) library that aids in writing -Mojo applications and interacting with the Shell service. - System ------ @@ -65,6 +40,8 @@ applications. Utility ------- +TODO(yzshen): remove. + The utility/ subdirectory contains a support (static) library that provides various basic functionality. Most notably, it provides an implementation of a RunLoop based on MojoWaitMany() that applications may use as the basis for diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn index 5c661b4..fb058ce 100644 --- a/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/mojo/public/cpp/bindings/tests/BUILD.gn @@ -52,7 +52,6 @@ source_set("tests") { deps = [ ":mojo_public_bindings_test_utils", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings:callback", @@ -83,7 +82,6 @@ source_set("perftests") { "//mojo/message_pump", "//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings:callback", - "//mojo/public/cpp/environment:standalone", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//mojo/public/cpp/utility", diff --git a/mojo/public/cpp/environment/BUILD.gn b/mojo/public/cpp/environment/BUILD.gn deleted file mode 100644 index e2dfc91..0000000 --- a/mojo/public/cpp/environment/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2014 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("environment") { - sources = [ - "async_waiter.h", - "environment.h", - "logging.h", - "task_tracker.h", - ] - - public_deps = [ - "//mojo/public/c/environment", - ] - - deps = [ - "//mojo/public/cpp/bindings:callback", - "//mojo/public/cpp/system", - ] -} - -source_set("standalone") { - sources = [ - "lib/async_waiter.cc", - "lib/default_async_waiter.cc", - "lib/default_async_waiter.h", - "lib/default_logger.cc", - "lib/default_logger.h", - "lib/default_task_tracker.cc", - "lib/default_task_tracker.h", - "lib/environment.cc", - "lib/logging.cc", - "lib/scoped_task_tracking.cc", - "lib/scoped_task_tracking.h", - ] - - public_deps = [ - ":environment", - ] - - deps = [ - "//mojo/public/c/environment", - "//mojo/public/cpp/system", - "//mojo/public/cpp/utility", - ] -} diff --git a/mojo/public/cpp/environment/async_waiter.h b/mojo/public/cpp/environment/async_waiter.h deleted file mode 100644 index afb4ad1..0000000 --- a/mojo/public/cpp/environment/async_waiter.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 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_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_ - -#include "mojo/public/c/environment/async_waiter.h" -#include "mojo/public/cpp/bindings/callback.h" -#include "mojo/public/cpp/environment/environment.h" -#include "mojo/public/cpp/system/handle.h" - -namespace mojo { - -// A class that waits until a handle is ready and calls |callback| with the -// result. If the AsyncWaiter is deleted before the handle is ready, the wait is -// cancelled and the callback will not be called. -class AsyncWaiter { - public: - typedef mojo::Callback<void(MojoResult)> Callback; - - AsyncWaiter(Handle handle, - MojoHandleSignals signals, - const Callback& callback); - ~AsyncWaiter(); - - private: - static void WaitComplete(void* waiter, MojoResult result); - void WaitCompleteInternal(MojoResult result); - - const MojoAsyncWaiter* waiter_; - MojoAsyncWaitID id_; - const Callback callback_; - - DISALLOW_COPY_AND_ASSIGN(AsyncWaiter); -}; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_ASYNC_WAITER_H_ diff --git a/mojo/public/cpp/environment/environment.h b/mojo/public/cpp/environment/environment.h deleted file mode 100644 index 4cfb963..0000000 --- a/mojo/public/cpp/environment/environment.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 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_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ - -#include "base/macros.h" - -struct MojoAsyncWaiter; -struct MojoLogger; - -namespace mojo { - -struct TaskTracker; - -// Other parts of the Mojo C++ APIs use the *static* methods of this class. -// -// The "standalone" implementation of this class requires that this class (in -// the lib/ subdirectory) be instantiated (and remain so) while using the Mojo -// C++ APIs. I.e., the static methods depend on things set up by the constructor -// and torn down by the destructor. -// -// Other implementations may not have this requirement. -class Environment { - public: - Environment(); - // This constructor allows the standard implementations to be overridden (set - // a parameter to null to get the standard implementation). - Environment(const MojoAsyncWaiter* default_async_waiter, - const MojoLogger* default_logger, - const TaskTracker* default_task_tracker); - ~Environment(); - - static const MojoAsyncWaiter* GetDefaultAsyncWaiter(); - static const MojoLogger* GetDefaultLogger(); - static const TaskTracker* GetDefaultTaskTracker(); - - // These instantiate and destroy an environment-specific run loop for the - // current thread, allowing |GetDefaultAsyncWaiter()| to be used. (The run - // loop itself should be accessible via thread-local storage, using methods - // specific to the run loop implementation.) Creating and destroying nested - // run loops is not supported. - static void InstantiateDefaultRunLoop(); - static void DestroyDefaultRunLoop(); - - private: - DISALLOW_COPY_AND_ASSIGN(Environment); -}; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ diff --git a/mojo/public/cpp/environment/lib/async_waiter.cc b/mojo/public/cpp/environment/lib/async_waiter.cc deleted file mode 100644 index 599a649..0000000 --- a/mojo/public/cpp/environment/lib/async_waiter.cc +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 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/environment/async_waiter.h" - -namespace mojo { - -AsyncWaiter::AsyncWaiter(Handle handle, - MojoHandleSignals signals, - const Callback& callback) - : waiter_(Environment::GetDefaultAsyncWaiter()), - id_(0), - callback_(callback) { - id_ = waiter_->AsyncWait(handle.value(), signals, MOJO_DEADLINE_INDEFINITE, - &AsyncWaiter::WaitComplete, this); -} - -AsyncWaiter::~AsyncWaiter() { - if (id_) - waiter_->CancelWait(id_); -} - -// static -void AsyncWaiter::WaitComplete(void* waiter, MojoResult result) { - static_cast<AsyncWaiter*>(waiter)->WaitCompleteInternal(result); -} - -void AsyncWaiter::WaitCompleteInternal(MojoResult result) { - id_ = 0; - callback_.Run(result); -} - -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/default_async_waiter.cc b/mojo/public/cpp/environment/lib/default_async_waiter.cc deleted file mode 100644 index 9d9b07e..0000000 --- a/mojo/public/cpp/environment/lib/default_async_waiter.cc +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2014 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/environment/lib/default_async_waiter.h" - -#include <assert.h> - -#include "mojo/public/c/environment/async_waiter.h" -#include "mojo/public/cpp/utility/run_loop.h" -#include "mojo/public/cpp/utility/run_loop_handler.h" - -namespace mojo { - -namespace { - -// RunLoopHandler implementation used for a request to AsyncWait(). There are -// two ways RunLoopHandlerImpl is deleted: -// . when the handle is ready (or errored). -// . when CancelWait() is invoked. -class RunLoopHandlerImpl : public RunLoopHandler { - public: - RunLoopHandlerImpl(const Handle& handle, - MojoAsyncWaitCallback callback, - void* closure) - : handle_(handle), callback_(callback), closure_(closure) {} - - ~RunLoopHandlerImpl() override { RunLoop::current()->RemoveHandler(handle_); } - - // RunLoopHandler: - void OnHandleReady(const Handle& handle) override { - NotifyCallback(MOJO_RESULT_OK); - } - - void OnHandleError(const Handle& handle, MojoResult result) override { - NotifyCallback(result); - } - - private: - void NotifyCallback(MojoResult result) { - // Delete this to unregister the handle. That way if the callback - // reregisters everything is ok. - MojoAsyncWaitCallback callback = callback_; - void* closure = closure_; - delete this; - - callback(closure, result); - } - - const Handle handle_; - MojoAsyncWaitCallback callback_; - void* closure_; - - DISALLOW_COPY_AND_ASSIGN(RunLoopHandlerImpl); -}; - -MojoAsyncWaitID AsyncWait(MojoHandle handle, - MojoHandleSignals signals, - MojoDeadline deadline, - MojoAsyncWaitCallback callback, - void* closure) { - RunLoop* run_loop = RunLoop::current(); - assert(run_loop); - - // |run_loop_handler| is destroyed either when the handle is ready or if - // CancelWait is invoked. - RunLoopHandlerImpl* run_loop_handler = - new RunLoopHandlerImpl(Handle(handle), callback, closure); - run_loop->AddHandler(run_loop_handler, Handle(handle), signals, deadline); - return reinterpret_cast<MojoAsyncWaitID>(run_loop_handler); -} - -void CancelWait(MojoAsyncWaitID wait_id) { - delete reinterpret_cast<RunLoopHandlerImpl*>(wait_id); -} - -} // namespace - -namespace internal { - -const MojoAsyncWaiter kDefaultAsyncWaiter = {AsyncWait, CancelWait}; - -} // namespace internal - -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/default_async_waiter.h b/mojo/public/cpp/environment/lib/default_async_waiter.h deleted file mode 100644 index 49ce233..0000000 --- a/mojo/public/cpp/environment/lib/default_async_waiter.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 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_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_ - -struct MojoAsyncWaiter; - -namespace mojo { -namespace internal { - -extern const MojoAsyncWaiter kDefaultAsyncWaiter; - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_ASYNC_WAITER_H_ diff --git a/mojo/public/cpp/environment/lib/default_logger.cc b/mojo/public/cpp/environment/lib/default_logger.cc deleted file mode 100644 index 62a7318..0000000 --- a/mojo/public/cpp/environment/lib/default_logger.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2014 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/environment/lib/default_logger.h" - -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> // For |abort()|. - -#include <algorithm> - -#include "mojo/public/c/environment/logger.h" - -namespace mojo { - -namespace { - -MojoLogLevel g_minimum_log_level = MOJO_LOG_LEVEL_INFO; - -const char* GetLogLevelString(MojoLogLevel log_level) { - if (log_level <= MOJO_LOG_LEVEL_VERBOSE - 3) - return "VERBOSE4+"; - switch (log_level) { - case MOJO_LOG_LEVEL_VERBOSE - 2: - return "VERBOSE3"; - case MOJO_LOG_LEVEL_VERBOSE - 1: - return "VERBOSE2"; - case MOJO_LOG_LEVEL_VERBOSE: - return "VERBOSE1"; - case MOJO_LOG_LEVEL_INFO: - return "INFO"; - case MOJO_LOG_LEVEL_WARNING: - return "WARNING"; - case MOJO_LOG_LEVEL_ERROR: - return "ERROR"; - } - // Consider everything higher to be fatal. - return "FATAL"; -} - -void LogMessage(MojoLogLevel log_level, - const char* source_file, - uint32_t source_line, - const char* message) { - if (log_level < g_minimum_log_level) - return; - - // TODO(vtl): Add timestamp also? - if (source_file) { - fprintf(stderr, "%s: %s(%u): %s\n", GetLogLevelString(log_level), - source_file, static_cast<unsigned>(source_line), message); - } else { - fprintf(stderr, "%s: %s\n", GetLogLevelString(log_level), message); - } - if (log_level >= MOJO_LOG_LEVEL_FATAL) - abort(); -} - -MojoLogLevel GetMinimumLogLevel() { - return g_minimum_log_level; -} - -void SetMinimumLogLevel(MojoLogLevel minimum_log_level) { - g_minimum_log_level = std::min(minimum_log_level, MOJO_LOG_LEVEL_FATAL); -} - -} // namespace - -namespace internal { - -const MojoLogger kDefaultLogger = {LogMessage, - GetMinimumLogLevel, - SetMinimumLogLevel}; - -} // namespace internal - -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/default_logger.h b/mojo/public/cpp/environment/lib/default_logger.h deleted file mode 100644 index 4db3233..0000000 --- a/mojo/public/cpp/environment/lib/default_logger.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 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_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_ - -struct MojoLogger; - -namespace mojo { -namespace internal { - -extern const MojoLogger kDefaultLogger; - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_LOGGER_H_ diff --git a/mojo/public/cpp/environment/lib/default_task_tracker.cc b/mojo/public/cpp/environment/lib/default_task_tracker.cc deleted file mode 100644 index a99f1c7..0000000 --- a/mojo/public/cpp/environment/lib/default_task_tracker.cc +++ /dev/null @@ -1,40 +0,0 @@ -// 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/public/cpp/environment/lib/default_task_tracker.h" - -#include "mojo/public/cpp/environment/task_tracker.h" - -namespace mojo { - -namespace { - -// -// The standalone task tracker does nothing. -// - -TaskTrackingId StartTracking(const char* function_name, - const char* file_name, - int line_number, - const void* program_counter) { - return TaskTrackingId(0); -} - -void EndTracking(const TaskTrackingId id) { -} - -void SetEnabled(bool enabled) { -} - -} // namespace - -namespace internal { - -const TaskTracker kDefaultTaskTracker = {&StartTracking, - &EndTracking, - &SetEnabled}; - -} // namespace internal - -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/default_task_tracker.h b/mojo/public/cpp/environment/lib/default_task_tracker.h deleted file mode 100644 index 7a0c064..0000000 --- a/mojo/public/cpp/environment/lib/default_task_tracker.h +++ /dev/null @@ -1,19 +0,0 @@ -// 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_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_ - -namespace mojo { - -struct TaskTracker; - -namespace internal { - -extern const TaskTracker kDefaultTaskTracker; - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_ diff --git a/mojo/public/cpp/environment/lib/environment.cc b/mojo/public/cpp/environment/lib/environment.cc deleted file mode 100644 index 0b0addd..0000000 --- a/mojo/public/cpp/environment/lib/environment.cc +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2014 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/environment/environment.h" - -#include <assert.h> - -#include "mojo/public/c/environment/logger.h" -#include "mojo/public/cpp/environment/lib/default_async_waiter.h" -#include "mojo/public/cpp/environment/lib/default_logger.h" -#include "mojo/public/cpp/environment/lib/default_task_tracker.h" -#include "mojo/public/cpp/utility/run_loop.h" - -namespace mojo { - -namespace { - -const MojoAsyncWaiter* g_default_async_waiter = nullptr; -const MojoLogger* g_default_logger = nullptr; -const TaskTracker* g_default_task_tracker = nullptr; - -void Init(const MojoAsyncWaiter* default_async_waiter, - const MojoLogger* default_logger, - const TaskTracker* default_task_tracker) { - g_default_async_waiter = default_async_waiter - ? default_async_waiter - : &internal::kDefaultAsyncWaiter; - g_default_logger = - default_logger ? default_logger : &internal::kDefaultLogger; - - g_default_task_tracker = default_task_tracker - ? default_task_tracker - : &internal::kDefaultTaskTracker; - - RunLoop::SetUp(); -} - -} // namespace - -Environment::Environment() { - Init(nullptr, nullptr, nullptr); -} - -Environment::Environment(const MojoAsyncWaiter* default_async_waiter, - const MojoLogger* default_logger, - const TaskTracker* default_task_tracker) { - Init(default_async_waiter, default_logger, default_task_tracker); -} - -Environment::~Environment() { - RunLoop::TearDown(); - - // TODO(vtl): Maybe we should allow nesting, and restore previous default - // async waiters and loggers? - g_default_async_waiter = nullptr; - g_default_logger = nullptr; -} - -// static -const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() { - assert(g_default_async_waiter); // Fails if not "inside" |Environment|. - return g_default_async_waiter; -} - -// static -const MojoLogger* Environment::GetDefaultLogger() { - assert(g_default_logger); // Fails if not "inside" |Environment|. - return g_default_logger; -} - -// static -const TaskTracker* Environment::GetDefaultTaskTracker() { - return g_default_task_tracker; -} - -// static -void Environment::InstantiateDefaultRunLoop() { - assert(!RunLoop::current()); - // Not leaked: accessible from |RunLoop::current()|. - RunLoop* run_loop = new RunLoop(); - ALLOW_UNUSED_LOCAL(run_loop); - assert(run_loop == RunLoop::current()); -} - -// static -void Environment::DestroyDefaultRunLoop() { - assert(RunLoop::current()); - delete RunLoop::current(); - assert(!RunLoop::current()); -} - -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/logging.cc b/mojo/public/cpp/environment/lib/logging.cc deleted file mode 100644 index 921e9e7..0000000 --- a/mojo/public/cpp/environment/lib/logging.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 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/environment/logging.h" - -#include <stdint.h> - -#include "mojo/public/cpp/environment/environment.h" - -namespace mojo { -namespace internal { - -namespace { - -// Gets a pointer to the filename portion of |s|. Assumes that the filename -// follows the last slash or backslash in |s|, or is |s| if no slash or -// backslash is present. -// -// E.g., a pointer to "foo.cc" is returned for the following inputs: "foo.cc", -// "./foo.cc", ".\foo.cc", "/absolute/path/to/foo.cc", -// "relative/path/to/foo.cc", "C:\absolute\path\to\foo.cc", etc. -const char* GetFilename(const char* s) { - const char* rv = s; - while (*s) { - if (*s == '/' || *s == '\\') - rv = s + 1; - s++; - } - return rv; -} - -} // namespace - -// TODO(vtl): Maybe we should preserve the full path and strip it out at a -// different level instead? -LogMessage::LogMessage(MojoLogLevel log_level, const char* file, int line) - : log_level_(log_level), file_(GetFilename(file)), line_(line) { -} - -LogMessage::~LogMessage() { - Environment::GetDefaultLogger()->LogMessage( - log_level_, file_, static_cast<uint32_t>(line_), stream_.str().c_str()); -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/scoped_task_tracking.cc b/mojo/public/cpp/environment/lib/scoped_task_tracking.cc deleted file mode 100644 index 9e253d5..0000000 --- a/mojo/public/cpp/environment/lib/scoped_task_tracking.cc +++ /dev/null @@ -1,37 +0,0 @@ -// 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/public/cpp/environment/lib/scoped_task_tracking.h" - -#include "mojo/public/cpp/environment/environment.h" - -namespace mojo { -namespace internal { - -ScopedTaskTracking::ScopedTaskTracking(const char* function_name, - const char* file_name, - int line, - const void* program_counter) - : id_(Environment::GetDefaultTaskTracker()->StartTracking( - function_name, - file_name, - line, - program_counter)) { -} - -ScopedTaskTracking::ScopedTaskTracking(const char* function_name, - const char* file_name, - int line) - : id_(Environment::GetDefaultTaskTracker()->StartTracking(function_name, - file_name, - line, - nullptr)) { -} - -ScopedTaskTracking::~ScopedTaskTracking() { - Environment::GetDefaultTaskTracker()->EndTracking(id_); -} - -} // namespace internal -} // namespace mojo diff --git a/mojo/public/cpp/environment/lib/scoped_task_tracking.h b/mojo/public/cpp/environment/lib/scoped_task_tracking.h deleted file mode 100644 index 4a8fb4f..0000000 --- a/mojo/public/cpp/environment/lib/scoped_task_tracking.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_ - -#include "base/macros.h" -#include "mojo/public/cpp/environment/task_tracker.h" - -namespace mojo { -namespace internal { - -// An RAII wrapper for |TaskTrackingId|. -class ScopedTaskTracking { - public: - ScopedTaskTracking(const char* function_name, - const char* file_name, - int line, - const void* program_counter); - ScopedTaskTracking(const char* function_name, - const char* file_name, - int line); - ~ScopedTaskTracking(); - - private: - TaskTrackingId id_; - DISALLOW_COPY_AND_ASSIGN(ScopedTaskTracking); -}; - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_ diff --git a/mojo/public/cpp/environment/logging.h b/mojo/public/cpp/environment/logging.h deleted file mode 100644 index 834ba6b..0000000 --- a/mojo/public/cpp/environment/logging.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2014 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. - -// Logging macros, similar to Chromium's base/logging.h, except with |MOJO_| -// prefixes and missing some features (notably |CHECK_EQ()|, etc.). - -// TODO(vtl): It's weird that this is in the environment directory, since its -// implementation (in environment/lib) is meant to be used by any implementation -// of the environment. - -#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_ - -#include <sstream> - -#include "base/macros.h" -#include "mojo/public/c/environment/logger.h" -#include "mojo/public/cpp/environment/environment.h" -#include "mojo/public/cpp/system/macros.h" - -#if defined(OS_WIN) -// To avoid a compile failure on Windows because it defines ERROR, which is also -// used by the logs. Similar to change in base/logging.h. -#undef ERROR -#endif - -#define MOJO_LOG_STREAM(level) \ - ::mojo::internal::LogMessage(MOJO_LOG_LEVEL_##level, __FILE__, __LINE__) \ - .stream() - -#define MOJO_LAZY_LOG_STREAM(level, condition) \ - !(condition) ? (void)0 \ - : ::mojo::internal::VoidifyOstream() & MOJO_LOG_STREAM(level) - -#define MOJO_SHOULD_LOG(level) \ - (MOJO_LOG_LEVEL_##level >= \ - ::mojo::Environment::GetDefaultLogger()->GetMinimumLogLevel()) - -#define MOJO_LOG(level) MOJO_LAZY_LOG_STREAM(level, MOJO_SHOULD_LOG(level)) - -#define MOJO_LOG_IF(level, condition) \ - MOJO_LAZY_LOG_STREAM(level, MOJO_SHOULD_LOG(level) && (condition)) - -#define MOJO_CHECK(condition) \ - MOJO_LAZY_LOG_STREAM(FATAL, !(condition)) << "Check failed: " #condition "." \ - " " - -// Note: For non-debug builds, |MOJO_DLOG_IF()| *eliminates* (i.e., doesn't -// compile) the condition, whereas |MOJO_DCHECK()| "neuters" the condition -// (i.e., compiles, but doesn't evaluate). -#ifdef NDEBUG -#define MOJO_DLOG(level) MOJO_LAZY_LOG_STREAM(level, false) -#define MOJO_DLOG_IF(level, condition) MOJO_LAZY_LOG_STREAM(level, false) -#else -#define MOJO_DLOG(level) MOJO_LOG(level) -#define MOJO_DLOG_IF(level, condition) MOJO_LOG_IF(level, condition) -#endif // NDEBUG - -#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) -#define MOJO_DCHECK(condition) \ - MOJO_LAZY_LOG_STREAM(FATAL, false ? !(condition) : false) -#else -#define MOJO_DCHECK(condition) MOJO_CHECK(condition) -#endif // NDEBUG && !defined(DCHECK_ALWAYS_ON) - -#define MOJO_NOTREACHED() MOJO_DCHECK(false) - -namespace mojo { -namespace internal { - -class LogMessage { - public: - LogMessage(MojoLogLevel log_level, const char* file, int line); - ~LogMessage(); - - std::ostream& stream() { return stream_; } - - private: - const MojoLogLevel log_level_; - const char* const file_; - const int line_; - std::ostringstream stream_; - - DISALLOW_COPY_AND_ASSIGN(LogMessage); -}; - -// Used to ignore a stream. -struct VoidifyOstream { - // Use & since it has precedence lower than << but higher than ?:. - void operator&(std::ostream&) {} -}; - -} // namespace internal -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_LOGGING_H_ diff --git a/mojo/public/cpp/environment/task_tracker.h b/mojo/public/cpp/environment/task_tracker.h deleted file mode 100644 index d6d3020..0000000 --- a/mojo/public/cpp/environment/task_tracker.h +++ /dev/null @@ -1,30 +0,0 @@ -// 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_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_ -#define MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_ - -#include <stdint.h> - -namespace mojo { - -typedef intptr_t TaskTrackingId; - -// Interface for wiring task-level profiling. This API is mainly used by the -// generated interface implementation. -struct TaskTracker { - // Start tracking. The returned id must be reclaimed through |EndTracking()|. - TaskTrackingId (*StartTracking)(const char* function_name, - const char* file_name, - int line_number, - const void* program_counter); - // Finish tracking. The |id| is one that is returned from |StartTracking()|. - void (*EndTracking)(const TaskTrackingId id); - // Enable or disable tracking. It is disabled by default. - void (*SetEnabled)(bool enabled); -}; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_ diff --git a/mojo/public/cpp/environment/tests/BUILD.gn b/mojo/public/cpp/environment/tests/BUILD.gn deleted file mode 100644 index 717c657..0000000 --- a/mojo/public/cpp/environment/tests/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2014 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("tests") { - testonly = true - - sources = [ - "async_wait_unittest.cc", - "async_waiter_unittest.cc", - "logger_unittest.cc", - "logging_unittest.cc", - ] - - deps = [ - "//mojo/public/c/environment", - "//mojo/public/cpp/bindings:callback", - "//mojo/public/cpp/environment:standalone", - "//mojo/public/cpp/system", - "//mojo/public/cpp/test_support:test_utils", - "//mojo/public/cpp/utility", - "//testing/gtest", - ] -} diff --git a/mojo/public/cpp/environment/tests/async_wait_unittest.cc b/mojo/public/cpp/environment/tests/async_wait_unittest.cc deleted file mode 100644 index 8f77e67..0000000 --- a/mojo/public/cpp/environment/tests/async_wait_unittest.cc +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2014 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 <string> - -#include "mojo/public/c/environment/async_waiter.h" -#include "mojo/public/cpp/environment/environment.h" -#include "mojo/public/cpp/system/core.h" -#include "mojo/public/cpp/system/macros.h" -#include "mojo/public/cpp/test_support/test_utils.h" -#include "mojo/public/cpp/utility/run_loop.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -class TestAsyncWaitCallback { - public: - TestAsyncWaitCallback() : result_count_(0), last_result_(MOJO_RESULT_OK) {} - ~TestAsyncWaitCallback() {} - - int result_count() const { return result_count_; } - - MojoResult last_result() const { return last_result_; } - - // MojoAsyncWaitCallback: - static void OnHandleReady(void* closure, MojoResult result) { - TestAsyncWaitCallback* self = static_cast<TestAsyncWaitCallback*>(closure); - self->result_count_++; - self->last_result_ = result; - } - - private: - int result_count_; - MojoResult last_result_; - - DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); -}; - -MojoAsyncWaitID CallAsyncWait(const Handle& handle, - MojoHandleSignals signals, - TestAsyncWaitCallback* callback) { - return Environment::GetDefaultAsyncWaiter()->AsyncWait( - handle.value(), - signals, - MOJO_DEADLINE_INDEFINITE, - &TestAsyncWaitCallback::OnHandleReady, - callback); -} - -void CallCancelWait(MojoAsyncWaitID wait_id) { - Environment::GetDefaultAsyncWaiter()->CancelWait(wait_id); -} - -class AsyncWaitTest : public testing::Test { - public: - AsyncWaitTest() {} - - private: - Environment environment_; - RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(AsyncWaitTest); -}; - -// Verifies AsyncWaitCallback is notified when pipe is ready. -TEST_F(AsyncWaitTest, CallbackNotified) { - TestAsyncWaitCallback callback; - MessagePipe test_pipe; - EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); - - CallAsyncWait( - test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback); - RunLoop::current()->Run(); - EXPECT_EQ(1, callback.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback.last_result()); -} - -// Verifies 2 AsyncWaitCallbacks are notified when there pipes are ready. -TEST_F(AsyncWaitTest, TwoCallbacksNotified) { - TestAsyncWaitCallback callback1; - TestAsyncWaitCallback callback2; - MessagePipe test_pipe1; - MessagePipe test_pipe2; - EXPECT_TRUE(test::WriteTextMessage(test_pipe1.handle1.get(), std::string())); - EXPECT_TRUE(test::WriteTextMessage(test_pipe2.handle1.get(), std::string())); - - CallAsyncWait( - test_pipe1.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback1); - CallAsyncWait( - test_pipe2.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback2); - - RunLoop::current()->Run(); - EXPECT_EQ(1, callback1.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback1.last_result()); - EXPECT_EQ(1, callback2.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback2.last_result()); -} - -// Verifies cancel works. -TEST_F(AsyncWaitTest, CancelCallback) { - TestAsyncWaitCallback callback; - MessagePipe test_pipe; - EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); - - CallCancelWait(CallAsyncWait( - test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback)); - RunLoop::current()->Run(); - EXPECT_EQ(0, callback.result_count()); -} - -} // namespace -} // namespace mojo diff --git a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc b/mojo/public/cpp/environment/tests/async_waiter_unittest.cc deleted file mode 100644 index 3628788..0000000 --- a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2014 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/callback.h" -#include "mojo/public/cpp/environment/async_waiter.h" -#include "mojo/public/cpp/test_support/test_utils.h" -#include "mojo/public/cpp/utility/run_loop.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -class TestAsyncWaitCallback { - public: - TestAsyncWaitCallback() : result_count_(0), last_result_(MOJO_RESULT_OK) {} - ~TestAsyncWaitCallback() {} - - int result_count() const { return result_count_; } - - MojoResult last_result() const { return last_result_; } - - void OnHandleReady(MojoResult result) { - result_count_++; - last_result_ = result; - } - - private: - int result_count_; - MojoResult last_result_; - - DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); -}; - -// Manual code to create a callback since we don't have mojo::Bind yet. -class ManualCallback { - public: - explicit ManualCallback(TestAsyncWaitCallback* callback) - : callback_(callback) {} - - void Run(MojoResult result) const { callback_->OnHandleReady(result); } - - private: - TestAsyncWaitCallback* callback_; -}; - -class AsyncWaiterTest : public testing::Test { - public: - AsyncWaiterTest() {} - - private: - Environment environment_; - RunLoop run_loop_; - - DISALLOW_COPY_AND_ASSIGN(AsyncWaiterTest); -}; - -// Verifies AsyncWaitCallback is notified when pipe is ready. -TEST_F(AsyncWaiterTest, CallbackNotified) { - TestAsyncWaitCallback callback; - MessagePipe test_pipe; - EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); - - AsyncWaiter waiter(test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, - ManualCallback(&callback)); - RunLoop::current()->Run(); - EXPECT_EQ(1, callback.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback.last_result()); -} - -// Verifies 2 AsyncWaitCallbacks are notified when there pipes are ready. -TEST_F(AsyncWaiterTest, TwoCallbacksNotified) { - TestAsyncWaitCallback callback1; - TestAsyncWaitCallback callback2; - MessagePipe test_pipe1; - MessagePipe test_pipe2; - EXPECT_TRUE(test::WriteTextMessage(test_pipe1.handle1.get(), std::string())); - EXPECT_TRUE(test::WriteTextMessage(test_pipe2.handle1.get(), std::string())); - - AsyncWaiter waiter1(test_pipe1.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, - ManualCallback(&callback1)); - AsyncWaiter waiter2(test_pipe2.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, - ManualCallback(&callback2)); - - RunLoop::current()->Run(); - EXPECT_EQ(1, callback1.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback1.last_result()); - EXPECT_EQ(1, callback2.result_count()); - EXPECT_EQ(MOJO_RESULT_OK, callback2.last_result()); -} - -// Verifies cancel works. -TEST_F(AsyncWaiterTest, CancelCallback) { - TestAsyncWaitCallback callback; - MessagePipe test_pipe; - EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); - - { - AsyncWaiter waiter(test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, - ManualCallback(&callback)); - } - RunLoop::current()->Run(); - EXPECT_EQ(0, callback.result_count()); -} - -} // namespace -} // namespace mojo diff --git a/mojo/public/cpp/environment/tests/logger_unittest.cc b/mojo/public/cpp/environment/tests/logger_unittest.cc deleted file mode 100644 index 8ca5538..0000000 --- a/mojo/public/cpp/environment/tests/logger_unittest.cc +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2014 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/c/environment/logger.h" -#include "mojo/public/cpp/environment/environment.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -TEST(LoggerTest, Basic) { - const char kPath[] = "/fake/path/to/file.cc"; - - Environment environment; - const MojoLogger* const logger = Environment::GetDefaultLogger(); - - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, kPath, 123, - "Logged at VERBOSE-1 level"); - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, kPath, 123, - "Logged at VERBOSE level"); - logger->LogMessage(MOJO_LOG_LEVEL_INFO, kPath, 123, "Logged at INFO level"); - logger->LogMessage(MOJO_LOG_LEVEL_WARNING, kPath, 123, - "Logged at WARNING level"); - logger->LogMessage(MOJO_LOG_LEVEL_ERROR, kPath, 123, "Logged at ERROR level"); - - // This should kill us: - EXPECT_DEATH_IF_SUPPORTED({ - logger->LogMessage(MOJO_LOG_LEVEL_FATAL, kPath, 123, - "Logged at FATAL level"); - }, ""); -} - -TEST(LoggerTest, LogLevels) { - const char kPath[] = "/fake/path/to/file.cc"; - - Environment environment; - const MojoLogger* const logger = Environment::GetDefaultLogger(); - - for (MojoLogLevel log_level = MOJO_LOG_LEVEL_VERBOSE - 1; - log_level <= MOJO_LOG_LEVEL_FATAL + 1; - log_level++) { - logger->SetMinimumLogLevel(log_level); - - if (log_level <= MOJO_LOG_LEVEL_FATAL) - EXPECT_EQ(log_level, logger->GetMinimumLogLevel()); - else - EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, logger->GetMinimumLogLevel()); - - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, kPath, 123, - "Logged at VERBOSE-1 level"); - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, kPath, 123, - "Logged at VERBOSE level"); - logger->LogMessage(MOJO_LOG_LEVEL_INFO, kPath, 123, "Logged at INFO level"); - logger->LogMessage(MOJO_LOG_LEVEL_WARNING, kPath, 123, - "Logged at WARNING level"); - logger->LogMessage(MOJO_LOG_LEVEL_ERROR, kPath, 123, - "Logged at ERROR level"); - - // This should kill us: - EXPECT_DEATH_IF_SUPPORTED({ - logger->LogMessage(MOJO_LOG_LEVEL_FATAL, kPath, 123, - "Logged at FATAL level"); - }, ""); - } -} - -TEST(LoggerTest, NoFile) { - Environment environment; - const MojoLogger* const logger = Environment::GetDefaultLogger(); - - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, nullptr, 0, - "Logged at VERBOSE-1 level"); - logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, nullptr, 0, - "Logged at VERBOSE level"); - logger->LogMessage(MOJO_LOG_LEVEL_INFO, nullptr, 0, "Logged at INFO level"); - logger->LogMessage(MOJO_LOG_LEVEL_WARNING, nullptr, 0, - "Logged at WARNING level"); - logger->LogMessage(MOJO_LOG_LEVEL_ERROR, nullptr, 0, "Logged at ERROR level"); - - // This should kill us: - EXPECT_DEATH_IF_SUPPORTED({ - logger->LogMessage(MOJO_LOG_LEVEL_FATAL, nullptr, 0, - "Logged at FATAL level"); - }, ""); -} - -} // namespace -} // namespace mojo diff --git a/mojo/public/cpp/environment/tests/logging_unittest.cc b/mojo/public/cpp/environment/tests/logging_unittest.cc deleted file mode 100644 index 8377252..0000000 --- a/mojo/public/cpp/environment/tests/logging_unittest.cc +++ /dev/null @@ -1,522 +0,0 @@ -// Copyright 2014 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 <stdint.h> -#include <stdlib.h> - -#include <sstream> -#include <string> - -#include "mojo/public/cpp/environment/environment.h" -#include "mojo/public/cpp/environment/logging.h" -#include "mojo/public/cpp/system/macros.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace mojo { -namespace { - -// The current logging system strips the path, so we need our filename. -const char kOurFilename[] = "logging_unittest.cc"; - -class PtrToMemberHelper { - public: - int member; -}; - -bool DcheckTestHelper(bool* was_called) { - *was_called = true; - return false; -} - -class LoggingTest : public testing::Test { - public: - LoggingTest() : environment_(nullptr, &kMockLogger, nullptr) { - minimum_log_level_ = MOJO_LOG_LEVEL_INFO; - ResetMockLogger(); - } - ~LoggingTest() override {} - - protected: - // Note: Does not reset |minimum_log_level_|. - static void ResetMockLogger() { - log_message_was_called_ = false; - last_log_level_ = MOJO_LOG_LEVEL_INFO; - last_source_file_.clear(); - last_source_line_ = 0; - last_message_.clear(); - } - - // A function returning |bool| that shouldn't be called. - static bool NotCalledCondition() { - not_called_condition_was_called_ = true; - return false; - } - - static bool log_message_was_called() { return log_message_was_called_; } - static MojoLogLevel last_log_level() { return last_log_level_; } - static const std::string& last_source_file() { return last_source_file_; } - static uint32_t last_source_line() { return last_source_line_; } - static const std::string& last_message() { return last_message_; } - static bool not_called_condition_was_called() { - return not_called_condition_was_called_; - } - - private: - // Note: We record calls even if |log_level| is below |minimum_log_level_| - // (since the macros should mostly avoid this, and we want to be able to check - // that they do). - static void MockLogMessage(MojoLogLevel log_level, - const char* source_file, - uint32_t source_line, - const char* message) { - log_message_was_called_ = true; - last_log_level_ = log_level; - last_source_file_ = source_file; - last_source_line_ = source_line; - last_message_ = message; - } - - static MojoLogLevel MockGetMinimumLogLevel() { return minimum_log_level_; } - - static void MockSetMinimumLogLevel(MojoLogLevel minimum_log_level) { - minimum_log_level_ = minimum_log_level; - } - - Environment environment_; - - static const MojoLogger kMockLogger; - static MojoLogLevel minimum_log_level_; - static bool log_message_was_called_; - static MojoLogLevel last_log_level_; - static std::string last_source_file_; - static uint32_t last_source_line_; - static std::string last_message_; - static bool not_called_condition_was_called_; - - DISALLOW_COPY_AND_ASSIGN(LoggingTest); -}; - -// static -const MojoLogger LoggingTest::kMockLogger = { - &LoggingTest::MockLogMessage, - &LoggingTest::MockGetMinimumLogLevel, - &LoggingTest::MockSetMinimumLogLevel}; - -// static -MojoLogLevel LoggingTest::minimum_log_level_ = MOJO_LOG_LEVEL_INFO; - -// static -bool LoggingTest::log_message_was_called_ = MOJO_LOG_LEVEL_INFO; - -// static -MojoLogLevel LoggingTest::last_log_level_ = MOJO_LOG_LEVEL_INFO; - -// static -std::string LoggingTest::last_source_file_; - -// static -uint32_t LoggingTest::last_source_line_ = 0; - -// static -std::string LoggingTest::last_message_; - -// static -bool LoggingTest::not_called_condition_was_called_ = false; - -TEST_F(LoggingTest, InternalLogMessage) { - internal::LogMessage(MOJO_LOG_LEVEL_INFO, "foo.cc", 123).stream() << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_WARNING, "./path/to/foo.cc", 123).stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_WARNING, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_ERROR, "/path/to/foo.cc", 123).stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_FATAL, "path/to/foo.cc", 123).stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_VERBOSE, ".\\xy\\foo.cc", 123).stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_VERBOSE, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, "xy\\foo.cc", 123).stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_VERBOSE - 1, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_VERBOSE - 9, "C:\\xy\\foo.cc", 123) - .stream() - << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_VERBOSE - 9, last_log_level()); - EXPECT_EQ("foo.cc", last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); - - ResetMockLogger(); - - internal::LogMessage(MOJO_LOG_LEVEL_INFO, __FILE__, 123).stream() << "hello " - << "world"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(123u, last_source_line()); - EXPECT_EQ("hello world", last_message()); -} - -TEST_F(LoggingTest, LogStream) { - MOJO_LOG_STREAM(INFO) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); - - ResetMockLogger(); - - MOJO_LOG_STREAM(ERROR) << "hi " << 123; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hi 123", last_message()); -} - -TEST_F(LoggingTest, LazyLogStream) { - MOJO_LAZY_LOG_STREAM(INFO, true) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); - - ResetMockLogger(); - - MOJO_LAZY_LOG_STREAM(ERROR, true) << "hi " << 123; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hi 123", last_message()); - - ResetMockLogger(); - - MOJO_LAZY_LOG_STREAM(INFO, false) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LAZY_LOG_STREAM(FATAL, false) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - PtrToMemberHelper helper; - helper.member = 1; - int PtrToMemberHelper::*member_ptr = &PtrToMemberHelper::member; - - // This probably fails to compile if we forget to parenthesize the condition - // in the macro (.* has lower precedence than !, which can't apply to - // |helper|). - MOJO_LAZY_LOG_STREAM(ERROR, helper.*member_ptr == 1) << "hello"; - EXPECT_TRUE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LAZY_LOG_STREAM(WARNING, helper.*member_ptr == 0) << "hello"; - EXPECT_FALSE(log_message_was_called()); -} - -TEST_F(LoggingTest, ShouldLog) { - // We start at |MOJO_LOG_LEVEL_INFO|. - EXPECT_FALSE(MOJO_SHOULD_LOG(VERBOSE)); - EXPECT_TRUE(MOJO_SHOULD_LOG(INFO)); - EXPECT_TRUE(MOJO_SHOULD_LOG(WARNING)); - EXPECT_TRUE(MOJO_SHOULD_LOG(ERROR)); - EXPECT_TRUE(MOJO_SHOULD_LOG(FATAL)); - - Environment::GetDefaultLogger()->SetMinimumLogLevel(MOJO_LOG_LEVEL_ERROR); - EXPECT_FALSE(MOJO_SHOULD_LOG(VERBOSE)); - EXPECT_FALSE(MOJO_SHOULD_LOG(INFO)); - EXPECT_FALSE(MOJO_SHOULD_LOG(WARNING)); - EXPECT_TRUE(MOJO_SHOULD_LOG(ERROR)); - EXPECT_TRUE(MOJO_SHOULD_LOG(FATAL)); - - Environment::GetDefaultLogger()->SetMinimumLogLevel(MOJO_LOG_LEVEL_VERBOSE - - 1); - EXPECT_TRUE(MOJO_SHOULD_LOG(VERBOSE)); - EXPECT_TRUE(MOJO_SHOULD_LOG(INFO)); - EXPECT_TRUE(MOJO_SHOULD_LOG(WARNING)); - EXPECT_TRUE(MOJO_SHOULD_LOG(ERROR)); - EXPECT_TRUE(MOJO_SHOULD_LOG(FATAL)); -} - -TEST_F(LoggingTest, Log) { - // We start at |MOJO_LOG_LEVEL_INFO|. - MOJO_LOG(VERBOSE) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG(INFO) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); - - ResetMockLogger(); - - MOJO_LOG(ERROR) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); - - ResetMockLogger(); - - Environment::GetDefaultLogger()->SetMinimumLogLevel(MOJO_LOG_LEVEL_ERROR); - - MOJO_LOG(VERBOSE) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG(INFO) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG(ERROR) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); -} - -TEST_F(LoggingTest, LogIf) { - // We start at |MOJO_LOG_LEVEL_INFO|. - MOJO_LOG_IF(VERBOSE, true) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG_IF(VERBOSE, false) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - Environment::GetDefaultLogger()->SetMinimumLogLevel(MOJO_LOG_LEVEL_ERROR); - - bool x = true; - // Also try to make sure that we parenthesize the condition properly. - MOJO_LOG_IF(INFO, false || x) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG_IF(INFO, 0 != 1) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG_IF(WARNING, 1 + 1 == 2) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_LOG_IF(ERROR, 1 * 2 == 2) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_ERROR, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("hello", last_message()); - - ResetMockLogger(); - - MOJO_LOG_IF(FATAL, 1 * 2 == 3) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - // |MOJO_LOG_IF()| shouldn't evaluate its condition if the level is below the - // minimum. - MOJO_LOG_IF(INFO, NotCalledCondition()) << "hello"; - EXPECT_FALSE(not_called_condition_was_called()); - EXPECT_FALSE(log_message_was_called()); -} - -TEST_F(LoggingTest, Check) { - MOJO_CHECK(true) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - PtrToMemberHelper helper; - helper.member = 0; - int PtrToMemberHelper::*member_ptr = &PtrToMemberHelper::member; - - // Also try to make sure that we parenthesize the condition properly. - MOJO_CHECK(helper.*member_ptr == 1) << "hello"; - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 4), last_source_line()); - EXPECT_EQ("Check failed: helper.*member_ptr == 1. hello", last_message()); - - ResetMockLogger(); - - // Also test a "naked" |MOJO_CHECK()|s. - MOJO_CHECK(1 + 2 == 3); - EXPECT_FALSE(log_message_was_called()); -} - -TEST_F(LoggingTest, Dlog) { - // We start at |MOJO_LOG_LEVEL_INFO|. - MOJO_DLOG(VERBOSE) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_DLOG(INFO) << "hello"; -#ifdef NDEBUG - EXPECT_FALSE(log_message_was_called()); -#else - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 7), last_source_line()); - EXPECT_EQ("hello", last_message()); -#endif -} - -TEST_F(LoggingTest, DlogIf) { - // We start at |MOJO_LOG_LEVEL_INFO|. It shouldn't evaluate the condition in - // this case. - MOJO_DLOG_IF(VERBOSE, NotCalledCondition()) << "hello"; - EXPECT_FALSE(not_called_condition_was_called()); - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_DLOG_IF(INFO, 1 == 0) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_DLOG_IF(INFO, 1 == 1) << "hello"; -#ifdef NDEBUG - EXPECT_FALSE(log_message_was_called()); -#else - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_INFO, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 7), last_source_line()); - EXPECT_EQ("hello", last_message()); -#endif - - ResetMockLogger(); - -// |MOJO_DLOG_IF()| shouldn't compile its condition for non-debug builds. -#ifndef NDEBUG - bool debug_only = true; -#endif - MOJO_DLOG_IF(WARNING, debug_only) << "hello"; -#ifdef NDEBUG - EXPECT_FALSE(log_message_was_called()); -#else - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_WARNING, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 7), last_source_line()); - EXPECT_EQ("hello", last_message()); -#endif -} - -TEST_F(LoggingTest, Dcheck) { - MOJO_DCHECK(true); - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - MOJO_DCHECK(true) << "hello"; - EXPECT_FALSE(log_message_was_called()); - - ResetMockLogger(); - - // |MOJO_DCHECK()| should compile (but not evaluate) its condition even for - // non-debug builds. (Hopefully, we'll get an unused variable error if it - // fails to compile the condition.) - bool was_called = false; - MOJO_DCHECK(DcheckTestHelper(&was_called)) << "hello"; -#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) - EXPECT_FALSE(was_called); - EXPECT_FALSE(log_message_was_called()); -#else - EXPECT_TRUE(was_called); - EXPECT_TRUE(log_message_was_called()); - EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, last_log_level()); - EXPECT_EQ(kOurFilename, last_source_file()); - EXPECT_EQ(static_cast<uint32_t>(__LINE__ - 9), last_source_line()); - EXPECT_EQ("Check failed: DcheckTestHelper(&was_called). hello", - last_message()); -#endif - - ResetMockLogger(); - - // Also try to make sure that we parenthesize the condition properly. - bool x = true; - MOJO_DCHECK(false || x) << "hello"; - EXPECT_FALSE(log_message_was_called()); -} - -} // namespace -} // namespace mojo diff --git a/mojo/public/cpp/system/tests/BUILD.gn b/mojo/public/cpp/system/tests/BUILD.gn index e7c8f29..b6664af 100644 --- a/mojo/public/cpp/system/tests/BUILD.gn +++ b/mojo/public/cpp/system/tests/BUILD.gn @@ -14,7 +14,6 @@ source_set("tests") { deps = [ "//base", "//mojo/public/c/system/tests", - "//mojo/public/cpp/environment:standalone", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//testing/gtest", diff --git a/mojo/public/cpp/utility/tests/BUILD.gn b/mojo/public/cpp/utility/tests/BUILD.gn index d324a57..b5a9219 100644 --- a/mojo/public/cpp/utility/tests/BUILD.gn +++ b/mojo/public/cpp/utility/tests/BUILD.gn @@ -10,7 +10,6 @@ source_set("tests") { ] deps = [ - "//mojo/public/cpp/environment:standalone", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//mojo/public/cpp/utility", diff --git a/mojo/public/interfaces/bindings/BUILD.gn b/mojo/public/interfaces/bindings/BUILD.gn index f0f12f9..c7421b9 100644 --- a/mojo/public/interfaces/bindings/BUILD.gn +++ b/mojo/public/interfaces/bindings/BUILD.gn @@ -9,6 +9,4 @@ mojom("bindings") { "interface_control_messages.mojom", "pipe_control_messages.mojom", ] - - with_environment = false } diff --git a/mojo/public/interfaces/bindings/tests/BUILD.gn b/mojo/public/interfaces/bindings/tests/BUILD.gn index 42f16c3..dddb522 100644 --- a/mojo/public/interfaces/bindings/tests/BUILD.gn +++ b/mojo/public/interfaces/bindings/tests/BUILD.gn @@ -25,8 +25,6 @@ mojom("test_interfaces") { "test_sync_methods.mojom", "validation_test_interfaces.mojom", ] - - with_environment = false } mojom("test_struct_traits_interfaces") { @@ -36,8 +34,6 @@ mojom("test_struct_traits_interfaces") { ] typemaps = [ "struct_with_traits.typemap" ] - - with_environment = false } mojom("test_interfaces_experimental") { @@ -45,8 +41,6 @@ mojom("test_interfaces_experimental") { sources = [ "test_unions.mojom", ] - - with_environment = false } mojom("test_associated_interfaces") { @@ -57,8 +51,6 @@ mojom("test_associated_interfaces") { "test_associated_interfaces.mojom", "validation_test_associated_interfaces.mojom", ] - - with_environment = false } mojom("versioning_test_service_interfaces") { @@ -67,8 +59,6 @@ mojom("versioning_test_service_interfaces") { sources = [ "versioning_test_service.mojom", ] - - with_environment = false } mojom("versioning_test_client_interfaces") { @@ -77,8 +67,6 @@ mojom("versioning_test_client_interfaces") { sources = [ "versioning_test_client.mojom", ] - - with_environment = false } mojom("test_interfaces_chromium") { @@ -91,8 +79,6 @@ mojom("test_interfaces_chromium") { variant = "chromium" typemaps = [ "chromium_test.typemap" ] - with_environment = false - public_deps = [ ":test_interfaces", ] @@ -108,8 +94,6 @@ mojom("test_interfaces_blink") { variant = "blink" typemaps = [ "blink_test.typemap" ] - with_environment = false - public_deps = [ ":test_interfaces", ] diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl index 447b6a4..b22f8530 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl @@ -33,7 +33,6 @@ #include "mojo/public/cpp/bindings/lib/validate_params.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" #include "mojo/public/cpp/bindings/lib/validation_util.h" -#include "mojo/public/cpp/environment/lib/scoped_task_tracking.h" #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" {%- for namespace in namespaces_as_array %} diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 6e2a62a..d8923dd 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni @@ -46,11 +46,6 @@ mojom_generator_sources = [ # import_dirs (optional) # List of import directories that will get added when processing sources. # -# with_environment (optional) -# Set to |false| to omit an implicit bindings dependency on the Chromium -# Mojo environment implementation. Defaults to |true| and in general -# should only be overridden by mojom targets within the Mojo EDK. -# # typemaps (optional) # A list of typemap files to apply during bindings generation. # @@ -250,9 +245,6 @@ template("mojom") { full_name = get_label_info(d, "label_no_toolchain") deps += [ "${full_name}_${cpp_sources_suffix}" ] } - if (!defined(invoker.with_environment) || invoker.with_environment) { - deps += [ "//mojo/environment:chromium" ] - } } } diff --git a/mojo/services/network/public/cpp/BUILD.gn b/mojo/services/network/public/cpp/BUILD.gn index 6bb891b..8c2734e 100644 --- a/mojo/services/network/public/cpp/BUILD.gn +++ b/mojo/services/network/public/cpp/BUILD.gn @@ -16,7 +16,6 @@ source_set("cpp") { deps = [ "../interfaces", "//base", - "//mojo/environment:chromium", "//mojo/message_pump", "//mojo/public/c/system", "//mojo/public/cpp/system", diff --git a/mojo/shell/public/cpp/BUILD.gn b/mojo/shell/public/cpp/BUILD.gn index e2cfbc8..b1f0345 100644 --- a/mojo/shell/public/cpp/BUILD.gn +++ b/mojo/shell/public/cpp/BUILD.gn @@ -86,7 +86,6 @@ source_set("test_support") { "//base/test:test_support", "//mojo/logging", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/environment", "//mojo/public/cpp/system", "//mojo/shell/public/interfaces:interfaces_cpp_sources", ] @@ -111,7 +110,6 @@ source_set("shell_test_support") { "//base/test:test_support", "//mojo/logging", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/environment", "//mojo/public/cpp/system", "//mojo/shell/background:lib", "//mojo/shell/public/interfaces:interfaces_cpp_sources", diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc index e2e5826..dcd7dc3 100644 --- a/mojo/shell/public/cpp/lib/application_test_base.cc +++ b/mojo/shell/public/cpp/lib/application_test_base.cc @@ -6,9 +6,9 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/message_pipe.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "mojo/shell/public/cpp/shell_connection.h" @@ -70,7 +70,7 @@ class ShellGrabber : public shell::mojom::ShellClient { MojoResult RunAllTests(MojoHandle shell_client_request_handle) { { // This loop is used for init, and then destroyed before running tests. - Environment::InstantiateDefaultRunLoop(); + base::MessageLoop message_loop; // Grab the shell handle. ShellGrabber grabber( @@ -97,8 +97,6 @@ MojoResult RunAllTests(MojoHandle shell_client_request_handle) { argv[argc] = nullptr; testing::InitGoogleTest(&argc, const_cast<char**>(&(argv[0]))); - - Environment::DestroyDefaultRunLoop(); } int result = RUN_ALL_TESTS(); @@ -140,8 +138,12 @@ ShellClient* ApplicationTestBase::GetShellClient() { void ApplicationTestBase::SetUp() { // A run loop is recommended for ShellConnection initialization and // communication. - if (ShouldCreateDefaultRunLoop()) - Environment::InstantiateDefaultRunLoop(); + if (ShouldCreateDefaultRunLoop()) { + CHECK(!base::MessageLoop::current()); + // Not leaked: accessible from |base::MessageLoop::current()|. + base::MessageLoop* message_loop = new base::MessageLoop(); + CHECK_EQ(message_loop, base::MessageLoop::current()); + } CHECK(g_shell_client_request.is_pending()); CHECK(g_connector); @@ -156,8 +158,11 @@ void ApplicationTestBase::TearDown() { test_helper_.reset(); - if (ShouldCreateDefaultRunLoop()) - Environment::DestroyDefaultRunLoop(); + if (ShouldCreateDefaultRunLoop()) { + CHECK(base::MessageLoop::current()); + delete base::MessageLoop::current(); + CHECK(!base::MessageLoop::current()); + } } bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { diff --git a/net/BUILD.gn b/net/BUILD.gn index 4961769..3788d21 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -1590,7 +1590,6 @@ test("net_unittests") { ":net_browser_services", ":net_utility_services", "//mojo/edk/system", - "//mojo/environment:chromium", ] } else { sources -= [ diff --git a/net/net.gyp b/net/net.gyp index 7fe7e3d..7730a5d 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -942,7 +942,6 @@ 'net', 'net_interfaces', '../mojo/mojo_base.gyp:mojo_common_lib', - '../mojo/mojo_base.gyp:mojo_environment_chromium', '../mojo/mojo_base.gyp:mojo_url_type_converters', '../mojo/mojo_public.gyp:mojo_cpp_bindings', diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index ce382d1..6acf2f1 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json @@ -497,12 +497,6 @@ "test": "mojo_public_bindings_unittests" }, { - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { @@ -699,12 +693,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1209,12 +1197,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1914,12 +1896,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -2215,9 +2191,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { @@ -6466,12 +6439,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -6721,12 +6688,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -7015,9 +6976,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { @@ -7258,9 +7216,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index e94063f..80a577f 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json @@ -71,12 +71,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -821,12 +815,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1238,12 +1226,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1621,12 +1603,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index 7b08547..3cf6772 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json @@ -29,7 +29,6 @@ "media_blink_unittests", "mojo_common_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_system_unittests", @@ -241,12 +240,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -569,12 +562,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -897,12 +884,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1226,12 +1207,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { diff --git a/testing/buildbot/chromium.memory.fyi.json b/testing/buildbot/chromium.memory.fyi.json index 7a2068e..ab8ad00 100644 --- a/testing/buildbot/chromium.memory.fyi.json +++ b/testing/buildbot/chromium.memory.fyi.json @@ -279,7 +279,6 @@ "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_common_unittests", "net_unittests", "printing_unittests", @@ -318,7 +317,6 @@ "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_common_unittests", "cast_unittests", "cc_unittests", @@ -536,12 +534,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -838,12 +830,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -2115,9 +2101,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { @@ -2412,9 +2395,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { @@ -2548,9 +2528,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index a2a33a0..cb45f9e 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json @@ -250,12 +250,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -662,12 +656,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1118,12 +1106,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1502,12 +1484,6 @@ "swarming": { "can_use_on_swarming_builders": true }, - "test": "mojo_public_environment_unittests" - }, - { - "swarming": { - "can_use_on_swarming_builders": true - }, "test": "mojo_public_system_unittests" }, { @@ -1752,9 +1728,6 @@ "test": "mojo_public_bindings_unittests" }, { - "test": "mojo_public_environment_unittests" - }, - { "test": "mojo_public_system_unittests" }, { diff --git a/testing/buildbot/chromium_trybot.json b/testing/buildbot/chromium_trybot.json index f61bdd3..24a7696 100644 --- a/testing/buildbot/chromium_trybot.json +++ b/testing/buildbot/chromium_trybot.json @@ -223,7 +223,6 @@ }, "mojo_common_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_system_unittests", diff --git a/testing/buildbot/client.v8.fyi.json b/testing/buildbot/client.v8.fyi.json index c8c65ec..89757b6 100644 --- a/testing/buildbot/client.v8.fyi.json +++ b/testing/buildbot/client.v8.fyi.json @@ -39,7 +39,6 @@ "media_blink_unittests", "mojo_common_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_system_unittests", diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 26d1a1f..8c95f75 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl @@ -352,10 +352,6 @@ "label": "//mojo/edk/test:mojo_public_bindings_unittests", "type": "console_test_launcher", }, - "mojo_public_environment_unittests": { - "label": "//mojo/edk/test:mojo_public_environment_unittests", - "type": "console_test_launcher", - }, "mojo_public_system_unittests": { "label": "//mojo/edk/test:mojo_public_system_unittests", "type": "console_test_launcher", diff --git a/testing/buildbot/tryserver.v8.json b/testing/buildbot/tryserver.v8.json index 7af7414..7ccbded 100644 --- a/testing/buildbot/tryserver.v8.json +++ b/testing/buildbot/tryserver.v8.json @@ -39,7 +39,6 @@ "media_blink_unittests", "mojo_common_unittests", "mojo_public_bindings_unittests", - "mojo_public_environment_unittests", "mojo_public_system_unittests", "mojo_public_utility_unittests", "mojo_system_unittests", diff --git a/third_party/WebKit/Source/platform/blink_platform.gyp b/third_party/WebKit/Source/platform/blink_platform.gyp index b1c485e..8db80e7 100644 --- a/third_party/WebKit/Source/platform/blink_platform.gyp +++ b/third_party/WebKit/Source/platform/blink_platform.gyp @@ -133,8 +133,8 @@ '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/device/battery/battery.gyp:device_battery_mojo_bindings', '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib', - '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_edk.gyp:mojo_system_impl', + '<(DEPTH)/mojo/mojo_public.gyp:mojo_cpp_bindings', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg', '<(DEPTH)/third_party/icu/icu.gyp:icui18n', diff --git a/third_party/WebKit/Source/platform/blink_platform_tests.gyp b/third_party/WebKit/Source/platform/blink_platform_tests.gyp index 90569f0..7254d69 100644 --- a/third_party/WebKit/Source/platform/blink_platform_tests.gyp +++ b/third_party/WebKit/Source/platform/blink_platform_tests.gyp @@ -113,8 +113,8 @@ 'blink_platform.gyp:blink_platform', '<(DEPTH)/cc/cc.gyp:cc', '<(DEPTH)/device/battery/battery.gyp:device_battery_mojo_bindings', - '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_edk.gyp:mojo_system_impl', + '<(DEPTH)/mojo/mojo_public.gyp:mojo_cpp_bindings', '<(DEPTH)/testing/gmock.gyp:gmock', ], 'defines': [ diff --git a/tools/battor_agent/battor_agent.gyp b/tools/battor_agent/battor_agent.gyp index abbb5cf..974fbde 100644 --- a/tools/battor_agent/battor_agent.gyp +++ b/tools/battor_agent/battor_agent.gyp @@ -14,7 +14,6 @@ 'battor_agent_lib', '../../device/serial/serial.gyp:device_serial', '../../device/serial/serial.gyp:device_serial_mojo', - '../../mojo/mojo_public.gyp:mojo_environment_standalone', '../../mojo/mojo_edk.gyp:mojo_system_impl', ], 'sources': [ @@ -58,7 +57,6 @@ '../../device/serial/serial.gyp:device_serial', '../../device/serial/serial.gyp:device_serial_test_util', '../../mojo/mojo_edk.gyp:mojo_system_impl', - '../../mojo/mojo_public.gyp:mojo_environment_standalone', '../../testing/gmock.gyp:gmock', '../../testing/gtest.gyp:gtest', ], diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py index 24ace69..c3f3e58 100755 --- a/tools/valgrind/chrome_tests.py +++ b/tools/valgrind/chrome_tests.py @@ -410,10 +410,6 @@ class ChromeTests: return self.SimpleTest("mojo_public_bindings", "mojo_public_bindings_unittests") - def TestMojoPublicEnv(self): - return self.SimpleTest("mojo_public_env", - "mojo_public_environment_unittests") - def TestMojoPublicSystem(self): return self.SimpleTest("mojo_public_system", "mojo_public_system_unittests") @@ -707,8 +703,6 @@ class ChromeTests: "mojo_public_utility_unittests": TestMojoPublicUtility, "mojo_public_bindings": TestMojoPublicBindings, "mojo_public_bindings_unittests": TestMojoPublicBindings, - "mojo_public_env": TestMojoPublicEnv, - "mojo_public_environment_unittests": TestMojoPublicEnv, "mojo_public_sysperf": TestMojoPublicSysPerf, "net": TestNet, "net_unittests": TestNet, "net_perf": TestNetPerf, "net_perftests": TestNetPerf, |