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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h>
10
9 #include <algorithm> 11 #include <algorithm>
10 #include <set> 12 #include <set>
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/bind.h" 15 #include "base/bind.h"
14 #include "base/bind_helpers.h" 16 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 17 #include "base/command_line.h"
16 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
17 #include "base/debug/alias.h" 19 #include "base/debug/alias.h"
18 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/macros.h"
19 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/shared_memory.h" 23 #include "base/memory/shared_memory.h"
21 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
22 #include "base/metrics/field_trial.h" 25 #include "base/metrics/field_trial.h"
23 #include "base/metrics/histogram_macros.h" 26 #include "base/metrics/histogram_macros.h"
24 #include "base/metrics/sparse_histogram.h" 27 #include "base/metrics/sparse_histogram.h"
25 #include "base/profiler/scoped_tracker.h" 28 #include "base/profiler/scoped_tracker.h"
26 #include "base/stl_util.h" 29 #include "base/stl_util.h"
27 #include "base/strings/string_util.h" 30 #include "base/strings/string_util.h"
28 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 31 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 scoped_ptr<net::URLRequest> request, 643 scoped_ptr<net::URLRequest> request,
641 const Referrer& referrer, 644 const Referrer& referrer,
642 bool is_content_initiated, 645 bool is_content_initiated,
643 ResourceContext* context, 646 ResourceContext* context,
644 int child_id, 647 int child_id,
645 int render_view_route_id, 648 int render_view_route_id,
646 int render_frame_route_id, 649 int render_frame_route_id,
647 bool prefer_cache, 650 bool prefer_cache,
648 bool do_not_prompt_for_login, 651 bool do_not_prompt_for_login,
649 scoped_ptr<DownloadSaveInfo> save_info, 652 scoped_ptr<DownloadSaveInfo> save_info,
650 uint32 download_id, 653 uint32_t download_id,
651 const DownloadStartedCallback& started_callback) { 654 const DownloadStartedCallback& started_callback) {
652 if (is_shutdown_) 655 if (is_shutdown_)
653 return CallbackAndReturn(started_callback, 656 return CallbackAndReturn(started_callback,
654 DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN); 657 DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN);
655 658
656 const GURL& url = request->original_url(); 659 const GURL& url = request->original_url();
657 660
658 // http://crbug.com/90971 661 // http://crbug.com/90971
659 char url_buf[128]; 662 char url_buf[128];
660 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); 663 base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 FROM_HERE, 751 FROM_HERE,
749 base::Bind(&ResourceDispatcherHostImpl::OnShutdown, 752 base::Bind(&ResourceDispatcherHostImpl::OnShutdown,
750 base::Unretained(this))); 753 base::Unretained(this)));
751 } 754 }
752 755
753 scoped_ptr<ResourceHandler> 756 scoped_ptr<ResourceHandler>
754 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( 757 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload(
755 net::URLRequest* request, 758 net::URLRequest* request,
756 bool is_content_initiated, 759 bool is_content_initiated,
757 bool must_download, 760 bool must_download,
758 uint32 id, 761 uint32_t id,
759 scoped_ptr<DownloadSaveInfo> save_info, 762 scoped_ptr<DownloadSaveInfo> save_info,
760 const DownloadUrlParameters::OnStartedCallback& started_cb) { 763 const DownloadUrlParameters::OnStartedCallback& started_cb) {
761 scoped_ptr<ResourceHandler> handler( 764 scoped_ptr<ResourceHandler> handler(
762 new DownloadResourceHandler(id, request, started_cb, save_info.Pass())); 765 new DownloadResourceHandler(id, request, started_cb, save_info.Pass()));
763 if (delegate_) { 766 if (delegate_) {
764 const ResourceRequestInfoImpl* request_info( 767 const ResourceRequestInfoImpl* request_info(
765 ResourceRequestInfoImpl::ForRequest(request)); 768 ResourceRequestInfoImpl::ForRequest(request));
766 769
767 ScopedVector<ResourceThrottle> throttles; 770 ScopedVector<ResourceThrottle> throttles;
768 delegate_->DownloadStarting( 771 delegate_->DownloadStarting(
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 2312
2310 return loader->request(); 2313 return loader->request();
2311 } 2314 }
2312 2315
2313 // static 2316 // static
2314 bool ResourceDispatcherHostImpl::LoadInfoIsMoreInteresting(const LoadInfo& a, 2317 bool ResourceDispatcherHostImpl::LoadInfoIsMoreInteresting(const LoadInfo& a,
2315 const LoadInfo& b) { 2318 const LoadInfo& b) {
2316 // Set |*_uploading_size| to be the size of the corresponding upload body if 2319 // Set |*_uploading_size| to be the size of the corresponding upload body if
2317 // it's currently being uploaded. 2320 // it's currently being uploaded.
2318 2321
2319 uint64 a_uploading_size = 0; 2322 uint64_t a_uploading_size = 0;
2320 if (a.load_state.state == net::LOAD_STATE_SENDING_REQUEST) 2323 if (a.load_state.state == net::LOAD_STATE_SENDING_REQUEST)
2321 a_uploading_size = a.upload_size; 2324 a_uploading_size = a.upload_size;
2322 2325
2323 uint64 b_uploading_size = 0; 2326 uint64_t b_uploading_size = 0;
2324 if (b.load_state.state == net::LOAD_STATE_SENDING_REQUEST) 2327 if (b.load_state.state == net::LOAD_STATE_SENDING_REQUEST)
2325 b_uploading_size = b.upload_size; 2328 b_uploading_size = b.upload_size;
2326 2329
2327 if (a_uploading_size != b_uploading_size) 2330 if (a_uploading_size != b_uploading_size)
2328 return a_uploading_size > b_uploading_size; 2331 return a_uploading_size > b_uploading_size;
2329 2332
2330 return a.load_state.state > b.load_state.state; 2333 return a.load_state.state > b.load_state.state;
2331 } 2334 }
2332 2335
2333 // static 2336 // static
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 load_flags |= net::LOAD_PREFETCH; 2535 load_flags |= net::LOAD_PREFETCH;
2533 } 2536 }
2534 2537
2535 if (is_sync_load) 2538 if (is_sync_load)
2536 load_flags |= net::LOAD_IGNORE_LIMITS; 2539 load_flags |= net::LOAD_IGNORE_LIMITS;
2537 2540
2538 return load_flags; 2541 return load_flags;
2539 } 2542 }
2540 2543
2541 } // namespace content 2544 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698