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

Unified Diff: chrome/browser/devtools/devtools_network_conditions.cc

Issue 342473004: DevTools: make network conditions emulation scoped (browser) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/devtools/devtools_network_conditions.cc
diff --git a/chrome/browser/devtools/devtools_network_conditions.cc b/chrome/browser/devtools/devtools_network_conditions.cc
index 59e06b879c1f54f94fed26d1c4273f46a736a5c4..5e496b794ccf9495027f2a78ebe04a828b56baca 100644
--- a/chrome/browser/devtools/devtools_network_conditions.cc
+++ b/chrome/browser/devtools/devtools_network_conditions.cc
@@ -7,30 +7,22 @@
#include "url/gurl.h"
DevToolsNetworkConditions::DevToolsNetworkConditions(
- const std::vector<std::string>& domains,
- double maximal_throughput)
- : domains_(domains),
- maximal_throughput_(maximal_throughput) {
+ double latency,
+ double download_throughput,
+ double upload_throughput)
+ : latency_(latency),
+ download_throughput_(download_throughput),
+ upload_throughput_(upload_throughput) {
}
DevToolsNetworkConditions::~DevToolsNetworkConditions() {
}
-bool DevToolsNetworkConditions::HasMatchingDomain(const GURL& url) const {
- Domains::const_iterator domain = domains_.begin();
- if (domain == domains_.end())
- return true;
- for (; domain != domains_.end(); ++domain) {
- if (url.DomainIs(domain->data()))
- return true;
- }
- return false;
-}
-
bool DevToolsNetworkConditions::IsOffline() const {
- return maximal_throughput_ == 0.0;
+ return !IsThrottling();
}
bool DevToolsNetworkConditions::IsThrottling() const {
- return maximal_throughput_ != 0.0;
+ return (latency_ != 0) || (download_throughput_ != 0.0) ||
+ (upload_throughput_ != 0);
}

Powered by Google App Engine
This is Rietveld 408576698