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

Side by Side Diff: chrome/browser/extensions/chrome_url_request_util.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/chrome_url_request_util.h" 5 #include "chrome/browser/extensions/chrome_url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 63 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
64 *data = rb.LoadDataResourceBytes(resource_id_); 64 *data = rb.LoadDataResourceBytes(resource_id_);
65 65
66 // Add the Content-Length header now that we know the resource length. 66 // Add the Content-Length header now that we know the resource length.
67 response_info_.headers->AddHeader( 67 response_info_.headers->AddHeader(
68 base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength, 68 base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength,
69 base::SizeTToString((*data)->size()).c_str())); 69 base::SizeTToString((*data)->size()).c_str()));
70 70
71 std::string* read_mime_type = new std::string; 71 std::string* read_mime_type = new std::string;
72 base::PostTaskWithTraitsAndReplyWithResult( 72 base::PostTaskWithTraitsAndReplyWithResult(
73 FROM_HERE, base::TaskTraits().MayBlock(), 73 FROM_HERE, {base::MayBlock()},
74 base::Bind(&net::GetMimeTypeFromFile, filename_, 74 base::Bind(&net::GetMimeTypeFromFile, filename_,
75 base::Unretained(read_mime_type)), 75 base::Unretained(read_mime_type)),
76 base::Bind(&URLRequestResourceBundleJob::OnMimeTypeRead, 76 base::Bind(&URLRequestResourceBundleJob::OnMimeTypeRead,
77 weak_factory_.GetWeakPtr(), mime_type, charset, *data, 77 weak_factory_.GetWeakPtr(), mime_type, charset, *data,
78 base::Owned(read_mime_type), callback)); 78 base::Owned(read_mime_type), callback));
79 79
80 return net::ERR_IO_PENDING; 80 return net::ERR_IO_PENDING;
81 } 81 }
82 82
83 void GetResponseInfo(net::HttpResponseInfo* info) override { 83 void GetResponseInfo(net::HttpResponseInfo* info) override {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 resource_id, 176 resource_id,
177 content_security_policy, 177 content_security_policy,
178 send_cors_header); 178 send_cors_header);
179 } 179 }
180 } 180 }
181 return NULL; 181 return NULL;
182 } 182 }
183 183
184 } // namespace chrome_url_request_util 184 } // namespace chrome_url_request_util
185 } // namespace extensions 185 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698