forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend-gpu-GetShareableBitmap-RemoteRenderingBackend.html
78 lines (74 loc) · 2.79 KB
/
send-gpu-GetShareableBitmap-RemoteRenderingBackend.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!doctype html><!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] -->
<script src="../resources/js-test.js"></script>
<script>
function fuzz() {
description("Send IPC messages between GPU process and WebProcess to create RenderingBackend then ImageBuffer then get the ShareableBitmap");
window.jsTestIsAsync = true;
if (!window.IPC) {
finishJSTest();
return;
}
const defaultTimeout = 1000;
o4=IPC.pageID;
o5=IPC.webPageProxyID;
let pair = IPC.createStreamClientConnection(14, defaultTimeout);
o35=pair[0];
o36=pair[1];
o35.open();
// Use random identifiers in case this test is run multiple times in the same process.
let backendID = Math.floor(Math.random() * 100000000) + 1;
let imageBufferID = Math.floor(Math.random() * 100000000) + 1;
try {
IPC.sendMessage('GPU',0,IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name,
[{type: 'uint64_t', value: backendID},
{type: 'uint64_t', value: o5},
{type: 'uint64_t', value: o4},
{type: 'StreamServerConnectionHandle', value: o36}])
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
}
try {
resp = o35.waitForMessage(backendID, IPC.messages.RemoteRenderingBackendProxy_DidInitialize.name)
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
}
try {
o35.setSemaphores(resp[0].value, resp[1].value);
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
}
try {
o35.sendMessage(backendID, IPC.messages.RemoteRenderingBackend_CreateImageBuffer.name,
[{type: 'float', value: 804},
{type: 'float', value: 486},
{type: 'uint8_t', value: 0},
{type: 'uint8_t', value: 2},
{type: 'float', value: 184},
{type: 'uint8_t', value: 0},
{type: 'uint8_t', value: 0},
{type: 'uint64_t', value: imageBufferID}])
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
}
try {
o35.waitForMessage(imageBufferID, IPC.messages.RemoteImageBufferProxy_DidCreateBackend.name);
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
}
try {
o35.sendSyncMessage(imageBufferID,IPC.messages.RemoteImageBuffer_GetShareableBitmap.name, [{type: 'bool',value: 0}]);
} catch (error) {
if (!(error instanceof TypeError))
debug("Failed: " + error)
} finally {
o35.invalidate();
finishJSTest();
}
}
</script>
<body onload='fuzz()'></body>