| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2016 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_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_ | 
|  | 6 #define MOJO_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_ | 
|  | 7 | 
|  | 8 #include "base/at_exit.h" | 
|  | 9 #include "base/macros.h" | 
|  | 10 | 
|  | 11 namespace mojo { | 
|  | 12 | 
|  | 13 // Using code from //base typically requires that a number of things be | 
|  | 14 // initialized/present. In particular the global |base::CommandLine| singleton | 
|  | 15 // should be initialized and an |AtExitManager| should be present. | 
|  | 16 // | 
|  | 17 // This class is a simple helper that does these things (and tears down the | 
|  | 18 // |AtExitManager| on destruction). Typically, it should be used in |MojoMain()| | 
|  | 19 // as follows: | 
|  | 20 // | 
|  | 21 //   MojoResult MojoMain(MojoHandle application_request) { | 
|  | 22 //     mojo::ScopedBaseInit init; | 
|  | 23 //     ... | 
|  | 24 //   } | 
|  | 25 // | 
|  | 26 // TODO(vtl): Maybe this should be called |ScopedBaseInit|, but for now I'm | 
|  | 27 // being consistent with everything else that refers to things that use //base | 
|  | 28 // as "chromium". | 
|  | 29 class ScopedChromiumInit { | 
|  | 30  public: | 
|  | 31   ScopedChromiumInit(); | 
|  | 32   ~ScopedChromiumInit(); | 
|  | 33 | 
|  | 34  private: | 
|  | 35   base::AtExitManager at_exit_manager_; | 
|  | 36 | 
|  | 37   DISALLOW_COPY_AND_ASSIGN(ScopedChromiumInit); | 
|  | 38 }; | 
|  | 39 | 
|  | 40 }  // namespace mojo | 
|  | 41 | 
|  | 42 #endif  // MOJO_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_ | 
| OLD | NEW | 
|---|