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

Side by Side Diff: goopdate/google_update.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 | « goopdate/elevation_moniker_resource.h ('k') | goopdate/google_update.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 2009-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 // Contains GoogleUpdate class which is the ATL exe module for the local
17 // server that allows launching of the browser at medium integrity.
18
19 #ifndef OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
20 #define OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
21
22 #include <windows.h>
23 #include <atlbase.h>
24 #include "base/scoped_ptr.h"
25 #include "goopdate/omaha3_idl.h"
26 #include "omaha/base/debug.h"
27
28 namespace omaha {
29
30 // TODO(omaha): Perhaps a better approach might be to use Adapter classes to
31 // modify behavior instead of the mode being explicitly specified here. Consider
32 // when making future changes.
33 // It might also be a good idea to rename this class and file since it is more
34 // a boilerplate for COM servers than it is related to "Google Update" or the
35 // main Omaha 3 COM server since it als handles various brokers.
36 class GoogleUpdate : public CAtlExeModuleT<GoogleUpdate> {
37 public:
38 enum ComServerMode {
39 kUpdate3Mode,
40 kBrokerMode,
41 kOnDemandMode,
42 };
43
44 DECLARE_LIBID(LIBID_GoogleUpdate3Lib)
45
46 explicit GoogleUpdate(bool is_machine, ComServerMode mode);
47 ~GoogleUpdate();
48 HRESULT RegisterClassObjects(DWORD cls_ctx, DWORD flags) throw();
49 HRESULT RevokeClassObjects() throw();
50
51 // The base ATL classes have an implicit dependency on the second parameter
52 // to RegisterServer and UnregisterServer having a default value.
53 HRESULT RegisterServer(BOOL register_tlb, const CLSID* id = NULL) throw();
54 HRESULT UnregisterServer(BOOL unregister_tlb, const CLSID* id = NULL) throw();
55 HRESULT PreMessageLoop(int show_cmd) throw();
56 HRESULT PostMessageLoop() throw();
57 HRESULT Main();
58
59 // This is cloned from CAtlExeModuleT.Lock(). The one difference is the call
60 // to ::CoAddRefServerProcess(). See the description for Unlock() below for
61 // further information.
62 virtual LONG Lock() throw() {
63 ::CoAddRefServerProcess();
64 return CComGlobalsThreadModel::Increment(&m_nLockCnt);
65 }
66
67 // This is cloned from CAtlExeModuleT.Unlock(). The big difference is the call
68 // to ::CoReleaseServerProcess(), to ensure that the class factories are
69 // suspended once the lock count drops to zero. This fixes a a race condition
70 // where an activation request could come in in the middle of shutting down.
71 // This shutdown mechanism works with free threaded servers.
72 //
73 // There are race issues with the ATL delayed shutdown mechanism, hence the
74 // associated code has been eliminated, and we have an assert to make sure
75 // m_bDelayShutdown is not set.
76 virtual LONG Unlock() throw() {
77 ASSERT1(!m_bDelayShutdown);
78
79 ::CoReleaseServerProcess();
80 LONG lRet = CComGlobalsThreadModel::Decrement(&m_nLockCnt);
81
82 if (lRet == 0) {
83 ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0);
84 }
85
86 return lRet;
87 }
88
89 private:
90 _ATL_OBJMAP_ENTRY* GetObjectMap();
91 HRESULT RegisterOrUnregisterExe(bool is_register);
92 static HRESULT RegisterOrUnregisterExe(void* data, bool is_register);
93
94 ComServerMode mode_;
95 bool is_machine_;
96
97 DISALLOW_EVIL_CONSTRUCTORS(GoogleUpdate);
98 };
99
100 } // namespace omaha
101
102 #endif // OMAHA_GOOPDATE_GOOGLE_UPDATE_H_
103
OLDNEW
« no previous file with comments | « goopdate/elevation_moniker_resource.h ('k') | goopdate/google_update.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698