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

Side by Side Diff: net/bits_job_callback.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 | « net/bits_job_callback.h ('k') | net/bits_request.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/net/bits_job_callback.h"
17 #include "omaha/base/debug.h"
18 #include "omaha/base/error.h"
19 #include "omaha/base/logging.h"
20 #include "omaha/base/utils.h"
21 #include "omaha/net/bits_request.h"
22 #include "omaha/net/bits_utils.h"
23
24 namespace omaha {
25
26 HRESULT BitsJobCallback::Create(BitsRequest* bits_request,
27 BitsJobCallback** bits_job_callback) {
28 ASSERT1(bits_request);
29 ASSERT1(bits_job_callback);
30
31 *bits_job_callback = NULL;
32 scoped_ptr<CComObjectNoLock<BitsJobCallback> > callback_obj(
33 new CComObjectNoLock<BitsJobCallback>);
34 if (callback_obj == NULL) {
35 return E_OUTOFMEMORY;
36 }
37
38 callback_obj->AddRef();
39 callback_obj->bits_request_ = bits_request;
40 *bits_job_callback = callback_obj.release();
41
42 return S_OK;
43 }
44
45 void BitsJobCallback::RemoveReferenceToBitsRequest() {
46 __mutexScope(lock_);
47 bits_request_ = NULL;
48 }
49
50 HRESULT BitsJobCallback::JobTransferred(IBackgroundCopyJob* bits_job) {
51 UNREFERENCED_PARAMETER(bits_job);
52
53 __mutexScope(lock_);
54 if (bits_request_) {
55 bits_request_->OnBitsJobStateChanged();
56 }
57
58 // Returns S_OK to avoid BITS continuing to call this callback.
59 return S_OK;
60 }
61
62 HRESULT BitsJobCallback::JobError(IBackgroundCopyJob* bits_job,
63 IBackgroundCopyError* error) {
64 UNREFERENCED_PARAMETER(bits_job);
65 UNREFERENCED_PARAMETER(error);
66
67 __mutexScope(lock_);
68 if (bits_request_) {
69 bits_request_->OnBitsJobStateChanged();
70 }
71
72 // Returns S_OK to avoid BITS continuing to call this callback.
73 return S_OK;
74 }
75
76 HRESULT BitsJobCallback::JobModification(IBackgroundCopyJob* bits_job,
77 DWORD reserved) {
78 ASSERT1(bits_job);
79 UNREFERENCED_PARAMETER(bits_job);
80 UNREFERENCED_PARAMETER(reserved);
81
82 __mutexScope(lock_);
83 if (bits_request_) {
84 bits_request_->OnBitsJobStateChanged();
85 }
86 return S_OK;
87 }
88
89 } // namespace omaha
90
OLDNEW
« no previous file with comments | « net/bits_job_callback.h ('k') | net/bits_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698