OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/fetchers/image_resource_fetcher.h" | 5 #include "content/renderer/fetchers/image_resource_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "content/child/image_decoder.h" | 10 #include "content/child/image_decoder.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 WebURLRequest::RequestContext request_context, | 28 WebURLRequest::RequestContext request_context, |
29 const Callback& callback) | 29 const Callback& callback) |
30 : callback_(callback), | 30 : callback_(callback), |
31 id_(id), | 31 id_(id), |
32 image_url_(image_url), | 32 image_url_(image_url), |
33 image_size_(image_size) { | 33 image_size_(image_size) { |
34 fetcher_.reset(ResourceFetcher::Create(image_url)); | 34 fetcher_.reset(ResourceFetcher::Create(image_url)); |
35 fetcher_->Start(frame, | 35 fetcher_->Start(frame, |
36 request_context, | 36 request_context, |
37 WebURLRequest::FrameTypeNone, | 37 WebURLRequest::FrameTypeNone, |
| 38 ResourceFetcher::PLATFORM_LOADER, |
38 base::Bind(&ImageResourceFetcher::OnURLFetchComplete, | 39 base::Bind(&ImageResourceFetcher::OnURLFetchComplete, |
39 base::Unretained(this))); | 40 base::Unretained(this))); |
40 | 41 |
41 // Set subresource URL for crash reporting. | 42 // Set subresource URL for crash reporting. |
42 base::debug::SetCrashKeyValue("subresource_url", image_url.spec()); | 43 base::debug::SetCrashKeyValue("subresource_url", image_url.spec()); |
43 } | 44 } |
44 | 45 |
45 ImageResourceFetcher::~ImageResourceFetcher() { | 46 ImageResourceFetcher::~ImageResourceFetcher() { |
46 } | 47 } |
47 | 48 |
(...skipping 11 matching lines...) Expand all Loading... |
59 // response as an image. The delegate will see a null image, indicating | 60 // response as an image. The delegate will see a null image, indicating |
60 // that an error occurred. | 61 // that an error occurred. |
61 | 62 |
62 // Take a reference to the callback as running the callback may lead to our | 63 // Take a reference to the callback as running the callback may lead to our |
63 // destruction. | 64 // destruction. |
64 Callback callback = callback_; | 65 Callback callback = callback_; |
65 callback.Run(this, bitmap); | 66 callback.Run(this, bitmap); |
66 } | 67 } |
67 | 68 |
68 } // namespace content | 69 } // namespace content |
OLD | NEW |