summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/clipboard/BUILD.gn1
-rw-r--r--components/clipboard/DEPS1
-rw-r--r--components/clipboard/clipboard_application_delegate.cc4
-rw-r--r--components/clipboard/clipboard_application_delegate.h4
-rw-r--r--components/filesystem/BUILD.gn1
-rw-r--r--components/filesystem/DEPS1
-rw-r--r--components/filesystem/file_system_app.cc1
-rw-r--r--components/filesystem/file_system_app.h2
-rw-r--r--components/font_service/BUILD.gn1
-rw-r--r--components/font_service/DEPS1
-rw-r--r--components/font_service/font_service_app.cc4
-rw-r--r--components/font_service/font_service_app.h3
-rw-r--r--components/mus/example/mock_sysui/BUILD.gn1
-rw-r--r--components/mus/example/mock_sysui/mock_sysui.cc2
-rw-r--r--components/mus/example/mock_sysui/mock_sysui.h3
-rw-r--r--components/mus/example/views_examples/BUILD.gn1
-rw-r--r--components/mus/example/views_examples/views_examples_application_delegate.cc1
-rw-r--r--components/mus/example/views_examples/views_examples_application_delegate.h3
-rw-r--r--components/mus/mus_app.cc2
-rw-r--r--components/mus/mus_app.h1
-rw-r--r--components/resource_provider/BUILD.gn1
-rw-r--r--components/resource_provider/DEPS1
-rw-r--r--components/resource_provider/resource_provider_app.cc1
-rw-r--r--components/resource_provider/resource_provider_app.h3
-rw-r--r--components/web_view/BUILD.gn1
-rw-r--r--components/web_view/DEPS1
-rw-r--r--components/web_view/web_view_application_delegate.cc1
-rw-r--r--components/web_view/web_view_application_delegate.h2
-rw-r--r--mandoline/services/core_services/core_services_application_delegate.cc1
-rw-r--r--mandoline/ui/desktop_ui/browser_manager.cc1
-rw-r--r--mandoline/ui/desktop_ui/browser_manager.h2
-rw-r--r--mandoline/ui/omnibox/BUILD.gn1
-rw-r--r--mandoline/ui/omnibox/DEPS1
-rw-r--r--mandoline/ui/omnibox/omnibox_application.cc1
-rw-r--r--mandoline/ui/omnibox/omnibox_application.h2
-rw-r--r--mash/wm/BUILD.gn1
-rw-r--r--mash/wm/window_manager_application.cc2
-rw-r--r--mash/wm/window_manager_application.h3
-rw-r--r--mojo/runner/desktop/launcher_process.cc3
-rw-r--r--mojo/services/network/BUILD.gn1
-rw-r--r--mojo/services/network/network_service_delegate.cc1
-rw-r--r--mojo/services/network/network_service_delegate.h2
-rw-r--r--mojo/services/tracing/public/cpp/tracing_impl.cc30
-rw-r--r--mojo/services/tracing/public/cpp/tracing_impl.h10
44 files changed, 109 insertions, 2 deletions
diff --git a/components/clipboard/BUILD.gn b/components/clipboard/BUILD.gn
index fab0291..a15617b 100644
--- a/components/clipboard/BUILD.gn
+++ b/components/clipboard/BUILD.gn
@@ -18,6 +18,7 @@ source_set("lib") {
"//mojo/application/public/cpp",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/bindings:callback",
+ "//mojo/services/tracing/public/cpp",
]
}
diff --git a/components/clipboard/DEPS b/components/clipboard/DEPS
index 0ade4ce..8db7505 100644
--- a/components/clipboard/DEPS
+++ b/components/clipboard/DEPS
@@ -2,5 +2,6 @@ include_rules = [
"+mojo/application",
"+mojo/common",
"+mojo/public",
+ "+mojo/services/tracing/public/cpp",
"+third_party/mojo_services/src/clipboard",
]
diff --git a/components/clipboard/clipboard_application_delegate.cc b/components/clipboard/clipboard_application_delegate.cc
index ad8fec0..53eff35 100644
--- a/components/clipboard/clipboard_application_delegate.cc
+++ b/components/clipboard/clipboard_application_delegate.cc
@@ -13,6 +13,10 @@ ClipboardApplicationDelegate::ClipboardApplicationDelegate() {}
ClipboardApplicationDelegate::~ClipboardApplicationDelegate() {}
+void ClipboardApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
+ tracing_.Initialize(app);
+}
+
bool ClipboardApplicationDelegate::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) {
connection->AddService(this);
diff --git a/components/clipboard/clipboard_application_delegate.h b/components/clipboard/clipboard_application_delegate.h
index 466a02c..d54bd3b 100644
--- a/components/clipboard/clipboard_application_delegate.h
+++ b/components/clipboard/clipboard_application_delegate.h
@@ -9,6 +9,7 @@
#include "components/clipboard/public/interfaces/clipboard.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace mojo {
class ApplicationConnection;
@@ -24,6 +25,7 @@ class ClipboardApplicationDelegate
~ClipboardApplicationDelegate() override;
// mojo::ApplicationDelegate implementation.
+ void Initialize(mojo::ApplicationImpl* app) override;
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
@@ -32,6 +34,8 @@ class ClipboardApplicationDelegate
mojo::InterfaceRequest<mojo::Clipboard> request) override;
private:
+ mojo::TracingImpl tracing_;
+
DISALLOW_COPY_AND_ASSIGN(ClipboardApplicationDelegate);
};
diff --git a/components/filesystem/BUILD.gn b/components/filesystem/BUILD.gn
index 47782a6..178633b 100644
--- a/components/filesystem/BUILD.gn
+++ b/components/filesystem/BUILD.gn
@@ -25,6 +25,7 @@ source_set("lib") {
"//mojo/common",
"//mojo/common:common_base",
"//mojo/platform_handle",
+ "//mojo/services/tracing/public/cpp",
"//url",
]
}
diff --git a/components/filesystem/DEPS b/components/filesystem/DEPS
index b3412d0..1d92bb6 100644
--- a/components/filesystem/DEPS
+++ b/components/filesystem/DEPS
@@ -2,5 +2,6 @@ include_rules = [
"+mojo/application",
"+mojo/platform_handle",
"+mojo/public",
+ "+mojo/services/tracing/public/cpp",
"+mojo/util",
]
diff --git a/components/filesystem/file_system_app.cc b/components/filesystem/file_system_app.cc
index c42b606..be7bd18 100644
--- a/components/filesystem/file_system_app.cc
+++ b/components/filesystem/file_system_app.cc
@@ -17,6 +17,7 @@ FileSystemApp::~FileSystemApp() {}
void FileSystemApp::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
+ tracing_.Initialize(app);
}
bool FileSystemApp::ConfigureIncomingConnection(
diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h
index 56e33af..b997bb5 100644
--- a/components/filesystem/file_system_app.h
+++ b/components/filesystem/file_system_app.h
@@ -11,6 +11,7 @@
#include "components/filesystem/public/interfaces/file_system.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace mojo {
class ApplicationImpl;
@@ -59,6 +60,7 @@ class FileSystemApp : public mojo::ApplicationDelegate,
std::vector<Client> client_mapping_;
mojo::ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
// Set to true when our shell connection is closed. On connection error, we
// then broadcast a notification to all FileSystemClients that they should
diff --git a/components/font_service/BUILD.gn b/components/font_service/BUILD.gn
index 2ef5123..49f9390 100644
--- a/components/font_service/BUILD.gn
+++ b/components/font_service/BUILD.gn
@@ -17,6 +17,7 @@ source_set("lib") {
"//mojo/common:common_base",
"//mojo/platform_handle",
"//mojo/public/cpp/bindings",
+ "//mojo/services/tracing/public/cpp",
]
public_deps = [
diff --git a/components/font_service/DEPS b/components/font_service/DEPS
index ef585a9..bce6c1c 100644
--- a/components/font_service/DEPS
+++ b/components/font_service/DEPS
@@ -4,6 +4,7 @@ include_rules = [
"+mojo/message_pump",
"+mojo/platform_handle",
"+mojo/public",
+ "+mojo/services/tracing/public/cpp",
"+skia",
"+third_party/skia/include",
]
diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc
index 77f03a4..41a7f9e 100644
--- a/components/font_service/font_service_app.cc
+++ b/components/font_service/font_service_app.cc
@@ -56,7 +56,9 @@ FontServiceApp::FontServiceApp() {}
FontServiceApp::~FontServiceApp() {}
-void FontServiceApp::Initialize(mojo::ApplicationImpl* app) {}
+void FontServiceApp::Initialize(mojo::ApplicationImpl* app) {
+ tracing_.Initialize(app);
+}
bool FontServiceApp::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) {
diff --git a/components/font_service/font_service_app.h b/components/font_service/font_service_app.h
index 9eda20a..7beb4b5 100644
--- a/components/font_service/font_service_app.h
+++ b/components/font_service/font_service_app.h
@@ -9,6 +9,7 @@
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
#include "skia/ext/skia_utils_base.h"
namespace font_service {
@@ -41,6 +42,8 @@ class FontServiceApp : public mojo::ApplicationDelegate,
mojo::WeakBindingSet<FontService> bindings_;
+ mojo::TracingImpl tracing_;
+
// We don't want to leak paths to our callers; we thus enumerate the paths of
// fonts.
SkTDArray<SkString*> paths_;
diff --git a/components/mus/example/mock_sysui/BUILD.gn b/components/mus/example/mock_sysui/BUILD.gn
index b15537a..2e8305e 100644
--- a/components/mus/example/mock_sysui/BUILD.gn
+++ b/components/mus/example/mock_sysui/BUILD.gn
@@ -20,6 +20,7 @@ mojo_native_application("mock_sysui") {
"//mash/wm/public/interfaces",
"//mojo/application/public/cpp",
"//mojo/common:common_base",
+ "//mojo/services/tracing/public/cpp",
"//skia",
"//ui/views",
"//ui/views/mus:for_mojo_application",
diff --git a/components/mus/example/mock_sysui/mock_sysui.cc b/components/mus/example/mock_sysui/mock_sysui.cc
index 5d80457..6a0a67f 100644
--- a/components/mus/example/mock_sysui/mock_sysui.cc
+++ b/components/mus/example/mock_sysui/mock_sysui.cc
@@ -95,6 +95,8 @@ MockSysUI::~MockSysUI() {
}
void MockSysUI::Initialize(mojo::ApplicationImpl* app) {
+ tracing_.Initialize(app);
+
aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
views::WindowManagerConnection::Create(app);
diff --git a/components/mus/example/mock_sysui/mock_sysui.h b/components/mus/example/mock_sysui/mock_sysui.h
index f70b97b..b214c64 100644
--- a/components/mus/example/mock_sysui/mock_sysui.h
+++ b/components/mus/example/mock_sysui/mock_sysui.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "mojo/application/public/cpp/application_delegate.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace views {
class AuraInit;
@@ -24,6 +25,8 @@ class MockSysUI : public mojo::ApplicationDelegate {
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
+ mojo::TracingImpl tracing_;
+
scoped_ptr<views::AuraInit> aura_init_;
DISALLOW_COPY_AND_ASSIGN(MockSysUI);
diff --git a/components/mus/example/views_examples/BUILD.gn b/components/mus/example/views_examples/BUILD.gn
index e5cf4de..c250718 100644
--- a/components/mus/example/views_examples/BUILD.gn
+++ b/components/mus/example/views_examples/BUILD.gn
@@ -23,6 +23,7 @@ mojo_native_application("views_examples") {
"//mojo/application/public/cpp:sources",
"//mojo/converters/geometry",
"//mojo/public/cpp/bindings",
+ "//mojo/services/tracing/public/cpp",
"//skia",
"//ui/gfx",
"//ui/gfx/geometry",
diff --git a/components/mus/example/views_examples/views_examples_application_delegate.cc b/components/mus/example/views_examples/views_examples_application_delegate.cc
index a1ac1f2..176de7f 100644
--- a/components/mus/example/views_examples/views_examples_application_delegate.cc
+++ b/components/mus/example/views_examples/views_examples_application_delegate.cc
@@ -17,6 +17,7 @@ ViewsExamplesApplicationDelegate::~ViewsExamplesApplicationDelegate() {
}
void ViewsExamplesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
+ tracing_.Initialize(app);
aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
views::WindowManagerConnection::Create(app);
diff --git a/components/mus/example/views_examples/views_examples_application_delegate.h b/components/mus/example/views_examples/views_examples_application_delegate.h
index 6f6e1bb..c317aa2 100644
--- a/components/mus/example/views_examples/views_examples_application_delegate.h
+++ b/components/mus/example/views_examples/views_examples_application_delegate.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "mojo/application/public/cpp/application_delegate.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace views {
class AuraInit;
@@ -24,6 +25,8 @@ class ViewsExamplesApplicationDelegate : public mojo::ApplicationDelegate {
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
+ mojo::TracingImpl tracing_;
+
scoped_ptr<views::AuraInit> aura_init_;
DISALLOW_COPY_AND_ASSIGN(ViewsExamplesApplicationDelegate);
diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc
index f464ba4..df40649f 100644
--- a/components/mus/mus_app.cc
+++ b/components/mus/mus_app.cc
@@ -70,6 +70,8 @@ void MandolineUIServicesApp::Initialize(ApplicationImpl* app) {
if (!gpu_state_.get())
gpu_state_ = new GpuState(hardware_rendering_available);
connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_));
+
+ tracing_.Initialize(app);
}
bool MandolineUIServicesApp::ConfigureIncomingConnection(
diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h
index 069e665..fab2e92 100644
--- a/components/mus/mus_app.h
+++ b/components/mus/mus_app.h
@@ -91,6 +91,7 @@ class MandolineUIServicesApp
scoped_ptr<ws::ConnectionManager> connection_manager_;
scoped_refptr<GpuState> gpu_state_;
scoped_ptr<ui::PlatformEventSource> event_source_;
+ mojo::TracingImpl tracing_;
using WindowManagerRequests =
std::vector<scoped_ptr<mojo::InterfaceRequest<mojom::WindowManager>>>;
WindowManagerRequests pending_window_manager_requests_;
diff --git a/components/resource_provider/BUILD.gn b/components/resource_provider/BUILD.gn
index 5e4bc84..c686117 100644
--- a/components/resource_provider/BUILD.gn
+++ b/components/resource_provider/BUILD.gn
@@ -92,6 +92,7 @@ source_set("lib") {
"//components/resource_provider/public/interfaces",
"//mojo/application/public/cpp",
"//mojo/common:common_base",
+ "//mojo/services/tracing/public/cpp",
"//url",
]
}
diff --git a/components/resource_provider/DEPS b/components/resource_provider/DEPS
index 4146852..5780d73 100644
--- a/components/resource_provider/DEPS
+++ b/components/resource_provider/DEPS
@@ -4,4 +4,5 @@ include_rules = [
"+mojo/converters",
"+mojo/platform_handle",
"+mojo/public",
+ "+mojo/services/tracing/public/cpp",
]
diff --git a/components/resource_provider/resource_provider_app.cc b/components/resource_provider/resource_provider_app.cc
index c7cd6fa..60d230f 100644
--- a/components/resource_provider/resource_provider_app.cc
+++ b/components/resource_provider/resource_provider_app.cc
@@ -20,6 +20,7 @@ ResourceProviderApp::~ResourceProviderApp() {
}
void ResourceProviderApp::Initialize(mojo::ApplicationImpl* app) {
+ tracing_.Initialize(app);
}
bool ResourceProviderApp::ConfigureIncomingConnection(
diff --git a/components/resource_provider/resource_provider_app.h b/components/resource_provider/resource_provider_app.h
index b4c13de..6b0a238 100644
--- a/components/resource_provider/resource_provider_app.h
+++ b/components/resource_provider/resource_provider_app.h
@@ -12,6 +12,7 @@
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace mojo {
class ApplicationImpl;
@@ -35,6 +36,8 @@ class ResourceProviderApp : public mojo::ApplicationDelegate,
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<ResourceProvider> request) override;
+ mojo::TracingImpl tracing_;
+
mojo::WeakBindingSet<ResourceProvider> bindings_;
// The name of the app that the resource provider code lives in. When using
diff --git a/components/web_view/BUILD.gn b/components/web_view/BUILD.gn
index cb80c43..569cc4b 100644
--- a/components/web_view/BUILD.gn
+++ b/components/web_view/BUILD.gn
@@ -66,6 +66,7 @@ source_set("lib") {
"//mojo/converters/geometry",
"//mojo/public/cpp/bindings",
"//mojo/services/network/public/interfaces",
+ "//mojo/services/tracing/public/cpp",
"//mojo/services/tracing/public/interfaces",
"//url",
]
diff --git a/components/web_view/DEPS b/components/web_view/DEPS
index 32714a9..7d07d3d 100644
--- a/components/web_view/DEPS
+++ b/components/web_view/DEPS
@@ -11,6 +11,7 @@ include_rules = [
"+mojo/converters/geometry",
"+mojo/public",
"+mojo/services/network/public/interfaces",
+ "+mojo/services/tracing/public/cpp",
"+mojo/services/tracing/public/interfaces",
"+mojo/util",
]
diff --git a/components/web_view/web_view_application_delegate.cc b/components/web_view/web_view_application_delegate.cc
index ab0f7dd..2a4c48e 100644
--- a/components/web_view/web_view_application_delegate.cc
+++ b/components/web_view/web_view_application_delegate.cc
@@ -14,6 +14,7 @@ WebViewApplicationDelegate::~WebViewApplicationDelegate() {}
void WebViewApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
+ tracing_.Initialize(app);
}
bool WebViewApplicationDelegate::ConfigureIncomingConnection(
diff --git a/components/web_view/web_view_application_delegate.h b/components/web_view/web_view_application_delegate.h
index c8bbf15..a5482ba 100644
--- a/components/web_view/web_view_application_delegate.h
+++ b/components/web_view/web_view_application_delegate.h
@@ -10,6 +10,7 @@
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace web_view {
@@ -36,6 +37,7 @@ class WebViewApplicationDelegate
mojo::InterfaceRequest<mojom::WebViewFactory> request) override;
mojo::ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
mojo::WeakBindingSet<WebViewFactory> factory_bindings_;
diff --git a/mandoline/services/core_services/core_services_application_delegate.cc b/mandoline/services/core_services/core_services_application_delegate.cc
index 093beac..7c970f2 100644
--- a/mandoline/services/core_services/core_services_application_delegate.cc
+++ b/mandoline/services/core_services/core_services_application_delegate.cc
@@ -97,7 +97,6 @@ void CoreServicesApplicationDelegate::ApplicationThreadDestroyed(
}
void CoreServicesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
- base::PlatformThread::SetName("CoreServicesDispatcher");
mojo::logging::InitLogging();
tracing_.Initialize(app);
}
diff --git a/mandoline/ui/desktop_ui/browser_manager.cc b/mandoline/ui/desktop_ui/browser_manager.cc
index 3cb2b69..1049472 100644
--- a/mandoline/ui/desktop_ui/browser_manager.cc
+++ b/mandoline/ui/desktop_ui/browser_manager.cc
@@ -49,6 +49,7 @@ void BrowserManager::LaunchURL(const mojo::String& url) {
void BrowserManager::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
+ tracing_.Initialize(app);
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = "mojo:mus";
diff --git a/mandoline/ui/desktop_ui/browser_manager.h b/mandoline/ui/desktop_ui/browser_manager.h
index 6eee78f..9066849 100644
--- a/mandoline/ui/desktop_ui/browser_manager.h
+++ b/mandoline/ui/desktop_ui/browser_manager.h
@@ -13,6 +13,7 @@
#include "mojo/application/public/cpp/application_impl.h"
#include "mojo/application/public/cpp/connect.h"
#include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
#include "url/gurl.h"
namespace mojo {
@@ -53,6 +54,7 @@ class BrowserManager : public mojo::ApplicationDelegate,
mojo::InterfaceRequest<LaunchHandler> request) override;
mojo::ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
mus::mojom::WindowTreeHostFactoryPtr host_factory_;
mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_;
std::set<BrowserWindow*> browsers_;
diff --git a/mandoline/ui/omnibox/BUILD.gn b/mandoline/ui/omnibox/BUILD.gn
index d3d87bf..42c1fdb 100644
--- a/mandoline/ui/omnibox/BUILD.gn
+++ b/mandoline/ui/omnibox/BUILD.gn
@@ -33,6 +33,7 @@ source_set("lib") {
"//mojo/common",
"//mojo/converters/geometry",
"//mojo/public/cpp/bindings",
+ "//mojo/services/tracing/public/cpp",
"//skia",
"//ui/gfx/geometry",
"//ui/mojo/init",
diff --git a/mandoline/ui/omnibox/DEPS b/mandoline/ui/omnibox/DEPS
index 3964764..838b0a6 100644
--- a/mandoline/ui/omnibox/DEPS
+++ b/mandoline/ui/omnibox/DEPS
@@ -5,5 +5,6 @@ include_rules = [
"+mojo/common",
"+mojo/converters",
"+mojo/public",
+ "+mojo/services/tracing/public/cpp",
"+ui",
]
diff --git a/mandoline/ui/omnibox/omnibox_application.cc b/mandoline/ui/omnibox/omnibox_application.cc
index 631a386..69b228b 100644
--- a/mandoline/ui/omnibox/omnibox_application.cc
+++ b/mandoline/ui/omnibox/omnibox_application.cc
@@ -82,6 +82,7 @@ OmniboxApplication::~OmniboxApplication() {}
void OmniboxApplication::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
+ tracing_.Initialize(app);
}
bool OmniboxApplication::ConfigureIncomingConnection(
diff --git a/mandoline/ui/omnibox/omnibox_application.h b/mandoline/ui/omnibox/omnibox_application.h
index c14dd82..eeeea7f 100644
--- a/mandoline/ui/omnibox/omnibox_application.h
+++ b/mandoline/ui/omnibox/omnibox_application.h
@@ -9,6 +9,7 @@
#include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace mojo {
class ApplicationImpl;
@@ -33,6 +34,7 @@ class OmniboxApplication : public mojo::ApplicationDelegate,
mojo::InterfaceRequest<Omnibox> request) override;
mojo::ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
DISALLOW_COPY_AND_ASSIGN(OmniboxApplication);
};
diff --git a/mash/wm/BUILD.gn b/mash/wm/BUILD.gn
index f26c2f4..373ef7a 100644
--- a/mash/wm/BUILD.gn
+++ b/mash/wm/BUILD.gn
@@ -48,6 +48,7 @@ source_set("example_wm_lib") {
"//mojo/common:common_base",
"//mojo/converters/geometry",
"//mojo/converters/input_events",
+ "//mojo/services/tracing/public/cpp",
"//skia",
"//ui/mojo/init",
"//ui/views",
diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc
index 388c55f..7d8bd5f 100644
--- a/mash/wm/window_manager_application.cc
+++ b/mash/wm/window_manager_application.cc
@@ -13,6 +13,7 @@
#include "mash/wm/window_layout.h"
#include "mash/wm/window_manager_impl.h"
#include "mojo/application/public/cpp/application_connection.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
#include "ui/mojo/init/ui_init.h"
#include "ui/views/mus/aura_init.h"
#include "ui/views/mus/display_converter.h"
@@ -34,6 +35,7 @@ mus::Window* WindowManagerApplication::GetWindowById(mus::Id id) {
void WindowManagerApplication::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
+ tracing_.Initialize(app);
mus::mojom::WindowManagerPtr window_manager;
requests_.push_back(new mojo::InterfaceRequest<mus::mojom::WindowManager>(
mojo::GetProxy(&window_manager)));
diff --git a/mash/wm/window_manager_application.h b/mash/wm/window_manager_application.h
index 39e0484..95880a3 100644
--- a/mash/wm/window_manager_application.h
+++ b/mash/wm/window_manager_application.h
@@ -18,6 +18,7 @@
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory_impl.h"
#include "mojo/common/weak_binding_set.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
class BackgroundLayout;
class ShelfLayout;
@@ -88,6 +89,8 @@ class WindowManagerApplication
mojo::ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
+
mus::mojom::WindowTreeHostPtr host_;
scoped_ptr<ui::mojo::UIInit> ui_init_;
diff --git a/mojo/runner/desktop/launcher_process.cc b/mojo/runner/desktop/launcher_process.cc
index 4fa6956..b55953c 100644
--- a/mojo/runner/desktop/launcher_process.cc
+++ b/mojo/runner/desktop/launcher_process.cc
@@ -15,6 +15,7 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/synchronization/waitable_event.h"
+#include "base/threading/platform_thread.h"
#include "mojo/runner/context.h"
#include "mojo/runner/switches.h"
#include "mojo/shell/switches.h"
@@ -31,6 +32,8 @@ int LauncherProcessMain(const GURL& mojo_url, const base::Closure& callback) {
// http://crbug.com/546644
command_line->AppendSwitch(switches::kMojoNoSandbox);
+ base::PlatformThread::SetName("mojo_runner");
+
// We want the shell::Context to outlive the MessageLoop so that pipes are
// all gracefully closed / error-out before we try to shut the Context down.
Context shell_context;
diff --git a/mojo/services/network/BUILD.gn b/mojo/services/network/BUILD.gn
index 6b20a9b..76d6bdc 100644
--- a/mojo/services/network/BUILD.gn
+++ b/mojo/services/network/BUILD.gn
@@ -100,6 +100,7 @@ source_set("lib") {
"//mojo/public/cpp/system:system",
"//mojo/services/network/public/cpp",
"//mojo/services/network/public/interfaces",
+ "//mojo/services/tracing/public/cpp",
"//net",
"//net:extras",
"//net:http_server",
diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc
index 14e642b..0a43964 100644
--- a/mojo/services/network/network_service_delegate.cc
+++ b/mojo/services/network/network_service_delegate.cc
@@ -129,6 +129,7 @@ void NetworkServiceDelegate::Initialize(ApplicationImpl* app) {
worker_thread = io_worker_thread_->task_runner();
#endif
context_.reset(new NetworkContext(base_path, worker_thread, this));
+ tracing_.Initialize(app);
}
bool NetworkServiceDelegate::ConfigureIncomingConnection(
diff --git a/mojo/services/network/network_service_delegate.h b/mojo/services/network/network_service_delegate.h
index 216f961..16b2f96 100644
--- a/mojo/services/network/network_service_delegate.h
+++ b/mojo/services/network/network_service_delegate.h
@@ -16,6 +16,7 @@
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
#include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
#include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h"
+#include "mojo/services/tracing/public/cpp/tracing_impl.h"
namespace sql {
class ScopedMojoFilesystemVFS;
@@ -69,6 +70,7 @@ class NetworkServiceDelegate : public ApplicationDelegate,
private:
ApplicationImpl* app_;
+ mojo::TracingImpl tracing_;
// Observers that want notifications that our worker thread is going away.
base::ObserverList<NetworkServiceDelegateObserver> observers_;
diff --git a/mojo/services/tracing/public/cpp/tracing_impl.cc b/mojo/services/tracing/public/cpp/tracing_impl.cc
index 788cd31..1cffe03 100644
--- a/mojo/services/tracing/public/cpp/tracing_impl.cc
+++ b/mojo/services/tracing/public/cpp/tracing_impl.cc
@@ -4,6 +4,9 @@
#include "mojo/services/tracing/public/cpp/tracing_impl.h"
+#include "base/lazy_instance.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event_impl.h"
#include "mojo/application/public/cpp/application_impl.h"
@@ -13,6 +16,22 @@
#endif
namespace mojo {
+namespace {
+
+// Controls access to |g_tracing_singleton_created|, which can be accessed from
+// different threads.
+base::LazyInstance<base::Lock>::Leaky g_singleton_lock =
+ LAZY_INSTANCE_INITIALIZER;
+
+// Whether we are the first TracingImpl to be created in this mojo
+// application. The first TracingImpl in a physical mojo application connects
+// to the mojo:tracing service.
+//
+// If this is a ContentHandler, it will outlive all its served Applications. If
+// this is a raw mojo application, it is the only Application served.
+bool g_tracing_singleton_created = false;
+
+}
TracingImpl::TracingImpl() {
}
@@ -21,6 +40,17 @@ TracingImpl::~TracingImpl() {
}
void TracingImpl::Initialize(ApplicationImpl* app) {
+ {
+ base::AutoLock lock(g_singleton_lock.Get());
+ if (g_tracing_singleton_created)
+ return;
+ g_tracing_singleton_created = true;
+ }
+
+ // This will only set the name for the first app in a loaded mojo file. It's
+ // up to something like CoreServices to name its own child threads.
+ base::PlatformThread::SetName(app->url());
+
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = mojo::String::From("mojo:tracing");
connection_ = app->ConnectToApplication(request.Pass());
diff --git a/mojo/services/tracing/public/cpp/tracing_impl.h b/mojo/services/tracing/public/cpp/tracing_impl.h
index 648023f..b832ef49 100644
--- a/mojo/services/tracing/public/cpp/tracing_impl.h
+++ b/mojo/services/tracing/public/cpp/tracing_impl.h
@@ -15,6 +15,16 @@ namespace mojo {
class ApplicationConnection;
class ApplicationImpl;
+// Connects to mojo:tracing during your Application's Initialize() call once
+// per process.
+//
+// We need to deal with multiple ways of packaging mojo applications
+// together. We'll need to deal with packages that use the mojo.ContentHandler
+// interface to bundle several Applciations into a single physical on disk
+// mojo binary, and with those same services each in their own mojo binary.
+//
+// Have your bundle ContentHandler own a TracingImpl, and each Application own
+// a TracingImpl. In bundles, the second TracingImpl will be a no-op.
class TracingImpl : public InterfaceFactory<tracing::TraceProvider> {
public:
TracingImpl();