| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/ukm/ukm_service.h" | 5 #include "components/ukm/ukm_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 return; | 357 return; |
| 358 } | 358 } |
| 359 if (sources_.size() >= kMaxSources) { | 359 if (sources_.size() >= kMaxSources) { |
| 360 RecordDroppedSource(DroppedDataReason::MAX_HIT); | 360 RecordDroppedSource(DroppedDataReason::MAX_HIT); |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 | 363 |
| 364 sources_.push_back(std::move(source)); | 364 sources_.push_back(std::move(source)); |
| 365 } | 365 } |
| 366 | 366 |
| 367 // static |
| 368 int32_t UkmService::GetNewSourceID() { |
| 369 static int32_t next_source_id = 0; |
| 370 return next_source_id++; |
| 371 } |
| 372 |
| 367 std::unique_ptr<UkmEntryBuilder> UkmService::GetEntryBuilder( | 373 std::unique_ptr<UkmEntryBuilder> UkmService::GetEntryBuilder( |
| 368 int32_t source_id, | 374 int32_t source_id, |
| 369 const char* event_name) { | 375 const char* event_name) { |
| 370 return std::unique_ptr<UkmEntryBuilder>(new UkmEntryBuilder( | 376 return std::unique_ptr<UkmEntryBuilder>(new UkmEntryBuilder( |
| 371 base::Bind(&UkmService::AddEntry, base::Unretained(this)), source_id, | 377 base::Bind(&UkmService::AddEntry, base::Unretained(this)), source_id, |
| 372 event_name)); | 378 event_name)); |
| 373 } | 379 } |
| 374 | 380 |
| 375 void UkmService::UpdateSourceURL(int32_t source_id, const GURL& url) { | 381 void UkmService::UpdateSourceURL(int32_t source_id, const GURL& url) { |
| 376 DCHECK(thread_checker_.CalledOnValidThread()); | 382 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 416 } |
| 411 if (entries_.size() >= kMaxEntries) { | 417 if (entries_.size() >= kMaxEntries) { |
| 412 RecordDroppedEntry(DroppedDataReason::MAX_HIT); | 418 RecordDroppedEntry(DroppedDataReason::MAX_HIT); |
| 413 return; | 419 return; |
| 414 } | 420 } |
| 415 | 421 |
| 416 entries_.push_back(std::move(entry)); | 422 entries_.push_back(std::move(entry)); |
| 417 } | 423 } |
| 418 | 424 |
| 419 } // namespace ukm | 425 } // namespace ukm |
| OLD | NEW |