1 | /* |
2 | * Copyright (C) 2010-2018 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
17 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
19 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
20 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ |
24 | |
25 | #pragma once |
26 | |
27 | #include "ArgumentCoders.h" |
28 | #include "Connection.h" |
29 | #include "ShareableResource.h" |
30 | #include <wtf/Forward.h> |
31 | #include <wtf/ThreadSafeRefCounted.h> |
32 | |
33 | namespace PAL { |
34 | class SessionID; |
35 | } |
36 | |
37 | namespace WebCore { |
38 | class ResourceResponse; |
39 | class ResourceRequest; |
40 | class ResourceError; |
41 | } |
42 | |
43 | namespace Messages { |
44 | namespace NetworkProcessConnection { |
45 | |
46 | static inline IPC::StringReference messageReceiverName() |
47 | { |
48 | return IPC::StringReference("NetworkProcessConnection" ); |
49 | } |
50 | |
51 | #if ENABLE(SHAREABLE_RESOURCE) |
52 | class DidCacheResource { |
53 | public: |
54 | typedef std::tuple<const WebCore::ResourceRequest&, const WebKit::ShareableResource::Handle&, const PAL::SessionID&> Arguments; |
55 | |
56 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
57 | static IPC::StringReference name() { return IPC::StringReference("DidCacheResource" ); } |
58 | static const bool isSync = false; |
59 | |
60 | DidCacheResource(const WebCore::ResourceRequest& request, const WebKit::ShareableResource::Handle& resource, const PAL::SessionID& sessionID) |
61 | : m_arguments(request, resource, sessionID) |
62 | { |
63 | } |
64 | |
65 | const Arguments& arguments() const |
66 | { |
67 | return m_arguments; |
68 | } |
69 | |
70 | private: |
71 | Arguments m_arguments; |
72 | }; |
73 | #endif |
74 | |
75 | class DidFinishPingLoad { |
76 | public: |
77 | typedef std::tuple<uint64_t, const WebCore::ResourceError&, const WebCore::ResourceResponse&> Arguments; |
78 | |
79 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
80 | static IPC::StringReference name() { return IPC::StringReference("DidFinishPingLoad" ); } |
81 | static const bool isSync = false; |
82 | |
83 | DidFinishPingLoad(uint64_t pingLoadIdentifier, const WebCore::ResourceError& error, const WebCore::ResourceResponse& response) |
84 | : m_arguments(pingLoadIdentifier, error, response) |
85 | { |
86 | } |
87 | |
88 | const Arguments& arguments() const |
89 | { |
90 | return m_arguments; |
91 | } |
92 | |
93 | private: |
94 | Arguments m_arguments; |
95 | }; |
96 | |
97 | class DidFinishPreconnection { |
98 | public: |
99 | typedef std::tuple<uint64_t, const WebCore::ResourceError&> Arguments; |
100 | |
101 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
102 | static IPC::StringReference name() { return IPC::StringReference("DidFinishPreconnection" ); } |
103 | static const bool isSync = false; |
104 | |
105 | DidFinishPreconnection(uint64_t preconnectionIdentifier, const WebCore::ResourceError& error) |
106 | : m_arguments(preconnectionIdentifier, error) |
107 | { |
108 | } |
109 | |
110 | const Arguments& arguments() const |
111 | { |
112 | return m_arguments; |
113 | } |
114 | |
115 | private: |
116 | Arguments m_arguments; |
117 | }; |
118 | |
119 | class SetOnLineState { |
120 | public: |
121 | typedef std::tuple<bool> Arguments; |
122 | |
123 | static IPC::StringReference receiverName() { return messageReceiverName(); } |
124 | static IPC::StringReference name() { return IPC::StringReference("SetOnLineState" ); } |
125 | static const bool isSync = false; |
126 | |
127 | explicit SetOnLineState(bool isOnLine) |
128 | : m_arguments(isOnLine) |
129 | { |
130 | } |
131 | |
132 | const Arguments& arguments() const |
133 | { |
134 | return m_arguments; |
135 | } |
136 | |
137 | private: |
138 | Arguments m_arguments; |
139 | }; |
140 | |
141 | } // namespace NetworkProcessConnection |
142 | } // namespace Messages |
143 | |