Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: components/offline_pages/background/request_coordinator.cc

Issue 2338313002: [Offline Pages] Gates immediate triggering (non scheduled) of background loading by whether low end… (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698