Commit f07ff30b authored by Rayan Kanso's avatar Rayan Kanso Committed by Commit Bot

[Background Fetch] total-download-exceeded -> download-total-exceeded

Update BackgroundFetchRegistration idl file to include the new changes
in the spec.

Bug: 913867
Change-Id: Ie94bc1a064734021e5bd98541d9ab47a4006aaf4
Reviewed-on: https://chromium-review.googlesource.com/c/1371387Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarMugdha Lakhani <nator@chromium.org>
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615584}
parent 04a49396
...@@ -532,9 +532,9 @@ void BackgroundFetchDelegateImpl::FailFetch(const std::string& job_unique_id) { ...@@ -532,9 +532,9 @@ void BackgroundFetchDelegateImpl::FailFetch(const std::string& job_unique_id) {
Abort(job_unique_id); Abort(job_unique_id);
if (auto client = GetClient(unique_id)) { if (auto client = GetClient(unique_id)) {
client->OnJobCancelled(unique_id, client->OnJobCancelled(
blink::mojom::BackgroundFetchFailureReason:: unique_id,
TOTAL_DOWNLOAD_SIZE_EXCEEDED); blink::mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED);
} }
} }
......
...@@ -28,7 +28,7 @@ message BackgroundFetchRegistration { ...@@ -28,7 +28,7 @@ message BackgroundFetchRegistration {
FETCH_ERROR = 4; FETCH_ERROR = 4;
SERVICE_WORKER_UNAVAILABLE = 5; SERVICE_WORKER_UNAVAILABLE = 5;
QUOTA_EXCEEDED = 6; QUOTA_EXCEEDED = 6;
TOTAL_DOWNLOAD_SIZE_EXCEEDED = 7; DOWNLOAD_TOTAL_EXCEEDED = 7;
} }
// See definition of |unique_id| in BackgroundFetchRegistrationId. // See definition of |unique_id| in BackgroundFetchRegistrationId.
......
...@@ -431,10 +431,11 @@ void BackgroundFetchDelegateProxy::OnJobCancelled( ...@@ -431,10 +431,11 @@ void BackgroundFetchDelegateProxy::OnJobCancelled(
const std::string& job_unique_id, const std::string& job_unique_id,
blink::mojom::BackgroundFetchFailureReason reason_to_abort) { blink::mojom::BackgroundFetchFailureReason reason_to_abort) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(reason_to_abort == DCHECK(
blink::mojom::BackgroundFetchFailureReason::CANCELLED_FROM_UI || reason_to_abort ==
reason_to_abort == blink::mojom::BackgroundFetchFailureReason:: blink::mojom::BackgroundFetchFailureReason::CANCELLED_FROM_UI ||
TOTAL_DOWNLOAD_SIZE_EXCEEDED); reason_to_abort ==
blink::mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED);
// TODO(delphick): The controller may not exist as persistence is not yet // TODO(delphick): The controller may not exist as persistence is not yet
// implemented. // implemented.
......
...@@ -99,8 +99,7 @@ void BackgroundFetchEventDispatcher::DispatchBackgroundFetchCompletionEvent( ...@@ -99,8 +99,7 @@ void BackgroundFetchEventDispatcher::DispatchBackgroundFetchCompletionEvent(
case blink::mojom::BackgroundFetchFailureReason::FETCH_ERROR: case blink::mojom::BackgroundFetchFailureReason::FETCH_ERROR:
case blink::mojom::BackgroundFetchFailureReason::SERVICE_WORKER_UNAVAILABLE: case blink::mojom::BackgroundFetchFailureReason::SERVICE_WORKER_UNAVAILABLE:
case blink::mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED: case blink::mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED:
case blink::mojom::BackgroundFetchFailureReason:: case blink::mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED:
TOTAL_DOWNLOAD_SIZE_EXCEEDED:
DCHECK_EQ(registration->result, DCHECK_EQ(registration->result,
blink::mojom::BackgroundFetchResult::FAILURE); blink::mojom::BackgroundFetchResult::FAILURE);
DispatchBackgroundFetchFailEvent(registration_id, std::move(registration), DispatchBackgroundFetchFailEvent(registration_id, std::move(registration),
......
...@@ -145,9 +145,9 @@ bool MojoFailureReasonFromRegistrationProto( ...@@ -145,9 +145,9 @@ bool MojoFailureReasonFromRegistrationProto(
*failure_reason = *failure_reason =
blink::mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED; blink::mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED;
return true; return true;
case proto::BackgroundFetchRegistration::TOTAL_DOWNLOAD_SIZE_EXCEEDED: case proto::BackgroundFetchRegistration::DOWNLOAD_TOTAL_EXCEEDED:
*failure_reason = blink::mojom::BackgroundFetchFailureReason:: *failure_reason =
TOTAL_DOWNLOAD_SIZE_EXCEEDED; blink::mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED;
return true; return true;
case proto::BackgroundFetchRegistration::FETCH_ERROR: case proto::BackgroundFetchRegistration::FETCH_ERROR:
*failure_reason = blink::mojom::BackgroundFetchFailureReason::FETCH_ERROR; *failure_reason = blink::mojom::BackgroundFetchFailureReason::FETCH_ERROR;
......
...@@ -55,8 +55,8 @@ enum BackgroundFetchFailureReason { ...@@ -55,8 +55,8 @@ enum BackgroundFetchFailureReason {
// "quota-exceeded": // "quota-exceeded":
QUOTA_EXCEEDED = 6, QUOTA_EXCEEDED = 6,
// "total-download-exceeded": // "download-total-exceeded":
TOTAL_DOWNLOAD_SIZE_EXCEEDED = 7, DOWNLOAD_TOTAL_EXCEEDED = 7,
}; };
// Represents the optional options a developer can provide when starting a new // Represents the optional options a developer can provide when starting a new
......
...@@ -351,8 +351,8 @@ const String BackgroundFetchRegistration::failureReason() const { ...@@ -351,8 +351,8 @@ const String BackgroundFetchRegistration::failureReason() const {
return "fetch-error"; return "fetch-error";
case mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED: case mojom::BackgroundFetchFailureReason::QUOTA_EXCEEDED:
return "quota-exceeded"; return "quota-exceeded";
case mojom::BackgroundFetchFailureReason::TOTAL_DOWNLOAD_SIZE_EXCEEDED: case mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED:
return "total-download-exceeded"; return "download-total-exceeded";
} }
NOTREACHED(); NOTREACHED();
} }
......
...@@ -3,23 +3,6 @@ ...@@ -3,23 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
// https://wicg.github.io/background-fetch/#background-fetch-registration // https://wicg.github.io/background-fetch/#background-fetch-registration
enum BackgroundFetchFailureReason {
"",
// The operation was aborted by the user, or abort() was called.
"aborted",
// A response had a not-ok-status.
"bad-status",
// A fetch failed for other reasons, e.g. CORS, MIX, an invalid partial response,
// or a general network failure for a fetch that cannot be retried.
"fetch-error",
// Storage quota was reached during the operation.
"quota-exceeded",
// The provided downloadTotal was exceeded.
"total-download-exceeded"
};
enum BackgroundFetchResult { "", "success", "failure" };
[ [
Exposed=(Window,Worker), Exposed=(Window,Worker),
OriginTrialEnabled=BackgroundFetch OriginTrialEnabled=BackgroundFetch
...@@ -42,3 +25,22 @@ enum BackgroundFetchResult { "", "success", "failure" }; ...@@ -42,3 +25,22 @@ enum BackgroundFetchResult { "", "success", "failure" };
[CallWith=ScriptState, Exposed=ServiceWorker, RaisesException, MeasureAs=BackgroundFetchRegistrationMatch] Promise<BackgroundFetchRecord> match(RequestInfo request, optional CacheQueryOptions options); [CallWith=ScriptState, Exposed=ServiceWorker, RaisesException, MeasureAs=BackgroundFetchRegistrationMatch] Promise<BackgroundFetchRecord> match(RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, Exposed=ServiceWorker, RaisesException, MeasureAs=BackgroundFetchRegistrationMatchAll] Promise<sequence<BackgroundFetchRecord>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); [CallWith=ScriptState, Exposed=ServiceWorker, RaisesException, MeasureAs=BackgroundFetchRegistrationMatchAll] Promise<sequence<BackgroundFetchRecord>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
}; };
enum BackgroundFetchResult { "", "success", "failure" };
enum BackgroundFetchFailureReason {
// The background fetch has not completed yet, or was successful.
"",
// The operation was aborted by the user, or abort() was called.
"aborted",
// A response had a not-ok-status.
"bad-status",
// A fetch failed for other reasons, e.g. CORS, MIX, an invalid partial response,
// or a general network failure for a fetch that cannot be retried.
"fetch-error",
// Storage quota was reached during the operation.
"quota-exceeded",
// The provided downloadTotal was exceeded.
"download-total-exceeded"
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment