summaryrefslogtreecommitdiffstats
path: root/mojo/shell
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-07 22:04:42 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-07 22:04:42 +0000
commite2682416232911ea031f922ad63674a7a999a6dd (patch)
treef94ea6c31f9d529a9c83c76c6045531959654cbb /mojo/shell
parent2ddd5657a5f1b693cd0b65bc21cd220083647d62 (diff)
downloadchromium_src-e2682416232911ea031f922ad63674a7a999a6dd.zip
chromium_src-e2682416232911ea031f922ad63674a7a999a6dd.tar.gz
chromium_src-e2682416232911ea031f922ad63674a7a999a6dd.tar.bz2
Mojo Spy core first CL. Introduces mojo::Spy files
Currently only the most basic interception of message pipes. See design document: https://docs.google.com/a/chromium.org/document/d/11FKYXf9mSohlsgl4JmGlyWE1ScX3DKdssdjub63tkwA/edit#heading=h.fi6hmvi95gtz BUG=360188 TEST=none Review URL: https://codereview.chromium.org/225203002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262209 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r--mojo/shell/context.cc11
-rw-r--r--mojo/shell/context.h4
-rw-r--r--mojo/shell/switches.cc3
-rw-r--r--mojo/shell/switches.h2
4 files changed, 17 insertions, 3 deletions
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index 3a000ce..d6bfb4b 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -12,6 +12,7 @@
#include "mojo/shell/network_delegate.h"
#include "mojo/shell/out_of_process_dynamic_service_runner.h"
#include "mojo/shell/switches.h"
+#include "mojo/spy/spy.h"
namespace mojo {
namespace shell {
@@ -27,15 +28,21 @@ Context::Context()
embedder::Init();
gles2::GLES2SupportImpl::Init();
+ CommandLine* cmdline = CommandLine::ForCurrentProcess();
scoped_ptr<DynamicServiceRunnerFactory> runner_factory;
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableMultiprocess))
+ if (cmdline->HasSwitch(switches::kEnableMultiprocess))
runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory());
else
runner_factory.reset(new InProcessDynamicServiceRunnerFactory());
+
dynamic_service_loader_.reset(
new DynamicServiceLoader(this, runner_factory.Pass()));
service_manager_.set_default_loader(dynamic_service_loader_.get());
+
+ if (cmdline->HasSwitch(switches::kSpy)) {
+ spy_.reset(new mojo::Spy(&service_manager_,
+ cmdline->GetSwitchValueASCII(switches::kSpy)));
+ }
}
Context::~Context() {
diff --git a/mojo/shell/context.h b/mojo/shell/context.h
index 3034eb7..28f1f69 100644
--- a/mojo/shell/context.h
+++ b/mojo/shell/context.h
@@ -16,6 +16,9 @@
#endif // defined(OS_ANDROID)
namespace mojo {
+
+class Spy;
+
namespace shell {
class DynamicServiceLoader;
@@ -43,6 +46,7 @@ class Context {
Loader loader_;
ServiceManager service_manager_;
scoped_ptr<DynamicServiceLoader> dynamic_service_loader_;
+ scoped_ptr<Spy> spy_;
#if defined(OS_ANDROID)
base::android::ScopedJavaGlobalRef<jobject> activity_;
diff --git a/mojo/shell/switches.cc b/mojo/shell/switches.cc
index 09429e2..34ed754 100644
--- a/mojo/shell/switches.cc
+++ b/mojo/shell/switches.cc
@@ -20,5 +20,8 @@ const char kDisableCache[] = "disable-cache";
const char kEnableMultiprocess[] = "enable-multiprocess";
const char kOrigin[] = "origin";
+// Enables the mojo spy, which acts as a man-in-the-middle inspector for
+// message pipes and other activities. This is work in progress.
+const char kSpy[] = "spy";
} // namespace switches
diff --git a/mojo/shell/switches.h b/mojo/shell/switches.h
index c0e78b8..a1d4ac5 100644
--- a/mojo/shell/switches.h
+++ b/mojo/shell/switches.h
@@ -13,7 +13,7 @@ extern const char kChildProcessType[];
extern const char kDisableCache[];
extern const char kEnableMultiprocess[];
extern const char kOrigin[];
-
+extern const char kSpy[];
} // namespace switches
#endif // MOJO_SHELL_SWITCHES_H_