Home | History | Annotate | Download | only in net
      1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_
      6 #define CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_
      7 #pragma once
      8 
      9 namespace net {
     10 class URLRequest;
     11 }  // namespace net
     12 
     13 namespace chrome_browser_net {
     14 
     15 // Sets the given ID on the given request for later retrieval. This information
     16 // duplicates a field in the ResourceDispatcherHost's user data, but is also
     17 // set for non-ResourceDispatcher-related requests. Having this one global
     18 // place allows us to do more general things, such as assigning traffic for the
     19 // network view in the task manager.
     20 //
     21 // If you make a request on behalf of a child process other than a renderer,
     22 // please call this function to store its PID (NOT its browser-assigned unique
     23 // child ID).  For requests originating in a renderer or the browser itself,
     24 // set a PID of zero (the default).
     25 //
     26 // TODO(wez): Get rid of the zero-PID hack & enforce that one is always set.
     27 void SetOriginPIDForRequest(int pid, net::URLRequest* request);
     28 
     29 // Returns the process ID of the request's originator, previously stored with
     30 // SetOriginProcessIDForRequest, or zero if no PID has been set.  A PID of zero
     31 // should be interpreted as meaning the request originated from a renderer
     32 // process, or within the browser itself.
     33 int GetOriginPIDForRequest(const net::URLRequest* request);
     34 
     35 }  // namespace chrome_browser_net
     36 
     37 #endif  // CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_
     38