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
|
#pragma once
#include "root.h"
#include "JSDOMGlobalObject.h"
#include "BunClientData.h"
namespace WebCore {
extern "C" void* Blob__dupeFromJS(JSC::EncodedJSValue impl);
extern "C" void* Blob__dupe(void* impl);
extern "C" void Blob__destroy(void* impl);
class Blob : public RefCounted<Blob> {
public:
void* impl()
{
return m_impl;
}
static RefPtr<Blob> create(JSC::JSValue impl)
{
void* implPtr = Blob__dupeFromJS(JSValue::encode(impl));
if (!implPtr)
return nullptr;
return adoptRef(*new Blob(implPtr));
}
static RefPtr<Blob> create(void* ptr)
{
void* implPtr = Blob__dupe(ptr);
if (!implPtr)
return nullptr;
return adoptRef(*new Blob(implPtr));
}
~Blob()
{
Blob__destroy(m_impl);
}
String fileName()
{
return m_fileName;
}
void setFileName(String fileName)
{
m_fileName = fileName;
}
void* m_impl;
private:
Blob(void* impl, String fileName = String())
{
m_impl = impl;
m_fileName = fileName;
}
String m_fileName;
};
JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, Blob&);
inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Blob* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<Blob>&&);
inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<Blob>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
}
|