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

Side by Side Diff: net/url_request/url_request.h

Issue 42541: Prioritize which HTTP requests get a socket first by adding a priority level ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_request_info.h ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_
6 #define NET_URL_REQUEST_URL_REQUEST_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h"
11 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 #include "net/base/load_states.h" 14 #include "net/base/load_states.h"
14 #include "net/http/http_response_info.h" 15 #include "net/http/http_response_info.h"
15 #include "net/url_request/url_request_status.h" 16 #include "net/url_request/url_request_status.h"
16 17
17 namespace base { 18 namespace base {
18 class Time; 19 class Time;
19 } 20 } // namespace base
20 21
21 namespace net { 22 namespace net {
22
23 class IOBuffer; 23 class IOBuffer;
24 class UploadData; 24 class UploadData;
25 class X509Certificate; 25 class X509Certificate;
26 26 } // namespace net
27 }
28 27
29 class URLRequestContext; 28 class URLRequestContext;
30 class URLRequestJob; 29 class URLRequestJob;
31 30
32 // This stores the values of the Set-Cookie headers received during the request. 31 // This stores the values of the Set-Cookie headers received during the request.
33 // Each item in the vector corresponds to a Set-Cookie: line received, 32 // Each item in the vector corresponds to a Set-Cookie: line received,
34 // excluding the "Set-Cookie:" part. 33 // excluding the "Set-Cookie:" part.
35 typedef std::vector<std::string> ResponseCookies; 34 typedef std::vector<std::string> ResponseCookies;
36 35
37 //----------------------------------------------------------------------------- 36 //-----------------------------------------------------------------------------
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 423
425 void set_enable_profiling(bool profiling) { enable_profiling_ = profiling; } 424 void set_enable_profiling(bool profiling) { enable_profiling_ = profiling; }
426 425
427 // Used to specify the context (cookie store, cache) for this request. 426 // Used to specify the context (cookie store, cache) for this request.
428 URLRequestContext* context(); 427 URLRequestContext* context();
429 void set_context(URLRequestContext* context); 428 void set_context(URLRequestContext* context);
430 429
431 // Returns the expected content size if available 430 // Returns the expected content size if available
432 int64 GetExpectedContentSize() const; 431 int64 GetExpectedContentSize() const;
433 432
433 // Returns the priority level for this request. A larger value indicates
434 // higher priority. Negative values are not used.
435 int priority() const { return priority_; }
436 void set_priority(int priority) {
437 DCHECK_GE(priority, 0);
438 priority_ = priority;
439 }
440
434 protected: 441 protected:
435 // Allow the URLRequestJob class to control the is_pending() flag. 442 // Allow the URLRequestJob class to control the is_pending() flag.
436 void set_is_pending(bool value) { is_pending_ = value; } 443 void set_is_pending(bool value) { is_pending_ = value; }
437 444
438 // Allow the URLRequestJob class to set our status too 445 // Allow the URLRequestJob class to set our status too
439 void set_status(const URLRequestStatus &value) { status_ = value; } 446 void set_status(const URLRequestStatus& value) { status_ = value; }
440 447
441 // Allow the URLRequestJob to redirect this request. Returns net::OK if 448 // Allow the URLRequestJob to redirect this request. Returns net::OK if
442 // successful, otherwise an error code is returned. 449 // successful, otherwise an error code is returned.
443 int Redirect(const GURL& location, int http_status_code); 450 int Redirect(const GURL& location, int http_status_code);
444 451
445 private: 452 private:
446 friend class URLRequestJob; 453 friend class URLRequestJob;
447 454
448 // Detaches the job from this request in preparation for this object going 455 // Detaches the job from this request in preparation for this object going
449 // away or the job being replaced. The job will not call us back when it has 456 // away or the job being replaced. The job will not call us back when it has
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // infinite redirects. 505 // infinite redirects.
499 int redirect_limit_; 506 int redirect_limit_;
500 507
501 // Contextual information used for this request (can be NULL). 508 // Contextual information used for this request (can be NULL).
502 scoped_refptr<URLRequestContext> context_; 509 scoped_refptr<URLRequestContext> context_;
503 510
504 // Cached value for use after we've orphaned the job handling the 511 // Cached value for use after we've orphaned the job handling the
505 // first transaction in a request involving redirects. 512 // first transaction in a request involving redirects.
506 uint64 final_upload_progress_; 513 uint64 final_upload_progress_;
507 514
515 // The priority level for this request. Objects like ClientSocketPool use
516 // this to determine which URLRequest to allocate sockets to first.
517 int priority_;
518
508 DISALLOW_COPY_AND_ASSIGN(URLRequest); 519 DISALLOW_COPY_AND_ASSIGN(URLRequest);
509 }; 520 };
510 521
511 //----------------------------------------------------------------------------- 522 //-----------------------------------------------------------------------------
512 // To help ensure that all requests are cleaned up properly, we keep static 523 // To help ensure that all requests are cleaned up properly, we keep static
513 // counters of live objects. TODO(darin): Move this leak checking stuff into 524 // counters of live objects. TODO(darin): Move this leak checking stuff into
514 // a common place and generalize it so it can be used everywhere (Bug 566229). 525 // a common place and generalize it so it can be used everywhere (Bug 566229).
515 526
516 #ifndef NDEBUG 527 #ifndef NDEBUG
517 528
518 struct URLRequestMetrics { 529 struct URLRequestMetrics {
519 int object_count; 530 int object_count;
520 URLRequestMetrics() : object_count(0) {} 531 URLRequestMetrics() : object_count(0) {}
521 ~URLRequestMetrics(); 532 ~URLRequestMetrics();
522 }; 533 };
523 534
524 extern URLRequestMetrics url_request_metrics; 535 extern URLRequestMetrics url_request_metrics;
525 536
526 #define URLREQUEST_COUNT_CTOR() url_request_metrics.object_count++ 537 #define URLREQUEST_COUNT_CTOR() url_request_metrics.object_count++
527 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- 538 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count--
528 539
529 #else // disable leak checking in release builds... 540 #else // disable leak checking in release builds...
530 541
531 #define URLREQUEST_COUNT_CTOR() 542 #define URLREQUEST_COUNT_CTOR()
532 #define URLREQUEST_COUNT_DTOR() 543 #define URLREQUEST_COUNT_DTOR()
533 544
534 #endif // #ifndef NDEBUG 545 #endif // #ifndef NDEBUG
535 546
536 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 547 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW
« no previous file with comments | « net/http/http_request_info.h ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698