GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / common / page_state_serialization.h
bloba23ab5fdaf6d9e0d9176ddc8c825c955be4ccd0d
1 // Copyright 2013 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.
5 #ifndef CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_
6 #define CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_
8 #include <vector>
10 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
13 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
14 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/point_f.h"
16 #include "url/gurl.h"
18 namespace content {
20 struct CONTENT_EXPORT ExplodedHttpBodyElement {
21 blink::WebHTTPBody::Element::Type type;
22 std::string data;
23 base::NullableString16 file_path;
24 GURL filesystem_url;
25 int64 file_start;
26 int64 file_length;
27 double file_modification_time;
28 std::string blob_uuid;
30 ExplodedHttpBodyElement();
31 ~ExplodedHttpBodyElement();
34 struct CONTENT_EXPORT ExplodedHttpBody {
35 base::NullableString16 http_content_type;
36 std::vector<ExplodedHttpBodyElement> elements;
37 int64 identifier;
38 bool contains_passwords;
39 bool is_null;
41 ExplodedHttpBody();
42 ~ExplodedHttpBody();
45 struct CONTENT_EXPORT ExplodedFrameState {
46 base::NullableString16 url_string;
47 base::NullableString16 referrer;
48 base::NullableString16 target;
49 base::NullableString16 state_object;
50 std::vector<base::NullableString16> document_state;
51 gfx::PointF pinch_viewport_scroll_offset;
52 gfx::Point scroll_offset;
53 int64 item_sequence_number;
54 int64 document_sequence_number;
55 int64 frame_sequence_number;
56 double page_scale_factor;
57 blink::WebReferrerPolicy referrer_policy;
58 ExplodedHttpBody http_body;
59 std::vector<ExplodedFrameState> children;
61 ExplodedFrameState();
62 ExplodedFrameState(const ExplodedFrameState& other);
63 ~ExplodedFrameState();
64 void operator=(const ExplodedFrameState& other);
66 private:
67 void assign(const ExplodedFrameState& other);
70 struct CONTENT_EXPORT ExplodedPageState {
71 // TODO(creis): Move referenced_files to ExplodedFrameState.
72 // It currently contains a list from all frames, but cannot be deserialized
73 // into the files referenced by each frame. See http://crbug.com/441966.
74 std::vector<base::NullableString16> referenced_files;
75 ExplodedFrameState top;
77 ExplodedPageState();
78 ~ExplodedPageState();
81 CONTENT_EXPORT bool DecodePageState(const std::string& encoded,
82 ExplodedPageState* exploded);
83 CONTENT_EXPORT bool EncodePageState(const ExplodedPageState& exploded,
84 std::string* encoded);
86 #if defined(OS_ANDROID)
87 CONTENT_EXPORT bool DecodePageStateWithDeviceScaleFactorForTesting(
88 const std::string& encoded,
89 float device_scale_factor,
90 ExplodedPageState* exploded);
91 #endif
93 } // namespace content
95 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_