Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
35 lines (30 loc) · 1.38 KB

File metadata and controls

35 lines (30 loc) · 1.38 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
# License: New BSD License.
# Website: http://code.google.com/p/cefpython/
cdef class PyStreamReader:
cdef CefRefPtr[CefStreamReader] cefStreamReader
cdef cpp_bool HasCefStreamReader(self) except *:
if <void*>self.cefStreamReader != NULL and self.cefStreamReader.get():
return True
return False
cdef CefRefPtr[CefStreamReader] GetCefStreamReader(self) except *:
if self.HasCefStreamReader():
return self.cefStreamReader
return <CefRefPtr[CefStreamReader]>NULL
cpdef py_void SetFile(self, py_string file):
if os.path.exists(file):
self.cefStreamReader = cef_stream_static.CreateForFile(
PyToCefStringValue(file))
else:
raise Exception("File does not exist: %s" % file)
cpdef py_void SetData(self, py_string data):
cdef cpp_string cppString = data
# CreateForData() requires "void* data", we can't just pass
# cppString.c_str() as it is const, we need to copy all data.
cdef void* voidData
cdef int dataLength = cppString.length()
voidData = <void*>malloc(dataLength)
memcpy(voidData, cppString.c_str(), dataLength)
self.cefStreamReader = cef_stream_static.CreateForData(
voidData, dataLength)
free(voidData)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.