OLD | NEW |
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 #include "chrome/browser/net/predictor.h" | 5 #include "chrome/browser/net/predictor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 FindSerializationMotivation(motivation, referral_list); | 99 FindSerializationMotivation(motivation, referral_list); |
100 if (!motivation_list) { | 100 if (!motivation_list) { |
101 // This is the first mention of this motivation, so build a list. | 101 // This is the first mention of this motivation, so build a list. |
102 motivation_list = new base::ListValue; | 102 motivation_list = new base::ListValue; |
103 motivation_list->AppendString(motivation.spec()); | 103 motivation_list->AppendString(motivation.spec()); |
104 // Provide empty subresource list. | 104 // Provide empty subresource list. |
105 motivation_list->Append(base::MakeUnique<base::ListValue>()); | 105 motivation_list->Append(base::MakeUnique<base::ListValue>()); |
106 | 106 |
107 // ...and make it part of the serialized referral_list. | 107 // ...and make it part of the serialized referral_list. |
108 referral_list->Append(base::WrapUnique(motivation_list)); | 108 referral_list->Append(base::WrapUnique(motivation_list)); |
109 // |motivation_list| is invalidated at this point, so it needs to be reset. | |
110 referral_list->GetList(referral_list->GetSize() - 1, &motivation_list); | |
111 } | 109 } |
112 | 110 |
113 base::ListValue* subresource_list(NULL); | 111 base::ListValue* subresource_list(NULL); |
114 // 0 == url; 1 == subresource_list. | 112 // 0 == url; 1 == subresource_list. |
115 EXPECT_TRUE(motivation_list->GetList(1, &subresource_list)); | 113 EXPECT_TRUE(motivation_list->GetList(1, &subresource_list)); |
116 | 114 |
117 // We won't bother to check for the subresource being there already. Worst | 115 // We won't bother to check for the subresource being there already. Worst |
118 // case, during deserialization, the latency value we supply plus the | 116 // case, during deserialization, the latency value we supply plus the |
119 // existing value(s) will be added to the referrer. | 117 // existing value(s) will be added to the referrer. |
120 | 118 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); | 560 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); |
563 | 561 |
564 // Proxy may not be in use (the PAC script has not yet been evaluated), so the | 562 // Proxy may not be in use (the PAC script has not yet been evaluated), so the |
565 // name has been registered for pre-resolve. | 563 // name has been registered for pre-resolve. |
566 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); | 564 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); |
567 | 565 |
568 testing_master.Shutdown(); | 566 testing_master.Shutdown(); |
569 } | 567 } |
570 | 568 |
571 } // namespace chrome_browser_net | 569 } // namespace chrome_browser_net |
OLD | NEW |