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

Side by Side Diff: goopdate/app_bundle_state_busy.cc

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/app_bundle_state_busy.h ('k') | goopdate/app_bundle_state_init.h » ('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 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 #include "omaha/goopdate/app_bundle_state_busy.h"
17 #include "omaha/base/debug.h"
18 #include "omaha/base/error.h"
19 #include "omaha/base/logging.h"
20 #include "omaha/goopdate/app_bundle_state_paused.h"
21 #include "omaha/goopdate/app_bundle_state_ready.h"
22 #include "omaha/goopdate/app_bundle_state_stopped.h"
23 #include "omaha/goopdate/model.h"
24
25 namespace omaha {
26
27 namespace fsm {
28
29 HRESULT AppBundleStateBusy::Pause(AppBundle* app_bundle) {
30 CORE_LOG(L3, (_T("[AppBundleStateBusy::Pause][0x%p]"), app_bundle));
31 ASSERT1(app_bundle);
32 ASSERT1(app_bundle->model()->IsLockedByCaller());
33 ASSERT1(IsPendingNonBlockingCall(app_bundle));
34
35 HRESULT hr = app_bundle->model()->Pause(app_bundle);
36 if (FAILED(hr)) {
37 CORE_LOG(LE, (_T("[Pause failed][0x%08x][0x%p]"), hr, app_bundle));
38 return hr;
39 }
40
41 ChangeState(app_bundle, new AppBundleStatePaused);
42 return S_OK;
43 }
44
45 HRESULT AppBundleStateBusy::Stop(AppBundle* app_bundle) {
46 CORE_LOG(L3, (_T("[AppBundleStateBusy::Stop][0x%p]"), app_bundle));
47 ASSERT1(app_bundle);
48 ASSERT1(app_bundle->model()->IsLockedByCaller());
49 ASSERT1(IsPendingNonBlockingCall(app_bundle));
50
51 HRESULT hr = app_bundle->model()->Stop(app_bundle);
52 if (FAILED(hr)) {
53 CORE_LOG(LE, (_T("[Stop failed][0x%08x][0x%p]"), hr, app_bundle));
54 return hr;
55 }
56
57 // Handling Stop is non-blocking. The worker completes the pending bundle
58 // calls while the bundle remains in the stopped state.
59 ChangeState(app_bundle, new AppBundleStateStopped);
60 return S_OK;
61 }
62
63 HRESULT AppBundleStateBusy::CompleteAsyncCall(AppBundle* app_bundle) {
64 CORE_LOG(L3, (_T("[AppBundleStateBusy::CompleteAsyncCall][0x%p]"),
65 app_bundle));
66 ASSERT1(IsPendingNonBlockingCall(app_bundle));
67 ChangeState(app_bundle, new AppBundleStateReady);
68 return S_OK;
69 }
70
71 HRESULT AppBundleStateBusy::Download(AppBundle* app_bundle) {
72 UNREFERENCED_PARAMETER(app_bundle);
73 ASSERT1(IsPendingNonBlockingCall(app_bundle));
74 return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
75 }
76
77 HRESULT AppBundleStateBusy::Install(AppBundle* app_bundle) {
78 UNREFERENCED_PARAMETER(app_bundle);
79 ASSERT1(IsPendingNonBlockingCall(app_bundle));
80 return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
81 }
82
83 HRESULT AppBundleStateBusy::DownloadPackage(AppBundle* app_bundle,
84 const CString& app_id,
85 const CString& package_name) {
86 UNREFERENCED_PARAMETER(app_bundle);
87 UNREFERENCED_PARAMETER(app_id);
88 UNREFERENCED_PARAMETER(package_name);
89 ASSERT1(IsPendingNonBlockingCall(app_bundle));
90 return GOOPDATE_E_NON_BLOCKING_CALL_PENDING;
91 }
92
93 bool AppBundleStateBusy::IsBusy() const {
94 return true;
95 }
96
97 } // namespace fsm
98
99 } // namespace omaha
OLDNEW
« no previous file with comments | « goopdate/app_bundle_state_busy.h ('k') | goopdate/app_bundle_state_init.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698