OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/offline_pages/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "base/sys_info.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "components/offline_pages/background/offliner_factory.h" | 16 #include "components/offline_pages/background/offliner_factory.h" |
16 #include "components/offline_pages/background/offliner_policy.h" | 17 #include "components/offline_pages/background/offliner_policy.h" |
17 #include "components/offline_pages/background/request_picker.h" | 18 #include "components/offline_pages/background/request_picker.h" |
18 #include "components/offline_pages/background/save_page_request.h" | 19 #include "components/offline_pages/background/save_page_request.h" |
19 #include "components/offline_pages/offline_page_item.h" | 20 #include "components/offline_pages/offline_page_item.h" |
20 #include "components/offline_pages/offline_page_model.h" | 21 #include "components/offline_pages/offline_page_model.h" |
21 | 22 |
22 namespace offline_pages { | 23 namespace offline_pages { |
23 | 24 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 366 |
366 TryNextRequest(); | 367 TryNextRequest(); |
367 | 368 |
368 return true; | 369 return true; |
369 } | 370 } |
370 | 371 |
371 void RequestCoordinator::StartProcessingIfConnected() { | 372 void RequestCoordinator::StartProcessingIfConnected() { |
372 // Makes sure not already busy processing. | 373 // Makes sure not already busy processing. |
373 if (is_busy_) return; | 374 if (is_busy_) return; |
374 | 375 |
| 376 // Make sure we are not on svelte device to start immediately. |
| 377 if (base::SysInfo::IsLowEndDevice()) return; |
| 378 |
375 // Check for network connectivity. | 379 // Check for network connectivity. |
376 net::NetworkChangeNotifier::ConnectionType connection = GetConnectionType(); | 380 net::NetworkChangeNotifier::ConnectionType connection = GetConnectionType(); |
377 | 381 |
378 if ((connection != | 382 if ((connection != |
379 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE)) { | 383 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE)) { |
380 // Create conservative device conditions for the connectivity | 384 // Create conservative device conditions for the connectivity |
381 // (assume no battery). | 385 // (assume no battery). |
382 DeviceConditions device_conditions(false, 0, connection); | 386 DeviceConditions device_conditions(false, 0, connection); |
383 StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback)); | 387 StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback)); |
384 } | 388 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); | 582 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); |
579 } | 583 } |
580 | 584 |
581 void RequestCoordinator::GetOffliner() { | 585 void RequestCoordinator::GetOffliner() { |
582 if (!offliner_) { | 586 if (!offliner_) { |
583 offliner_ = factory_->GetOffliner(policy_.get()); | 587 offliner_ = factory_->GetOffliner(policy_.get()); |
584 } | 588 } |
585 } | 589 } |
586 | 590 |
587 } // namespace offline_pages | 591 } // namespace offline_pages |
OLD | NEW |