Home | History | Annotate | Download | only in spy
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef MOJO_SPY_SPY_H_
      6 #define MOJO_SPY_SPY_H_
      7 
      8 #include <string>
      9 #include "base/memory/ref_counted.h"
     10 #include "base/memory/scoped_ptr.h"
     11 
     12 namespace base {
     13 class Thread;
     14 }
     15 
     16 namespace mojo {
     17 
     18 class ApplicationManager;
     19 class SpyServerImpl;
     20 
     21 // mojo::Spy is a troubleshooting and debugging aid. It helps tracking
     22 // the mojo system core activities like messages, service creation, etc.
     23 //
     24 // The |options| parameter in the constructor comes from the command
     25 // line of the mojo_shell. Which takes --spy=<options>. Each option is
     26 // separated by ',' and each option is a key+ value pair separated by ':'.
     27 //
     28 // For example --spy=port:13333
     29 //
     30 class Spy {
     31  public:
     32   Spy(mojo::ApplicationManager* application_manager,
     33       const std::string& options);
     34   ~Spy();
     35 
     36  private:
     37   scoped_refptr<SpyServerImpl> spy_server_;
     38   // This thread runs the code that talks to the frontend.
     39   scoped_ptr<base::Thread> control_thread_;
     40 };
     41 
     42 }  // namespace mojo
     43 
     44 #endif  // MOJO_SPY_SPY_H_
     45