Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: core/core.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/build.scons ('k') | core/core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2007-2010 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16
17 // Core uses a reactor design pattern to register event handlers for kernel
18 // events, demultiplex them, and transfer control to the respective event
19 // handlers.
20
21 #ifndef OMAHA_CORE_CORE_H_
22 #define OMAHA_CORE_CORE_H_
23
24 #include <atlbase.h>
25 #include <atlsecurity.h>
26 #include <atlstr.h>
27 #include <string>
28 #include "base/basictypes.h"
29 #include "base/scoped_ptr.h"
30 #include "omaha/base/scoped_any.h"
31 #include "omaha/base/shutdown_callback.h"
32 #include "omaha/core/google_update_core.h"
33 #include "omaha/core/system_monitor.h"
34 #include "omaha/goopdate/google_update3.h"
35
36 namespace omaha {
37
38 class Reactor;
39 class Scheduler;
40 class ShutdownHandler;
41
42 // To support hosting ATL COM objects, Core derives from CAtlExeModuleT. Other
43 // than the ATL module count, no functionality of CAtlExeModuleT is used.
44 class Core
45 : public ShutdownCallback,
46 public SystemMonitorObserver,
47 public CAtlExeModuleT<Core> {
48 public:
49 Core();
50 virtual ~Core();
51
52 // Executes the instance entry point with given parameters.
53 HRESULT Main(bool is_system, bool is_crash_handler_enabled);
54
55 // Starts an update worker process if the Core is meant to run all the time.
56 // If not, causes the Core to exit the process.
57 HRESULT StartUpdateWorker() const;
58
59 // Starts a code red process.
60 HRESULT StartCodeRed() const;
61
62 // Starts the crash handler.
63 HRESULT StartCrashHandler() const;
64
65 // Aggregates the core metrics.
66 void AggregateMetrics() const;
67
68 Reactor* reactor() const { return reactor_.get(); }
69 bool is_system() const { return is_system_; }
70
71 virtual LONG Unlock() throw() {
72 // We are long-running independent of the ATL module count, therefore
73 // transition to zero does not by itself unload the process.
74 return CAtlModuleT<Core>::Unlock();
75 }
76
77 private:
78
79 HRESULT DoMain(bool is_system, bool is_crash_handler_enabled);
80
81 // Starts an update worker process.
82 HRESULT StartUpdateWorkerInternal() const;
83
84 bool AreScheduledTasksHealthy() const;
85 bool IsServiceHealthy() const;
86 bool IsCheckingForUpdates() const;
87 bool ShouldRunForever() const;
88
89 // ShutdownCallback interface.
90 // Signals the core to stop handling events and exit.
91 virtual HRESULT Shutdown();
92 virtual HRESULT ShutdownInternal() const;
93
94 // SystemMonitorObserver interface.
95 virtual void LastCheckedDeleted();
96 virtual void NoRegisteredClients();
97
98 HRESULT DoRun();
99 HRESULT DoHandleEvents();
100
101 // Collects ambient core metrics.
102 void CollectMetrics()const;
103
104 bool is_system_;
105
106 // True if the core has to kickoff the crash handler.
107 bool is_crash_handler_enabled_;
108
109 DWORD main_thread_id_; // The id of the thread that runs Core::Main.
110
111 scoped_ptr<Reactor> reactor_;
112 scoped_ptr<ShutdownHandler> shutdown_handler_;
113 scoped_ptr<Scheduler> scheduler_;
114 scoped_ptr<SystemMonitor> system_monitor_;
115
116 friend class CoreUtilsTest;
117
118 DISALLOW_EVIL_CONSTRUCTORS(Core);
119 };
120
121 } // namespace omaha
122
123 #endif // OMAHA_CORE_CORE_H_
OLDNEW
« no previous file with comments | « core/build.scons ('k') | core/core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698