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

Side by Side Diff: components/offline_pages/core/prefetch/prefetch_types.h

Issue 2873383004: [Offline Prefetch] Send GeneratePageBundleRequest to the server (Closed)
Patch Set: Update Created 3 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13
14 namespace offline_pages {
15
16 // Status for sending prefetch request to the server.
17 enum class RequestStatus {
dewittj 2017/05/11 18:46:43 This is too generic a name, I think. PrefetchRequ
jianli 2017/05/11 20:45:14 Changed to PrefetchRequestStatus. This enum is use
18 // Request completed successfully.
19 SUCCESS,
20 // Request failed due to to local network problem, unrelated to server load
21 // levels. The caller will simply reschedule the retry in the next available
22 // WiFi window after 15 minutes have passed.
23 SHOULD_RETRY_WITHOUT_BACKOFF,
24 // Request failed probably related to transient server problems. The caller
25 // will reschedule the retry with backoff included.
26 SHOULD_RETRY_WITH_BACKOFF,
27 // Request failed with error indicating that the server no longer knows how
28 // to service a request. The caller will prevent network requests for the
29 // period of 1 day.
30 SHOULD_SUSPEND
31 };
32
33 // Status indicating the page rendering status in the server.
34 enum class RenderStatus {
35 // The page is rendered.
36 RENDERED,
37 // The page is still being processed.
38 PENDING_TO_RENDER,
dewittj 2017/05/11 18:46:43 nit: PENDING
jianli 2017/05/11 20:45:14 Done.
39 // The page failed to render.
40 FAILED_TO_RENDER,
dewittj 2017/05/11 18:46:43 nit: FAILED
jianli 2017/05/11 20:45:14 Done.
41 // Failed due to bundle size limits.
42 EXCEEDED_LIMIT
43 };
44
45 struct PageInfo {
46 PageInfo() : status(RenderStatus::FAILED_TO_RENDER), body_length(0) {}
dewittj 2017/05/11 18:46:43 nit: remove constructor, use: RenderStatus staus
jianli 2017/05/11 20:45:14 Moved initialization to in place. I can't remove
47
48 // The URL of the page that was rendered.
49 std::string url;
50 // The final URL after redirects. Empty if the final URL is url.
51 std::string redirect_url;
52 // Status of the render attempt.
53 RenderStatus status;
54 // Resource name for the body which can be read via the ByteStream API.
55 // Set only when |status| is RENDERED.
56 std::string body_name;
57 // Length of the body in bytes. Set only when |status| is RENDERED.
58 int64_t body_length;
59 // Time the page was rendered.
60 base::Time render_time;
61 };
62
63 } // namespace offline_pages
64
65 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698