| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/debugger/devtools_netlog_observer.h" | 5 #include "chrome/browser/debugger/devtools_netlog_observer.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/io_thread.h" | 8 #include "chrome/browser/io_thread.h" |
| 9 #include "chrome/common/resource_response.h" | 9 #include "chrome/common/resource_response.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return; | 46 return; |
| 47 int load_flags = static_cast<URLRequestStartEventParameters*>(params)-> | 47 int load_flags = static_cast<URLRequestStartEventParameters*>(params)-> |
| 48 load_flags(); | 48 load_flags(); |
| 49 if (!(load_flags & net::LOAD_REPORT_RAW_HEADERS)) | 49 if (!(load_flags & net::LOAD_REPORT_RAW_HEADERS)) |
| 50 return; | 50 return; |
| 51 if (request_to_info_.size() > kMaxNumEntries) { | 51 if (request_to_info_.size() > kMaxNumEntries) { |
| 52 LOG(WARNING) << "The raw headers observer url request count has grown " | 52 LOG(WARNING) << "The raw headers observer url request count has grown " |
| 53 "larger than expected, resetting"; | 53 "larger than expected, resetting"; |
| 54 request_to_info_.clear(); | 54 request_to_info_.clear(); |
| 55 } | 55 } |
| 56 scoped_refptr<ResourceInfo> new_record = new ResourceInfo(); | 56 scoped_refptr<ResourceInfo> new_record(new ResourceInfo()); |
| 57 request_to_info_.insert(std::make_pair(source.id, new_record)); | 57 request_to_info_.insert(std::make_pair(source.id, new_record)); |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 if (type == net::NetLog::TYPE_REQUEST_ALIVE && | 60 if (type == net::NetLog::TYPE_REQUEST_ALIVE && |
| 61 phase == net::NetLog::PHASE_END) { | 61 phase == net::NetLog::PHASE_END) { |
| 62 request_to_info_.erase(source.id); | 62 request_to_info_.erase(source.id); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 if (type != net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS && | 65 if (type != net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS && |
| 66 type != net::NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS) | 66 type != net::NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 uint32 source_id = request->net_log().source().id; | 126 uint32 source_id = request->net_log().source().id; |
| 127 DevToolsNetLogObserver* dev_tools_net_log_observer = | 127 DevToolsNetLogObserver* dev_tools_net_log_observer = |
| 128 DevToolsNetLogObserver::GetInstance(); | 128 DevToolsNetLogObserver::GetInstance(); |
| 129 if (!dev_tools_net_log_observer) | 129 if (!dev_tools_net_log_observer) |
| 130 return; | 130 return; |
| 131 response->response_head.devtools_info = | 131 response->response_head.devtools_info = |
| 132 dev_tools_net_log_observer->GetResourceInfo(source_id); | 132 dev_tools_net_log_observer->GetResourceInfo(source_id); |
| 133 } | 133 } |
| OLD | NEW |