OLD | NEW |
| (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_paused.h" | |
17 #include "omaha/base/debug.h" | |
18 #include "omaha/base/logging.h" | |
19 #include "omaha/goopdate/app_bundle_state_busy.h" | |
20 #include "omaha/goopdate/app_bundle_state_ready.h" | |
21 #include "omaha/goopdate/model.h" | |
22 | |
23 namespace omaha { | |
24 | |
25 namespace fsm { | |
26 | |
27 // Remains in this state since the bundle is already paused. | |
28 HRESULT AppBundleStatePaused::Pause(AppBundle* app_bundle) { | |
29 CORE_LOG(L3, (_T("[AppBundleStatePaused::Pause][0x%p]"), app_bundle)); | |
30 UNREFERENCED_PARAMETER(app_bundle); | |
31 return S_OK; | |
32 } | |
33 | |
34 HRESULT AppBundleStatePaused::Resume(AppBundle* app_bundle) { | |
35 CORE_LOG(L3, (_T("[AppBundleStatePaused::Resume][0x%p]"), app_bundle)); | |
36 ASSERT1(app_bundle); | |
37 ASSERT1(app_bundle->model()->IsLockedByCaller()); | |
38 | |
39 HRESULT hr = app_bundle->model()->Resume(app_bundle); | |
40 if (FAILED(hr)) { | |
41 CORE_LOG(LE, (_T("[Resume failed][0x%08x][0x%p]"), hr, app_bundle)); | |
42 return hr; | |
43 } | |
44 | |
45 if (is_async_call_complete_) { | |
46 ChangeState(app_bundle, new AppBundleStateReady); | |
47 } else { | |
48 ChangeState(app_bundle, new AppBundleStateBusy); | |
49 } | |
50 return S_OK; | |
51 } | |
52 | |
53 HRESULT AppBundleStatePaused::CompleteAsyncCall(AppBundle* app_bundle) { | |
54 CORE_LOG(L3, (_T("[AppBundleStatePaused::CompleteAsyncCall][0x%p]"), | |
55 app_bundle)); | |
56 ASSERT1(app_bundle); | |
57 ASSERT1(app_bundle->model()->IsLockedByCaller()); | |
58 ASSERT1(IsPendingNonBlockingCall(app_bundle)); | |
59 UNREFERENCED_PARAMETER(app_bundle); | |
60 is_async_call_complete_ = true; | |
61 return S_OK; | |
62 } | |
63 | |
64 } // namespace fsm | |
65 | |
66 } // namespace omaha | |
OLD | NEW |