Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 129
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20161204.1709 +Version: 0.7.2.99+git20161230.0848 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+ @@ -63,10 +63,10 @@ BuildRequires: pkgconfig(libssl) %endif %if %{with ffmpeg} -BuildRequires: pkgconfig(libavcodec) = 56.60.100 -BuildRequires: pkgconfig(libavformat) = 56.40.101 -BuildRequires: pkgconfig(libavutil) = 54.31.100 -BuildRequires: pkgconfig(libavresample) = 2.1.0 +BuildRequires: pkgconfig(libavcodec) +BuildRequires: pkgconfig(libavformat) +BuildRequires: pkgconfig(libavutil) +BuildRequires: pkgconfig(libavresample) %endif %description
View file
lightspark.tar.xz/src/backends/extscriptobject.cpp
Changed
@@ -342,6 +342,11 @@ } /* -- ExtASCallback -- */ +ExtASCallback::ExtASCallback(IFunction *_func):funcWasCalled(false), func(_func), result(NULL), asArgs(NULL) +{ + func->incRef(); +} + ExtASCallback::~ExtASCallback() { func->decRef(); if(asArgs) @@ -504,3 +509,446 @@ } return success; } + +// This method allows calling a function on the main thread in a generic way. +void ExtScriptObject::doHostCall(ExtScriptObject::HOST_CALL_TYPE type, + void* returnValue, void* arg1, void* arg2, void* arg3, void* arg4) +{ + // Used to signal completion of asynchronous external call + Semaphore callStatus(0); + HOST_CALL_DATA callData = { + this, + &callStatus, + type, + arg1, + arg2, + arg3, + arg4, + returnValue + }; + // We are in the main thread, + // so we can call the method ourselves synchronously straight away + if(Thread::self() == mainThread) + { + hostCallHandler(&callData); + return; + } + + // Make sure we are the only external call being executed + mutex.lock(); + // If we are shutting down, then don't even continue + if(shuttingDown) + { + mutex.unlock(); + return; + } + + // If we are the first external call, then indicate that an external call is running + if(callStatusses.size() == 0) + hostCall.lock(); + + // Add this callStatus semaphore to the list of running call statuses to be cleaned up on shutdown + callStatusses.push(&callStatus); + + // Main thread is not occupied by an invoked callback, + // so ask the browser to asynchronously call our external function. + if(currentCallback == NULL) + callAsync(&callData); + // Main thread is occupied by an invoked callback. + // Wake it up and ask it run our external call + else + { + hostCallData = &callData; + currentCallback->wakeUp(); + } + + // Called JS may invoke a callback, which in turn may invoke another external method, which needs this mutex + mutex.unlock(); + + // Wait for the (possibly asynchronously) called function to finish + callStatus.wait(); + + mutex.lock(); + + // This call status doesn't need to be cleaned up anymore on shutdown + callStatusses.pop(); + + // If we are the last external call, then indicate that all external calls are now finished + if(callStatusses.size() == 0) + hostCall.unlock(); + + mutex.unlock(); +} + +void ExtScriptObject::hostCallHandler(void* d) +{ + HOST_CALL_DATA* callData = static_cast<HOST_CALL_DATA*>(d); + + lightspark::SystemState* prevSys = getSys(); + bool tlsSysSet = false; + if(callData->so->getSystemState()) + { + tlsSysSet = true; + setTLSSys(callData->so->getSystemState()); + } + + // Assert we are in the main plugin thread + callData->so->assertThread(); + + switch(callData->type) + { + case EXTERNAL_CALL: + *static_cast<bool*>(callData->returnValue) = callData->so->callExternalHandler( + static_cast<const char*>(callData->arg1), static_cast<const ExtVariant**>(callData->arg2), + *static_cast<uint32_t*>(callData->arg3), static_cast<ASObject**>(callData->arg4)); + break; + default: + LOG(LOG_ERROR, "Unimplemented host call requested"); + } + + callData->callStatus->signal(); + if(tlsSysSet) + setTLSSys(prevSys); +} + +bool ExtScriptObject::callExternal(const ExtIdentifier &id, const ExtVariant **args, uint32_t argc, ASObject **result) +{ + // Signals when the async has been completed + // True if NPN_Invoke succeeded + bool success = false; + + // We forge an anonymous function with the right number of arguments + std::string argsString; + for(uint32_t i=0;i<argc;i++) + { + char buf[20]; + if((i+1)==argc) + snprintf(buf,20,"a%u",i); + else + snprintf(buf,20,"a%u,",i); + argsString += buf; + } + + std::string scriptString = "(function("; + scriptString += argsString; + scriptString += ") { return (" + id.getString(); + scriptString += ")(" + argsString + "); })"; + + LOG(LOG_CALLS,"Invoking " << scriptString << " in the browser "); + + doHostCall(EXTERNAL_CALL, &success, const_cast<char*>(scriptString.c_str()), const_cast<ExtVariant**>(args), &argc, result); + return success; +} + +// ExtScriptObject interface: methods +ExtScriptObject::ExtScriptObject(SystemState *sys): + m_sys(sys),currentCallback(NULL), hostCallData(NULL), + shuttingDown(false), marshallExceptions(false) +{ + // This object is always created in the main plugin thread, so lets save + // so that we can check if we are in the main plugin thread later on. + mainThread = Thread::self(); + + setProperty("$version", Capabilities::EMULATED_VERSION); + + // Standard methods + setMethod("SetVariable", new lightspark::ExtBuiltinCallback(stdSetVariable)); + setMethod("GetVariable", new lightspark::ExtBuiltinCallback(stdGetVariable)); + setMethod("GotoFrame", new lightspark::ExtBuiltinCallback(stdGotoFrame)); + setMethod("IsPlaying", new lightspark::ExtBuiltinCallback(stdIsPlaying)); + setMethod("LoadMovie", new lightspark::ExtBuiltinCallback(stdLoadMovie)); + setMethod("Pan", new lightspark::ExtBuiltinCallback(stdPan)); + setMethod("PercentLoaded", new lightspark::ExtBuiltinCallback(stdPercentLoaded)); + setMethod("Play", new lightspark::ExtBuiltinCallback(stdPlay)); + setMethod("Rewind", new lightspark::ExtBuiltinCallback(stdRewind)); + setMethod("SetZoomRect", new lightspark::ExtBuiltinCallback(stdSetZoomRect)); + setMethod("StopPlay", new lightspark::ExtBuiltinCallback(stdStopPlay)); + setMethod("Zoom", new lightspark::ExtBuiltinCallback(stdZoom)); + setMethod("TotalFrames", new lightspark::ExtBuiltinCallback(stdTotalFrames)); +} + +ExtScriptObject::~ExtScriptObject() +{ + std::map<ExtIdentifier, lightspark::ExtCallback*>::iterator meth_it = methods.begin(); + while(meth_it != methods.end()) + { + delete (*meth_it).second; + methods.erase(meth_it++); + } +} +// Destructor preparator +void ExtScriptObject::destroy() +{ + mutex.lock(); + // Prevents new external calls from continuing + shuttingDown = true; + + // If an external call is running, wake it up + if(callStatusses.size() > 0) + callStatusses.top()->signal(); + mutex.unlock(); + // Wait for all external calls to finish + Mutex::Lock l(externalCall); +} +bool ExtScriptObject::doinvoke(const ExtIdentifier& id, const ExtVariant **args, uint32_t argc, const lightspark::ExtVariant* result) +{ + // If the NPScriptObject is shutting down, don't even continue
View file
lightspark.tar.xz/src/backends/extscriptobject.h
Changed
@@ -24,10 +24,10 @@ #include <string> #include <map> #include <memory> +#include <stack> #include "asobject.h" #include "compat.h" -#include "scripting/flash/events/flashevents.h" namespace lightspark { @@ -185,6 +185,7 @@ }; class ExternalCallEvent; +class IFunction; /** * ExtCallback specialization for IFunctions */ @@ -197,7 +198,7 @@ ASObject* result; ASObject** asArgs; public: - ExtASCallback(IFunction* _func) :funcWasCalled(false), func(_func), result(NULL), asArgs(NULL) { func->incRef(); } + ExtASCallback(IFunction* _func); ~ExtASCallback(); // Don't forget to delete this copy after use @@ -251,29 +252,145 @@ class DLL_PUBLIC ExtScriptObject { public: - virtual ~ExtScriptObject() {}; + ExtScriptObject(SystemState* sys); + virtual ~ExtScriptObject(); + // Stops all waiting external calls, should be called before destruction. + // Actual destruction should be initiated by the browser, as a last step of destruction. + void destroy(); - virtual bool hasMethod(const ExtIdentifier& id) const = 0; - // There currently is no way to invoke the set methods. There's no need for it anyway. - virtual void setMethod(const ExtIdentifier& id, ExtCallback* func) = 0; - virtual bool removeMethod(const ExtIdentifier& id) = 0; + SystemState* getSystemState() const { return m_sys; } + + void assertThread() { assert(Thread::self() == mainThread); } + + // Methods + bool hasMethod(const lightspark::ExtIdentifier& id) const + { + return methods.find(id) != methods.end(); + } + void setMethod(const lightspark::ExtIdentifier& id, lightspark::ExtCallback* func) + { + methods[id] = func; + } + bool removeMethod(const lightspark::ExtIdentifier& id); + + // Properties + bool hasProperty(const lightspark::ExtIdentifier& id) const + { + return properties.find(id) != properties.end(); + } + const ExtVariant& getProperty(const lightspark::ExtIdentifier& id) const; + void setProperty(const lightspark::ExtIdentifier& id, const lightspark::ExtVariant& value) + { + properties[id] = value; + } + bool removeProperty(const lightspark::ExtIdentifier& id); - virtual bool hasProperty(const ExtIdentifier& id) const = 0; - /* - * NOTE: The caller must make sure that the property exists - * using hasProperty - */ - virtual const ExtVariant& getProperty(const ExtIdentifier& id) const = 0; - virtual void setProperty(const ExtIdentifier& id, const ExtVariant& value) = 0; - virtual bool removeProperty(const ExtIdentifier& id) = 0; + bool enumerate(ExtIdentifier*** ids, uint32_t* count) const; + virtual ExtIdentifier* createEnumerationIdentifier(const ExtIdentifier& id) const = 0; + + enum HOST_CALL_TYPE {EXTERNAL_CALL}; + typedef struct { + ExtScriptObject* so; + Semaphore* callStatus; + HOST_CALL_TYPE type; + void* arg1; + void* arg2; + void* arg3; + void* arg4; + void* returnValue; + } HOST_CALL_DATA; + // This method allows calling some method, while making sure + // no unintended blocking occurs. + void doHostCall(HOST_CALL_TYPE type, void* returnValue, + void* arg1, void* arg2=NULL, void* arg3=NULL, void* arg4=NULL); + static void hostCallHandler(void* d); + + bool callExternal(const ExtIdentifier& id, const ExtVariant** args, uint32_t argc, ASObject** result); - virtual bool enumerate(ExtIdentifier*** ids, uint32_t* count) const = 0; + virtual void setException(const std::string& message) const = 0; + + virtual void callAsync(HOST_CALL_DATA* data) = 0; - virtual bool callExternal(const ExtIdentifier& id, const ExtVariant** args, uint32_t argc, ASObject** result) = 0; + // This is called from hostCallHandler() via doHostCall(EXTERNAL_CALL, ...) + virtual bool callExternalHandler(const char* scriptString, const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result) = 0; + + void setMarshallExceptions(bool marshall) { marshallExceptions = marshall; } + bool getMarshallExceptions() const { return marshallExceptions; } + // Standard methods + // These methods are standard to every flash instance. + // They provide features such as getting/setting internal variables, + // going to a frame, pausing etc... to the external container. + static bool stdGetVariable(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdSetVariable(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdGotoFrame(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdIsPlaying(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdLoadMovie(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdPan(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdPercentLoaded(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdPlay(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdRewind(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdStopPlay(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdSetZoomRect(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdZoom(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + static bool stdTotalFrames(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); +protected: + bool doinvoke(const ExtIdentifier &id, const ExtVariant**args, uint32_t argc, const ExtVariant *result); +private: + SystemState* m_sys; + // Used to determine if a method is called in the main plugin thread + Thread* mainThread; + + // Provides mutual exclusion for external calls + Mutex mutex; + std::stack<Semaphore*> callStatusses; + Mutex externalCall; + Mutex hostCall; + + // The root callback currently being invoked. If this is not NULL + // when invoke() gets called, we can assume the invoke() + // is nested inside another one. + lightspark::ExtCallback* currentCallback; + // The data for the external call that needs to be made. + // If a callback is woken up and this is not NULL, + // it was a forced wake-up and we should call an external method. + HOST_CALL_DATA* hostCallData; + + // This map stores this object's methods & properties + // If an entry is set with a ExtIdentifier or ExtVariant, + // they get converted to NPIdentifierObject or NPVariantObject by copy-constructors. + std::map<ExtIdentifier, ExtVariant> properties; + std::map<ExtIdentifier, lightspark::ExtCallback*> methods; - virtual void setException(const std::string& message) const = 0; - virtual void setMarshallExceptions(bool marshall) = 0; - virtual bool getMarshallExceptions() const = 0; + // True if this object is being shut down + bool shuttingDown; + // True if exceptions should be marshalled to the container + bool marshallExceptions; }; };
View file
lightspark.tar.xz/src/backends/netutils.cpp
Changed
@@ -319,7 +319,8 @@ cache->reserve(length); - notifyOwnerAboutBytesTotal(); + if (cache->getNotifyLoader()) + notifyOwnerAboutBytesTotal(); } /** @@ -339,6 +340,8 @@ return; cache->append((unsigned char *)buf, added); + if (!cache->getNotifyLoader()) + return; if (cache->getReceivedLength() > length) setLength(cache->getReceivedLength());
View file
lightspark.tar.xz/src/backends/rendering.cpp
Changed
@@ -61,8 +61,8 @@ } RenderThread::RenderThread(SystemState* s):GLRenderContext(), - m_sys(s),status(CREATED),currentPixelBuffer(0),currentPixelBufferOffset(0), - pixelBufferWidth(0),pixelBufferHeight(0),prevUploadJob(NULL), + m_sys(s),status(CREATED), + prevUploadJob(NULL), renderNeeded(false),uploadNeeded(false),resizeNeeded(false),newTextureNeeded(false),event(0),newWidth(0),newHeight(0),scaleX(1),scaleY(1), offsetX(0),offsetY(0),tempBufferAcquired(false),frameCount(0),secsCount(0),initialized(0), cairoTextureContext(NULL) @@ -110,23 +110,14 @@ newTextureNeeded=false; } -#ifdef ENABLE_GLES2 -uint8_t* pixelBuf = 0; -#endif - void RenderThread::finalizeUpload() { ITextureUploadable* u=prevUploadJob; uint32_t w,h; u->sizeNeeded(w,h); const TextureChunk& tex=u->getTexture(); - engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[currentPixelBuffer]); -#ifndef ENABLE_GLES2 - //Copy content of the pbo to the texture, currentPixelBufferOffset is the offset in the pbo - loadChunkBGRA(tex, w, h, (uint8_t*)currentPixelBufferOffset); -#else - loadChunkBGRA(tex, w, h, pixelBuf); -#endif + engineData->bindCurrentBuffer(); + loadChunkBGRA(tex, w, h, engineData->getCurrentPixBuf()); engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); u->uploadFence(); prevUploadJob=NULL; @@ -138,37 +129,20 @@ assert(u); uint32_t w,h; u->sizeNeeded(w,h); - if(w>pixelBufferWidth || h>pixelBufferHeight) - resizePixelBuffers(w,h); - //Increment and wrap current buffer index -#ifndef ENABLE_GLES2 - unsigned int nextBuffer = (currentPixelBuffer + 1)%2; - engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[nextBuffer]); - uint8_t* buf=(uint8_t*)engineData->exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY(); - if(!buf) + engineData->resizePixelBuffers(w,h); + + uint8_t* buf= engineData->switchCurrentPixBuf(w,h); + if (!buf) { handleGLErrors(); return; } - uint8_t* alignedBuf=(uint8_t*)(uintptr_t((buf+15))&(~0xfL)); - - u->upload(alignedBuf, w, h); - + u->upload(buf, w, h); + engineData->exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER(); engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); - currentPixelBufferOffset=alignedBuf-buf; - currentPixelBuffer=nextBuffer; -#else - //TODO See if a more elegant way of handling the non-PBO case can be found. - //for now, each frame is uploaded one at a time synchronously to the server - if(!pixelBuf) - if(posix_memalign((void **)&pixelBuf, 16, w*h*4)) { - LOG(LOG_ERROR, "posix_memalign could not allocate memory"); - return; - } - u->upload(pixelBuf, w, h); -#endif + //Get the texture to be sure it's allocated when the upload comes u->getTexture(); prevUploadJob=u; @@ -277,13 +251,13 @@ { renderErrorPage(this, m_sys->standalone); } - engineData->SwapBuffers(); if(!m_sys->isOnError()) { coreRendering(); //Call glFlush to offload work on the GPU engineData->exec_glFlush(); } + engineData->SwapBuffers(); if (profile && chronometer) profile->accountTime(chronometer->checkpoint()); renderNeeded=false; @@ -373,7 +347,7 @@ engineData->exec_glDeleteTextures(1,&largeTextures[i].id); delete[] largeTextures[i].bitmap; } - engineData->exec_glDeleteBuffers(2,pixelBuffers); + engineData->exec_glDeleteBuffers(); engineData->exec_glDeleteTextures(1, &cairoTextureID); } @@ -395,7 +369,7 @@ largeTextureSize=min(maxTexSize,1024); //Create the PBOs - engineData->exec_glGenBuffers(2,pixelBuffers); + engineData->exec_glGenBuffers(); //Set uniforms engineData->exec_glUseProgram(gpu_program); @@ -462,24 +436,6 @@ event.signal(); } -void RenderThread::resizePixelBuffers(uint32_t w, uint32_t h) -{ - //Add enough room to realign to 16 - engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[0]); - engineData->exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); - engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[1]); - engineData->exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); - engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); - pixelBufferWidth=w; - pixelBufferHeight=h; -#ifdef ENABLE_GLES2 - if (pixelBuf) { - free(pixelBuf); - pixelBuf = 0; - } -#endif -} - cairo_t* RenderThread::getCairoContext(int w, int h) { if (!cairoTextureContext) { @@ -911,18 +867,7 @@ engineData->exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(curY); const uint32_t blockX=((chunk.chunks[i]%blocksPerSide)*CHUNKSIZE); const uint32_t blockY=((chunk.chunks[i]/blocksPerSide)*CHUNKSIZE); -#ifndef ENABLE_GLES2 - engineData->exec_glTexSubImage2D_GL_TEXTURE_2D(0, blockX, blockY, sizeX, sizeY, data); -#else - //We need to copy the texture area to a contiguous memory region first, - //as GLES2 does not support UNPACK state (skip pixels, skip rows, row_lenght). - uint8_t *gdata = new uint8_t[4*sizeX*sizeY]; - for(unsigned int j=0;j<sizeY;j++) { - memcpy(gdata+4*j*sizeX, data+4*w*(j+curY)+4*curX, sizeX*4); - } - engineData->exec_glTexSubImage2D_GL_TEXTURE_2D(0, blockX, blockY, sizeX, sizeY, gdata); - delete[] gdata; -#endif + engineData->exec_glTexSubImage2D_GL_TEXTURE_2D(0, blockX, blockY, sizeX, sizeY, data,w,curX,curY); } engineData->exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(0); engineData->exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(0);
View file
lightspark.tar.xz/src/backends/rendering.h
Changed
@@ -46,12 +46,6 @@ void commonGLInit(int width, int height); void commonGLResize(); void commonGLDeinit(); - uint32_t pixelBuffers[2]; - uint32_t currentPixelBuffer; - intptr_t currentPixelBufferOffset; - uint32_t pixelBufferWidth; - uint32_t pixelBufferHeight; - void resizePixelBuffers(uint32_t w, uint32_t h); ITextureUploadable* prevUploadJob; uint32_t allocateNewGLTexture() const; LargeTexture& allocateNewTexture();
View file
lightspark.tar.xz/src/backends/streamcache.cpp
Changed
@@ -29,7 +29,7 @@ using namespace lightspark; StreamCache::StreamCache() - : receivedLength(0), failed(false), terminated(false) + : receivedLength(0), failed(false), terminated(false),notifyLoader(true) { } @@ -66,6 +66,7 @@ handleAppend(buffer, length); + if (notifyLoader) { Locker locker(stateMutex); receivedLength += length;
View file
lightspark.tar.xz/src/backends/streamcache.h
Changed
@@ -56,6 +56,7 @@ // Has the stream been completely downloaded or failed? bool failed:1; bool terminated:1; + bool notifyLoader:1; // Wait until more than currentOffset bytes has been received // or until terminated @@ -72,6 +73,8 @@ bool hasTerminated() const { return terminated; } bool hasFailed() const { return failed; } + bool getNotifyLoader() const { return notifyLoader; } + void setNotifyLoader(bool notify) { notifyLoader = notify; } // Wait until the writer calls markTerminated void waitForTermination();
View file
lightspark.tar.xz/src/platforms/engineutils.cpp
Changed
@@ -40,12 +40,16 @@ Thread* EngineData::mainLoopThread = NULL; bool EngineData::mainthread_running = false; Semaphore EngineData::mainthread_initialized(0); -EngineData::EngineData() : widget(0), width(0), height(0),needrenderthread(true),windowID(0),visual(0) +EngineData::EngineData() : currentPixelBuffer(0),currentPixelBufferOffset(0),currentPixelBufPtr(NULL),pixelBufferWidth(0),pixelBufferHeight(0),widget(0), width(0), height(0),needrenderthread(true),windowID(0),visual(0) { } EngineData::~EngineData() { + if (currentPixelBufPtr) { + free(currentPixelBufPtr); + currentPixelBufPtr = 0; + } } bool EngineData::mainloop_handleevent(SDL_Event* event,SystemState* sys) { @@ -223,6 +227,67 @@ return errorCode!=GL_NO_ERROR; } +uint8_t *EngineData::getCurrentPixBuf() const +{ +#ifndef ENABLE_GLES2 + return (uint8_t*)currentPixelBufferOffset; +#else + return currentPixelBufPtr; +#endif + +} + +uint8_t *EngineData::switchCurrentPixBuf(uint32_t w, uint32_t h) +{ +#ifndef ENABLE_GLES2 + unsigned int nextBuffer = (currentPixelBuffer + 1)%2; + exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[nextBuffer]); + uint8_t* buf=(uint8_t*)exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY(); + if(!buf) + return NULL; + uint8_t* alignedBuf=(uint8_t*)(uintptr_t((buf+15))&(~0xfL)); + + currentPixelBufferOffset=alignedBuf-buf; + currentPixelBuffer=nextBuffer; + return alignedBuf; +#else + //TODO See if a more elegant way of handling the non-PBO case can be found. + //for now, each frame is uploaded one at a time synchronously to the server + if(!currentPixelBufPtr) + if(posix_memalign((void **)¤tPixelBufPtr, 16, w*h*4)) { + LOG(LOG_ERROR, "posix_memalign could not allocate memory"); + return NULL; + } + return currentPixelBufPtr; +#endif + +} + +void EngineData::resizePixelBuffers(uint32_t w, uint32_t h) +{ + if(w<=pixelBufferWidth && h<=pixelBufferHeight) + return; + + //Add enough room to realign to 16 + exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[0]); + exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); + exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[1]); + exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); + exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); + pixelBufferWidth=w; + pixelBufferHeight=h; + if (currentPixelBufPtr) { + free(currentPixelBufPtr); + currentPixelBufPtr = 0; + } +} + +void EngineData::bindCurrentBuffer() +{ + exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[currentPixelBuffer]); +} + + void EngineData::exec_glUniform1f(int location,float v0) { glUniform1f(location,v0); @@ -277,11 +342,17 @@ } uint8_t* EngineData::exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY() { +#ifndef ENABLE_GLES2 return (uint8_t*)glMapBuffer(GL_PIXEL_UNPACK_BUFFER,GL_WRITE_ONLY); +#else + return NULL; +#endif } void EngineData::exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER() { +#ifndef ENABLE_GLES2 glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); +#endif } void EngineData::exec_glEnable_GL_TEXTURE_2D() { @@ -366,9 +437,9 @@ glDeleteTextures(n,textures); } -void EngineData::exec_glDeleteBuffers(int32_t n,uint32_t* buffers) +void EngineData::exec_glDeleteBuffers() { - glDeleteBuffers(n,buffers); + glDeleteBuffers(2,pixelBuffers); } void EngineData::exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA() @@ -381,9 +452,9 @@ glActiveTexture(GL_TEXTURE0); } -void EngineData::exec_glGenBuffers(int32_t n,uint32_t* buffers) +void EngineData::exec_glGenBuffers() { - glGenBuffers(n,buffers); + glGenBuffers(2,pixelBuffers); } void EngineData::exec_glUseProgram(uint32_t program) @@ -464,9 +535,20 @@ glPixelStorei(GL_UNPACK_SKIP_ROWS,param); } -void EngineData::exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels) +void EngineData::exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level, int32_t xoffset, int32_t yoffset, int32_t width, int32_t height, const void* pixels, uint32_t w, uint32_t curX, uint32_t curY) { +#ifndef ENABLE_GLES2 glTexSubImage2D(GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); +#else + //We need to copy the texture area to a contiguous memory region first, + //as GLES2 does not support UNPACK state (skip pixels, skip rows, row_lenght). + uint8_t *gdata = new uint8_t[4*width*height]; + for(int j=0;j<height;j++) { + memcpy(gdata+4*j*width, ((uint8_t *)pixels)+4*w*(j+curY)+4*curX, width*4); + } + glTexSubImage2D(GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, gdata); + delete[] gdata; +#endif } void EngineData::exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data) {
View file
lightspark.tar.xz/src/platforms/engineutils.h
Changed
@@ -46,6 +46,12 @@ RecMutex mutex; virtual SDL_Window* createWidget(uint32_t w,uint32_t h)=0; public: + uint32_t pixelBuffers[2]; + uint32_t currentPixelBuffer; + intptr_t currentPixelBufferOffset; + uint8_t* currentPixelBufPtr; + uint32_t pixelBufferWidth; + uint32_t pixelBufferHeight; SDL_Window* widget; static uint32_t userevent; static Thread* mainLoopThread; @@ -87,6 +93,8 @@ static bool startSDLMain(); void initGLEW(); + void resizePixelBuffers(uint32_t w, uint32_t h); + void bindCurrentBuffer(); /* show/hide mouse cursor, must be called from mainLoopThread */ static void showMouseCursor(SystemState *sys); @@ -99,6 +107,8 @@ virtual void InitOpenGL() = 0; virtual void DeinitOpenGL() = 0; virtual bool getGLError(uint32_t& errorCode) const; + virtual uint8_t* getCurrentPixBuf() const; + virtual uint8_t* switchCurrentPixBuf(uint32_t w, uint32_t h); virtual void exec_glUniform1f(int location,float v0); virtual void exec_glBindTexture_GL_TEXTURE_2D(uint32_t id); virtual void exec_glVertexAttribPointer(uint32_t index,int32_t size, int32_t stride, const void* coords); @@ -129,10 +139,10 @@ virtual void exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params); virtual void exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer); virtual void exec_glDeleteTextures(int32_t n,uint32_t* textures); - virtual void exec_glDeleteBuffers(int32_t n,uint32_t* buffers); + virtual void exec_glDeleteBuffers(); virtual void exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA(); virtual void exec_glActiveTexture_GL_TEXTURE0(); - virtual void exec_glGenBuffers(int32_t n,uint32_t* buffers); + virtual void exec_glGenBuffers(); virtual void exec_glUseProgram(uint32_t program); virtual int32_t exec_glGetUniformLocation(uint32_t program,const char* name); virtual void exec_glUniform1i(int32_t location,int32_t v0); @@ -149,7 +159,7 @@ virtual void exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param); virtual void exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param); virtual void exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param); - virtual void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels); + virtual void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level, int32_t xoffset, int32_t yoffset, int32_t width, int32_t height, const void* pixels, uint32_t w, uint32_t curX, uint32_t curY); virtual void exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data); };
View file
lightspark.tar.xz/src/plugin/npscriptobject.cpp
Changed
@@ -442,74 +442,16 @@ /* -- NPScriptObject -- */ // Constructor -NPScriptObject::NPScriptObject(NPScriptObjectGW* _gw) : - gw(_gw), instance(gw->getInstance()), - currentCallback(NULL), hostCallData(NULL), - shuttingDown(false), marshallExceptions(false) +NPScriptObject::NPScriptObject(NPScriptObjectGW* _gw,SystemState* sys) :ExtScriptObject(sys), + gw(_gw), instance(gw->getInstance()) { - // This object is always created in the main plugin thread, so lets save - // so that we can check if we are in the main plugin thread later on. - mainThread = Thread::self(); - - setProperty("$version", Capabilities::EMULATED_VERSION); - - // Standard methods - setMethod("SetVariable", new lightspark::ExtBuiltinCallback(stdSetVariable)); - setMethod("GetVariable", new lightspark::ExtBuiltinCallback(stdGetVariable)); - setMethod("GotoFrame", new lightspark::ExtBuiltinCallback(stdGotoFrame)); - setMethod("IsPlaying", new lightspark::ExtBuiltinCallback(stdIsPlaying)); - setMethod("LoadMovie", new lightspark::ExtBuiltinCallback(stdLoadMovie)); - setMethod("Pan", new lightspark::ExtBuiltinCallback(stdPan)); - setMethod("PercentLoaded", new lightspark::ExtBuiltinCallback(stdPercentLoaded)); - setMethod("Play", new lightspark::ExtBuiltinCallback(stdPlay)); - setMethod("Rewind", new lightspark::ExtBuiltinCallback(stdRewind)); - setMethod("SetZoomRect", new lightspark::ExtBuiltinCallback(stdSetZoomRect)); - setMethod("StopPlay", new lightspark::ExtBuiltinCallback(stdStopPlay)); - setMethod("Zoom", new lightspark::ExtBuiltinCallback(stdZoom)); - setMethod("TotalFrames", new lightspark::ExtBuiltinCallback(stdTotalFrames)); -} - -// Destructor preparator -void NPScriptObject::destroy() -{ - mutex.lock(); - // Prevents new external calls from continuing - shuttingDown = true; - - // If an external call is running, wake it up - if(callStatusses.size() > 0) - callStatusses.top()->signal(); - mutex.unlock(); - // Wait for all external calls to finish - Mutex::Lock l(externalCall); -} - -// Destructor -NPScriptObject::~NPScriptObject() -{ - std::map<ExtIdentifier, lightspark::ExtCallback*>::iterator meth_it = methods.begin(); - while(meth_it != methods.end()) - { - delete (*meth_it).second; - methods.erase(meth_it++); - } } // NPRuntime interface: invoking methods bool NPScriptObject::invoke(NPIdentifier id, const NPVariant* args, uint32_t argc, NPVariant* result) { - // If the NPScriptObject is shutting down, don't even continue - if(shuttingDown) - return false; NPIdentifierObject objId(id); - // Check if the method exists - std::map<ExtIdentifier, lightspark::ExtCallback*>::iterator it; - it = methods.find(objId); - if(it == methods.end()) - return false; - - LOG(LOG_CALLS,"Plugin callback from the browser: " << objId.getString()); // Convert raw arguments to objects const lightspark::ExtVariant** objArgs = g_newa(const lightspark::ExtVariant*,argc); @@ -519,74 +461,7 @@ // This will hold our eventual callback result const lightspark::ExtVariant* objResult = NULL; - // Make sure we use a copy of the callback - lightspark::ExtCallback* callback = it->second->copy(); - - // Set the current root callback only if there isn't one already - bool rootCallback = false; - - // We must avoid colliding with Flash code attemping an external call now - mutex.lock(); - - if(currentCallback == NULL) - { - // Remember to reset the current callback - rootCallback = true; - currentCallback = callback; - } - - // Call the callback synchronously if: - // - We are not the root callback - // (case: BROWSER -> invoke -> VM -> external call -> BROWSER -> invoke) - // - We are the root callback AND we are being called from within an external call - // (case: VM -> external call -> BROWSER -> invoke) - bool synchronous = !rootCallback || (rootCallback && callStatusses.size() == 1); - - //Now currentCallback have been set, the VM thread will notice this and invoke the code using - //a forced wake up - mutex.unlock(); - - // Call our callback. - // We can call it synchronously in the cases specified above. - // In both cases, the VM is suspended, waiting for the result from another external call. - // Thus we don't have to worry about synchronizing with the VM. - callback->call(*this, objId, objArgs, argc, synchronous); - // Wait for its result or a forced wake-up - callback->wait(); - - //Again, hostCallData is shared between the VM thread and the main thread and it should be protected - mutex.lock(); - - // As long as we get forced wake-ups, execute the requested external calls and keep waiting. - // Note that only the root callback can be forcibly woken up. - while(hostCallData != NULL) - { - // Copy the external call data pointer - HOST_CALL_DATA* data = hostCallData; - // Clear the external call data pointer BEFORE executing the call. - // This will make sure another nested external call will - // be handled properly. - hostCallData = NULL; - mutex.unlock(); - // Execute the external call - hostCallHandler(data); - // Keep waiting - callback->wait(); - mutex.lock(); - } - // Get the result of our callback - std::map<const ASObject*, std::unique_ptr<ExtObject>> asObjectsMap; - bool res = callback->getResult(asObjectsMap, *this, &objResult); - - // Reset the root current callback to NULL, if necessary - if(rootCallback) - currentCallback = NULL; - - // No more shared data should be used hereafter - mutex.unlock(); - - // Delete our callback after use - delete callback; + bool res = doinvoke(objId,objArgs,argc,objResult); // Delete converted arguments for(uint32_t i = 0; i < argc; i++) @@ -608,193 +483,18 @@ return false; } -// ExtScriptObject interface: methods -bool NPScriptObject::removeMethod(const lightspark::ExtIdentifier& id) -{ - std::map<ExtIdentifier, lightspark::ExtCallback*>::iterator it = methods.find(id); - if(it == methods.end()) - return false; - - delete (*it).second; - methods.erase(it); - return true; -} - -// ExtScriptObject interface: properties -const ExtVariant& NPScriptObject::getProperty(const lightspark::ExtIdentifier& id) const -{ - std::map<ExtIdentifier, ExtVariant>::const_iterator it = properties.find(id); - assert(it != properties.end()); - return it->second; -} -bool NPScriptObject::removeProperty(const lightspark::ExtIdentifier& id) -{ - std::map<ExtIdentifier, ExtVariant>::iterator it = properties.find(id); - if(it == properties.end()) - return false; - - properties.erase(it); - return true; -} - // ExtScriptObject interface: enumeration -bool NPScriptObject::enumerate(lightspark::ExtIdentifier*** ids, uint32_t* count) const +ExtIdentifier* NPScriptObject::createEnumerationIdentifier(const ExtIdentifier& id) const { - *count = properties.size()+methods.size(); - *ids = new lightspark::ExtIdentifier*[properties.size()+methods.size()]; - std::map<ExtIdentifier, ExtVariant>::const_iterator prop_it; - int i = 0; - for(prop_it = properties.begin(); prop_it != properties.end(); ++prop_it) - { - (*ids)[i] = new NPIdentifierObject(prop_it->first); - i++; - } - std::map<ExtIdentifier, lightspark::ExtCallback*>::const_iterator meth_it;
View file
lightspark.tar.xz/src/plugin/npscriptobject.h
Changed
@@ -24,8 +24,6 @@ #include <typeinfo> #include <string.h> #include <string> -#include <map> -#include <stack> #include "plugin/include/npapi/npapi.h" #include "plugin/include/npapi/npruntime.h" @@ -126,150 +124,26 @@ class DLL_PUBLIC NPScriptObject : public lightspark::ExtScriptObject { public: - NPScriptObject(NPScriptObjectGW* gw); - ~NPScriptObject(); - // Stops all waiting external calls, should be called before destruction. - // Actual destruction should be initiated by the browser, as a last step of destruction. - void destroy(); - - void assertThread() { assert(Thread::self() == mainThread); } + NPScriptObject(NPScriptObjectGW* gw,SystemState* sys); // These methods are not part of the ExtScriptObject interface. // ExtScriptObject does not provide a way to invoke the set methods. bool invoke(NPIdentifier name, const NPVariant* args, uint32_t argc, NPVariant* result); bool invokeDefault(const NPVariant* args, uint32_t argc, NPVariant* result); - /* ExtScriptObject interface */ - // Methods - bool hasMethod(const lightspark::ExtIdentifier& id) const - { - return methods.find(id) != methods.end(); - } - void setMethod(const lightspark::ExtIdentifier& id, lightspark::ExtCallback* func) - { - methods[id] = func; - } - bool removeMethod(const lightspark::ExtIdentifier& id); - - // Properties - bool hasProperty(const lightspark::ExtIdentifier& id) const - { - return properties.find(id) != properties.end(); - } - const ExtVariant& getProperty(const lightspark::ExtIdentifier& id) const; - void setProperty(const lightspark::ExtIdentifier& id, const lightspark::ExtVariant& value) - { - properties[id] = value; - } - bool removeProperty(const lightspark::ExtIdentifier& id); - - // Enumeration - bool enumerate(lightspark::ExtIdentifier*** ids, uint32_t* count) const; + virtual ExtIdentifier* createEnumerationIdentifier(const ExtIdentifier &id) const; - enum HOST_CALL_TYPE {EXTERNAL_CALL}; - typedef struct { - NPScriptObject* so; - Semaphore* callStatus; - HOST_CALL_TYPE type; - void* arg1; - void* arg2; - void* arg3; - void* arg4; - void* returnValue; - } HOST_CALL_DATA; - // This method allows calling some method, while making sure - // no unintended blocking occurs. - void doHostCall(HOST_CALL_TYPE type, void* returnValue, - void* arg1, void* arg2=NULL, void* arg3=NULL, void* arg4=NULL); - static void hostCallHandler(void* d); - - // Calling methods in the external container - bool callExternal(const lightspark::ExtIdentifier& id, const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result); - + void callAsync(HOST_CALL_DATA* data); // This is called from hostCallHandler() via doHostCall(EXTERNAL_CALL, ...) - static bool callExternalHandler(NPP instance, const char* scriptString, - const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result); + bool callExternalHandler(const char* scriptString,const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result); // Throwing exceptions to the container void setException(const std::string& message) const; - void setMarshallExceptions(bool marshall) { marshallExceptions = marshall; } - bool getMarshallExceptions() const { return marshallExceptions; } - - // Standard methods - // These methods are standard to every flash instance. - // They provide features such as getting/setting internal variables, - // going to a frame, pausing etc... to the external container. - static bool stdGetVariable(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdSetVariable(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdGotoFrame(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdIsPlaying(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdLoadMovie(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdPan(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdPercentLoaded(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdPlay(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdRewind(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdStopPlay(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdSetZoomRect(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdZoom(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); - static bool stdTotalFrames(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result); + private: NPScriptObjectGW* gw; NPP instance; - // Used to determine if a method is called in the main plugin thread - Thread* mainThread; - - // Provides mutual exclusion for external calls - Mutex mutex; - std::stack<Semaphore*> callStatusses; - Mutex externalCall; - Mutex hostCall; - - // The root callback currently being invoked. If this is not NULL - // when invoke() gets called, we can assume the invoke() - // is nested inside another one. - lightspark::ExtCallback* currentCallback; - // The data for the external call that needs to be made. - // If a callback is woken up and this is not NULL, - // it was a forced wake-up and we should call an external method. - HOST_CALL_DATA* hostCallData; - - // True if this object is being shut down - bool shuttingDown; - // True if exceptions should be marshalled to the container - bool marshallExceptions; - - // This map stores this object's methods & properties - // If an entry is set with a ExtIdentifier or ExtVariant, - // they get converted to NPIdentifierObject or NPVariantObject by copy-constructors. - std::map<ExtIdentifier, ExtVariant> properties; - std::map<ExtIdentifier, lightspark::ExtCallback*> methods; }; /** @@ -283,6 +157,7 @@ NPScriptObjectGW(NPP inst); ~NPScriptObjectGW(); + void createScriptObject(SystemState* sys); NPScriptObject* getScriptObject() { return so; } NPP getInstance() { return instance; }
View file
lightspark.tar.xz/src/plugin/plugin.cpp
Changed
@@ -341,8 +341,8 @@ if (n_minor >= 14) { // since NPAPI start to support scriptObject = (NPScriptObjectGW *) NPN_CreateObject(mInstance, &NPScriptObjectGW::npClass); + scriptObject->createScriptObject(m_sys); m_sys->extScriptObject = scriptObject->getScriptObject(); - scriptObject->m_sys = m_sys; //Parse OBJECT/EMBED tag attributes string baseURL; for(int i=0;i<argc;i++) @@ -390,7 +390,7 @@ delete mainDownloaderStreambuf; // Kill all stuff relating to NPScriptObject which is still running - static_cast<NPScriptObject*>(m_sys->extScriptObject)->destroy(); + m_sys->extScriptObject->destroy(); m_sys->setShutdownFlag(); @@ -947,6 +947,8 @@ dl->setLength(stream->end); mainDownloader=dl; mainDownloaderStreambuf = mainDownloader->getCache()->createReader(); + // loader is notified through parsethread + mainDownloader->getCache()->setNotifyLoader(false); mainDownloaderStream.rdbuf(mainDownloaderStreambuf); m_pt=new lightspark::ParseThread(mainDownloaderStream,m_sys->mainClip); m_sys->addJob(m_pt);
View file
lightspark.tar.xz/src/plugin_ppapi/CMakeLists.txt
Changed
@@ -22,6 +22,7 @@ # PPAPI plugin target SET(PPAPI_PLUGIN_SOURCES ${PPAPI_PLUGIN_SOURCES} plugin.cpp + ppextscriptobject.cpp ) ADD_LIBRARY(pepflashplayer MODULE ${PPAPI_PLUGIN_SOURCES})
View file
lightspark.tar.xz/src/plugin_ppapi/plugin.cpp
Changed
@@ -1,8 +1,7 @@ /************************************************************************** Lighspark, a free flash player implementation - Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) - Copyright (C) 2010-2011 Timon Van Overveldt (timonvo@gmail.com) + Copyright (C) 2016 Ludger Krämer <dbluelle@onlinehome.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -21,10 +20,7 @@ // TODO // - download -// - rendering -// - javascript communication with browser // - sound -// - keyboard/mouse handling // - run within sandbox // - register as separate plugin @@ -36,12 +32,14 @@ #include "backends/rendering.h" #include <string> #include <algorithm> +#include <SDL2/SDL.h> #include "threading.h" +#include "scripting/toplevel/JSON.h" #include "plugin_ppapi/plugin.h" +#include "plugin_ppapi/ppextscriptobject.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_var.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/ppb.h" #include "ppapi/c/ppb_core.h" @@ -52,11 +50,19 @@ #include "ppapi/c/ppb_url_loader.h" #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" +#include "ppapi/c/private/ppb_instance_private.h" +#include "ppapi/c/private/ppp_instance_private.h" +#include "ppapi/c/dev/ppb_var_deprecated.h" +#include "ppapi/c/dev/ppp_class_deprecated.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" +#include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppb_opengles2.h" #include "ppapi/c/ppb_graphics_3d.h" +#include "ppapi/c/ppb_input_event.h" +#include "ppapi/c/private/ppb_flash_clipboard.h" #include "GLES2/gl2.h" //The interpretation of texture data change with the endianness @@ -79,8 +85,227 @@ static const PPB_URLRequestInfo* g_urlrequestinfo_interface = NULL; static const PPB_URLResponseInfo* g_urlresponseinfo_interface = NULL; static const PPB_OpenGLES2* g_gles2_interface = NULL; +static const PPB_URLLoaderTrusted* g_urlloadedtrusted_interface = NULL; +static const PPB_Instance_Private* g_instance_private_interface = NULL; +static const PPB_Var_Deprecated* g_var_deprecated_interface = NULL; +static const PPB_InputEvent* g_inputevent_interface = NULL; +static const PPB_MouseInputEvent* g_mouseinputevent_interface = NULL; +static const PPB_KeyboardInputEvent* g_keyboardinputevent_interface = NULL; +static const PPB_WheelInputEvent* g_wheelinputevent_interface = NULL; +static const PPB_Flash_Clipboard* g_flashclipboard_interface = NULL; + +ppVariantObject::ppVariantObject(std::map<int64_t, std::unique_ptr<ExtObject> > &objectsMap, PP_Var& other) +{ + switch(other.type) + { + case PP_VARTYPE_UNDEFINED: + type = EV_VOID; + break; + case PP_VARTYPE_NULL: + type = EV_NULL; + break; + case PP_VARTYPE_BOOL: + type = EV_BOOLEAN; + booleanValue = other.value.as_bool; + break; + case PP_VARTYPE_INT32: + type = EV_INT32; + intValue = other.value.as_int; + break; + case PP_VARTYPE_DOUBLE: + type = EV_DOUBLE; + doubleValue = other.value.as_double; + break; + case PP_VARTYPE_STRING: + { + uint32_t len; + type = EV_STRING; + strValue = g_var_interface->VarToUtf8(other,&len); + break; + } + case PP_VARTYPE_OBJECT: + { + type = EV_OBJECT; + /* + auto it=objectsMap.find(npObj); + if(it!=objectsMap.end()) + objectValue = it->second.get(); + else + */ + objectValue = new ppObjectObject(objectsMap, other); + break; + } + default: + LOG(LOG_NOT_IMPLEMENTED,"ppVariantObject for type:"<<(int)other.type); + type = EV_VOID; + break; + } +} +void ppVariantObject::ExtVariantToppVariant(std::map<const ExtObject *, PP_Var> &objectsMap, PP_Instance instance, const ExtVariant& value, PP_Var& variant) +{ + switch(value.getType()) + { + case EV_STRING: + { + const std::string& strValue = value.getString(); + variant = g_var_interface->VarFromUtf8(strValue.c_str(),strValue.length()); + break; + } + case EV_INT32: + variant = PP_MakeInt32(value.getInt()); + break; + case EV_DOUBLE: + variant = PP_MakeDouble(value.getDouble()); + break; + case EV_BOOLEAN: + variant = PP_MakeBool(value.getBoolean() ? PP_TRUE:PP_FALSE); + break; + case EV_OBJECT: + { + ExtObject* obj = value.getObject(); + variant = ppObjectObject::getppObject(objectsMap,instance, obj); + break; + } + case EV_NULL: + variant = PP_MakeNull(); + break; + case EV_VOID: + default: + variant = PP_MakeUndefined(); + break; + } +} + +// Type determination +ExtVariant::EV_TYPE ppVariantObject::getTypeS(const PP_Var& variant) +{ + switch(variant.type) + { + case PP_VARTYPE_UNDEFINED: + return EV_VOID; + case PP_VARTYPE_NULL: + return EV_NULL; + case PP_VARTYPE_BOOL: + return EV_BOOLEAN; + case PP_VARTYPE_INT32: + return EV_INT32; + case PP_VARTYPE_DOUBLE: + return EV_DOUBLE; + case PP_VARTYPE_STRING: + return EV_STRING; + case PP_VARTYPE_OBJECT: + return EV_OBJECT; + default: + return EV_VOID; + } +} + +ppObjectObject::ppObjectObject(std::map<int64_t, std::unique_ptr<ExtObject>>& objectsMap, PP_Var& obj) +{ + //First of all add this object to the map, so that recursive cycles may be broken + if(objectsMap.count(obj.value.as_id)==0) + objectsMap[obj.value.as_id] = move(unique_ptr<ExtObject>(this)); + + uint32_t property_count; + PP_Var* properties; + PP_Var exception = PP_MakeUndefined(); + g_var_deprecated_interface->GetAllPropertyNames(obj,&property_count,&properties,&exception); + uint32_t len; + if (exception.type == PP_VARTYPE_STRING) + { + LOG(LOG_ERROR,"exception during ppObjectObject::ppObjectObject GetAllPropertyNames:"<<g_var_interface->VarToUtf8(exception,&len)); + return; + } + ExtIdentifier id; + for (uint32_t i=0; i < property_count; i++) + { + PP_Var prop = properties[i]; + PP_Var value = g_var_deprecated_interface->GetProperty(obj,prop,&exception); + if (exception.type == PP_VARTYPE_STRING)
View file
lightspark.tar.xz/src/plugin_ppapi/plugin.h
Changed
@@ -3,45 +3,67 @@ #include "swf.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/pp_var.h" namespace lightspark { class ppDownloader; +class ppPluginInstance; -class ppDownloadManager: public lightspark::StandaloneDownloadManager +class ppDownloadManager: public StandaloneDownloadManager { private: PP_Instance instance; SystemState* m_sys; public: ppDownloadManager(PP_Instance _instance,SystemState* sys); - lightspark::Downloader* download(const lightspark::URLInfo& url, + Downloader* download(const URLInfo& url, _R<StreamCache> cache, - lightspark::ILoadable* owner); - lightspark::Downloader* downloadWithData(const lightspark::URLInfo& url, + ILoadable* owner); + Downloader* downloadWithData(const URLInfo& url, _R<StreamCache> cache, const std::vector<uint8_t>& data, - const std::list<tiny_string>& headers, lightspark::ILoadable* owner); - void destroy(lightspark::Downloader* downloader); + const std::list<tiny_string>& headers, ILoadable* owner); + void destroy(Downloader* downloader); }; -class ppDownloader: public lightspark::Downloader +class ppDownloader: public Downloader { private: bool isMainClipDownloader; SystemState* m_sys; + ppPluginInstance* m_pluginInstance; + uint32_t downloadedlength; PP_Resource ppurlloader; uint8_t buffer[4096]; + static void dlStartCallback(void* userdata,int result); static void dlReadResponseCallback(void* userdata,int result); public: enum STATE { INIT=0, STREAM_DESTROYED, ASYNC_DESTROY }; STATE state; //Constructor used for the main file - ppDownloader(const lightspark::tiny_string& _url, PP_Instance _instance, lightspark::ILoadable* owner, SystemState *sys); - ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> cache, PP_Instance _instance, lightspark::ILoadable* owner); - ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> cache, const std::vector<uint8_t>& _data, - const std::list<tiny_string>& headers, PP_Instance _instance, lightspark::ILoadable* owner); + ppDownloader(const tiny_string& _url, PP_Instance _instance, ILoadable* owner, ppPluginInstance* ppinstance); + ppDownloader(const tiny_string& _url, _R<StreamCache> cache, PP_Instance _instance, ILoadable* owner); + ppDownloader(const tiny_string& _url, _R<StreamCache> cache, const std::vector<uint8_t>& _data, + const std::list<tiny_string>& headers, PP_Instance _instance, ILoadable* owner); +}; + +class ppVariantObject : public ExtVariant +{ +public: + ppVariantObject(std::map<int64_t, std::unique_ptr<ExtObject>>& objectsMap, PP_Var &other); + static void ExtVariantToppVariant(std::map<const ExtObject*, PP_Var>& objectsMap, PP_Instance instance, const ExtVariant& value, PP_Var& variant); + + static EV_TYPE getTypeS(const PP_Var& variant); +}; + +class ppObjectObject : public ExtObject +{ +public: + ppObjectObject(std::map<int64_t, std::unique_ptr<ExtObject> > &objectsMap, PP_Var& obj); + + static PP_Var getppObject(std::map<const ExtObject*, PP_Var>& objectsMap, PP_Instance instance, const ExtObject* obj); }; class ppPluginInstance @@ -50,16 +72,21 @@ PP_Instance m_ppinstance; struct PP_Size m_last_size; PP_Resource m_graphics; - lightspark::SystemState* m_sys; + SystemState* m_sys; std::streambuf *mainDownloaderStreambuf; std::istream mainDownloaderStream; ppDownloader* mainDownloader; - //NPScriptObjectGW* scriptObject; - lightspark::ParseThread* m_pt; + ParseThread* m_pt; public: ppPluginInstance(PP_Instance instance, int16_t argc,const char* argn[],const char* argv[]); virtual ~ppPluginInstance(); void handleResize(PP_Resource view); + PP_Bool handleInputEvent(PP_Resource input_event); + bool executeScript(const std::string script, const ExtVariant **args, uint32_t argc, ASObject **result); + void executeScriptAsync(ExtScriptObject::HOST_CALL_DATA *data); + SystemState* getSystemState() const { return m_sys;} + void startMainParser(); + PP_Instance getppInstance() { return m_ppinstance; } }; class ppPluginEngineData: public EngineData @@ -68,11 +95,12 @@ ppPluginInstance* instance; public: SystemState* sys; - ppPluginEngineData(ppPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : EngineData(), instance(i),sys(_sys) + ACQUIRE_RELEASE_FLAG(inRendering); + ppPluginEngineData(ppPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : EngineData(), instance(i),sys(_sys),inRendering(false) { width = w; height = h; - needrenderthread=false; + //needrenderthread=false; } PP_Resource getGraphics() { return instance->m_graphics;} void stopMainDownload(); @@ -90,6 +118,8 @@ void InitOpenGL(); void DeinitOpenGL(); bool getGLError(uint32_t &errorCode) const; + uint8_t* getCurrentPixBuf() const; + uint8_t* switchCurrentPixBuf(uint32_t w, uint32_t h); void exec_glUniform1f(int location,float v0); void exec_glBindTexture_GL_TEXTURE_2D(uint32_t id); void exec_glVertexAttribPointer(uint32_t index,int32_t size, int32_t stride, const void* coords); @@ -120,10 +150,10 @@ void exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params); void exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer); void exec_glDeleteTextures(int32_t n,uint32_t* textures); - void exec_glDeleteBuffers(int32_t n,uint32_t* buffers); + void exec_glDeleteBuffers(); void exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA(); void exec_glActiveTexture_GL_TEXTURE0(); - void exec_glGenBuffers(int32_t n,uint32_t* buffers); + void exec_glGenBuffers(); void exec_glUseProgram(uint32_t program); int32_t exec_glGetUniformLocation(uint32_t program,const char* name); void exec_glUniform1i(int32_t location,int32_t v0); @@ -140,7 +170,7 @@ void exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param); void exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param); void exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param); - void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels); + void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels, uint32_t w, uint32_t curX, uint32_t curY); void exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data); };
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/pp_content_decryptor.h
Added
@@ -0,0 +1,548 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/pp_content_decryptor.idl modified Tue Oct 20 12:50:15 2015. */ + +#ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ +#define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * The <code>PP_DecryptTrackingInfo</code> struct contains necessary information + * that can be used to associate the decrypted block with a decrypt request + * and/or an input block. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_DecryptTrackingInfo { + /** + * Client-specified identifier for the associated decrypt request. By using + * this value, the client can associate the decrypted block with a decryption + * request. + */ + uint32_t request_id; + /** + * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource, + * this ID is identical at both the renderer side and the plugin side. + * In <code>PPB_ContentDecryptor_Private</code> calls, this is the ID of the + * buffer associated with the decrypted block/frame/samples. + * In <code>PPP_ContentDecryptor_Private</code> calls, this is the ID of a + * buffer that is no longer need at the renderer side, which can be released + * or recycled by the plugin. This ID can be 0 if there is no buffer to be + * released or recycled. + */ + uint32_t buffer_id; + /** + * Timestamp in microseconds of the associated block. By using this value, + * the client can associate the decrypted (and decoded) data with an input + * block. This is needed because buffers may be delivered out of order and + * not in response to the <code>request_id</code> they were provided with. + */ + int64_t timestamp; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 16); + +/** + * The <code>PP_DecryptSubsampleDescription</code> struct contains information + * to support subsample decryption. + * + * An input block can be split into several continuous subsamples. + * A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and + * cipher bytes in each subsample. For example, the following block has three + * subsamples: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 | + * + * For decryption, all of the cipher bytes in a block should be treated as a + * contiguous (in the subsample order) logical stream. The clear bytes should + * not be considered as part of decryption. + * + * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 | + * Decrypted stream: | decrypted1| decrypted2 | decrypted3 | + * + * After decryption, the decrypted bytes should be copied over the position + * of the corresponding cipher bytes in the original block to form the output + * block. Following the above example, the decrypted block should be: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | + */ +struct PP_DecryptSubsampleDescription { + /** + * Size in bytes of clear data in a subsample entry. + */ + uint32_t clear_bytes; + /** + * Size in bytes of encrypted data in a subsample entry. + */ + uint32_t cipher_bytes; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptSubsampleDescription, 8); + +/** + * The <code>PP_EncryptedBlockInfo</code> struct contains all the information + * needed to decrypt an encrypted block. + */ +struct PP_EncryptedBlockInfo { + /** + * Information needed by the client to track the block to be decrypted. + */ + struct PP_DecryptTrackingInfo tracking_info; + /** + * Size in bytes of data to be decrypted (data_offset included). + */ + uint32_t data_size; + /** + * Key ID of the block to be decrypted. + * + * For WebM the key ID can be as large as 2048 bytes in theory. But it's not + * used in current implementations. If we really need to support it, we should + * move key ID out as a separate parameter, e.g. as a <code>PP_Var</code>, or + * make the whole <code>PP_EncryptedBlockInfo</code> as a + * <code>PP_Resource</code>. + */ + uint8_t key_id[64]; + uint32_t key_id_size; + /** + * Initialization vector of the block to be decrypted. + */ + uint8_t iv[16]; + uint32_t iv_size; + /** + * Subsample information of the block to be decrypted. + * + * We need to have a fixed size of |subsamples| here. Choose 32 because it is + * sufficient for almost all real life scenarios. Note that in theory the + * number of subsamples could be larger than 32. If that happens, playback + * will fail. + */ + struct PP_DecryptSubsampleDescription subsamples[32]; + uint32_t num_subsamples; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 368); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_DecryptedFrameFormat</code> contains video frame formats. + */ +typedef enum { + PP_DECRYPTEDFRAMEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDFRAMEFORMAT_YV12 = 1, + PP_DECRYPTEDFRAMEFORMAT_I420 = 2 +} PP_DecryptedFrameFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4); + +/** + * <code>PP_DecryptedSampleFormat</code> contains audio sample formats. + */ +typedef enum { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +} PP_DecryptedSampleFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedSampleFormat, 4); + +/** + * The <code>PP_DecryptResult</code> enum contains decryption and decoding + * result constants. + */ +typedef enum { + /** The decryption (and/or decoding) operation finished successfully. */ + PP_DECRYPTRESULT_SUCCESS = 0, + /** The decryptor did not have the necessary decryption key. */ + PP_DECRYPTRESULT_DECRYPT_NOKEY = 1, + /** The input was accepted by the decoder but no frame(s) can be produced. */ + PP_DECRYPTRESULT_NEEDMOREDATA = 2, + /** An unexpected error happened during decryption. */ + PP_DECRYPTRESULT_DECRYPT_ERROR = 3, + /** An unexpected error happened during decoding. */ + PP_DECRYPTRESULT_DECODE_ERROR = 4 +} PP_DecryptResult; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptResult, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_DecryptedBlockInfo</code> struct contains the decryption result and + * tracking info associated with the decrypted block. + */ +struct PP_DecryptedBlockInfo { + /** + * Result of the decryption (and/or decoding) operation. + */ + PP_DecryptResult result; + /**
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/pp_private_font_charset.h
Added
@@ -0,0 +1,51 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/pp_private_font_charset.idl, + * modified Fri Sep 07 12:50:35 2012. + */ + +#ifndef PPAPI_C_PRIVATE_PP_PRIVATE_FONT_CHARSET_H_ +#define PPAPI_C_PRIVATE_PP_PRIVATE_FONT_CHARSET_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PRIVATEFONTCHARSET_ANSI = 0, + PP_PRIVATEFONTCHARSET_DEFAULT = 1, + PP_PRIVATEFONTCHARSET_SYMBOL = 2, + PP_PRIVATEFONTCHARSET_MAC = 77, + PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, + PP_PRIVATEFONTCHARSET_HANGUL = 129, + PP_PRIVATEFONTCHARSET_JOHAB = 130, + PP_PRIVATEFONTCHARSET_GB2312 = 134, + PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, + PP_PRIVATEFONTCHARSET_GREEK = 161, + PP_PRIVATEFONTCHARSET_TURKISH = 162, + PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, + PP_PRIVATEFONTCHARSET_HEBREW = 177, + PP_PRIVATEFONTCHARSET_ARABIC = 178, + PP_PRIVATEFONTCHARSET_BALTIC = 186, + PP_PRIVATEFONTCHARSET_RUSSIAN = 204, + PP_PRIVATEFONTCHARSET_THAI = 222, + PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, + PP_PRIVATEFONTCHARSET_OEM = 255 +} PP_PrivateFontCharset; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrivateFontCharset, 4); +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PP_PRIVATE_FONT_CHARSET_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/pp_video_capture_format.h
Added
@@ -0,0 +1,47 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/pp_video_capture_format.idl, + * modified Wed Feb 18 01:41:26 2015. + */ + +#ifndef PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_ +#define PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the struct used to hold a video capture format. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_VideoCaptureFormat</code> struct represents a video capture + * format. + */ +struct PP_VideoCaptureFormat { + /** + * Frame size in pixels. + */ + struct PP_Size frame_size; + /** + * Frame rate in frames per second. + */ + float frame_rate; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCaptureFormat, 12); +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PP_VIDEO_CAPTURE_FORMAT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/pp_video_frame_private.h
Added
@@ -0,0 +1,55 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/pp_video_frame_private.idl modified Wed Apr 24 11:49:01 2013. */ + +#ifndef PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +/** + * @file + * This file defines the struct used to hold a video frame. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_VideoFrame_Private</code> struct represents a video frame. + * Video sources and destinations use frames to transfer video to and from + * the browser. + */ +struct PP_VideoFrame_Private { + /** + * A timestamp placing the frame in a video stream. + */ + PP_TimeTicks timestamp; + /** + * An image data resource to hold the video frame. + */ + PP_Resource image_data; + /** + * Ensure that this struct is 16-bytes wide by padding the end. In some + * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this + * struct on 8-byte boundaries as well and pad it to 8 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoFrame_Private, 16); +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PP_VIDEO_FRAME_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_camera_capabilities_private.h
Added
@@ -0,0 +1,80 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_camera_capabilities_private.idl, + * modified Thu Feb 19 09:06:18 2015. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/private/pp_video_capture_format.h" + +#define PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1 \ + "PPB_CameraCapabilities_Private;0.1" +#define PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE \ + PPB_CAMERACAPABILITIES_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the PPB_CameraCapabilities_Private interface for + * establishing an image capture configuration resource within the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_CameraCapabilities_Private</code> interface contains pointers + * to several functions for getting the image capture capabilities within the + * browser. + */ +struct PPB_CameraCapabilities_Private_0_1 { + /** + * IsCameraCapabilities() determines if the given resource is a + * <code>PPB_CameraCapabilities_Private</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an image + * capture capabilities resource. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given + * resource is an <code>PP_CameraCapabilities_Private</code> resource, + * otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsCameraCapabilities)(PP_Resource resource); + /** + * GetSupportedVideoCaptureFormats() returns the supported video capture + * formats for the given <code>PPB_CameraCapabilities_Private</code>. + * + * @param[in] capabilities A <code>PP_Resource</code> corresponding to an + * image capture capabilities resource. + * @param[out] array_size The size of preview size array. + * @param[out] formats An array of <code>PP_VideoCaptureFormat</code> + * corresponding to the supported video capture formats. The ownership of the + * array belongs to <code>PPB_CameraCapabilities_Private</code> and the caller + * should not free it. When a PPB_CameraCapabilities_Private is deleted, the + * array returning from this is no longer valid. + */ + void (*GetSupportedVideoCaptureFormats)( + PP_Resource capabilities, + uint32_t* array_size, + struct PP_VideoCaptureFormat** formats); +}; + +typedef struct PPB_CameraCapabilities_Private_0_1 + PPB_CameraCapabilities_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_camera_device_private.h
Added
@@ -0,0 +1,118 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_camera_device_private.idl, + * modified Fri Feb 20 13:48:52 2015. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_CAMERADEVICE_PRIVATE_INTERFACE_0_1 "PPB_CameraDevice_Private;0.1" +#define PPB_CAMERADEVICE_PRIVATE_INTERFACE \ + PPB_CAMERADEVICE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * Defines the <code>PPB_CameraDevice_Private</code> interface. Used for + * manipulating a camera device. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * To query camera capabilities: + * 1. Get a PPB_CameraDevice_Private object by Create(). + * 2. Open() camera device with track id of MediaStream video track. + * 3. Call GetCameraCapabilities() to get a + * <code>PPB_CameraCapabilities_Private</code> object, which can be used to + * query camera capabilities. + */ +struct PPB_CameraDevice_Private_0_1 { + /** + * Creates a PPB_CameraDevice_Private resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> corresponding to a + * PPB_CameraDevice_Private resource if successful, 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a camera device resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a camera device resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsCameraDevice)(PP_Resource resource); + /** + * Opens a camera device. + * + * @param[in] camera_device A <code>PP_Resource</code> corresponding to a + * camera device resource. + * @param[in] device_id A <code>PP_Var</code> identifying a camera device. The + * type is string. The ID can be obtained from MediaStreamTrack.getSources() + * or MediaStreamVideoTrack.id. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Open()</code>. + * + * @return An error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Resource camera_device, + struct PP_Var device_id, + struct PP_CompletionCallback callback); + /** + * Disconnects from the camera and cancels all pending requests. + * After this returns, no callbacks will be called. If <code> + * PPB_CameraDevice_Private</code> is destroyed and is not closed yet, this + * function will be automatically called. Calling this more than once has no + * effect. + * + * @param[in] camera_device A <code>PP_Resource</code> corresponding to a + * camera device resource. + */ + void (*Close)(PP_Resource camera_device); + /** + * Gets the camera capabilities. + * + * The camera capabilities do not change for a given camera source. + * + * @param[in] camera_device A <code>PP_Resource</code> corresponding to a + * camera device resource. + * @param[out] capabilities A <code>PPB_CameraCapabilities_Private</code> for + * storing the camera capabilities on success. Otherwise, the value will not + * be changed. + * @param[in] callback <code>PP_CompletionCallback</code> to be called upon + * completion of <code>GetCameraCapabilities()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*GetCameraCapabilities)(PP_Resource camera_device, + PP_Resource* capabilities, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_CameraDevice_Private_0_1 PPB_CameraDevice_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_CAMERA_DEVICE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_content_decryptor_private.h
Added
@@ -0,0 +1,317 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_content_decryptor_private.idl, + * modified Mon Mar 30 22:35:33 2015. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_content_decryptor.h" + +#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_14 \ + "PPB_ContentDecryptor_Private;0.14" +#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_14 + +/** + * @file + * This file defines the <code>PPB_ContentDecryptor_Private</code> + * interface. Note: This is a special interface, only to be used for Content + * Decryption Modules, not normal plugins. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_ContentDecryptor_Private</code> structure contains the function + * pointers the browser must implement to support plugins implementing the + * <code>PPP_ContentDecryptor_Private</code> interface. This interface provides + * browser side support for the Content Decryption Module (CDM) for Encrypted + * Media Extensions: http://www.w3.org/TR/encrypted-media/ + */ +struct PPB_ContentDecryptor_Private_0_14 { + /** + * A promise has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + */ + void (*PromiseResolved)(PP_Instance instance, uint32_t promise_id); + /** + * A promise that resulted in a new session has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute. + */ + void (*PromiseResolvedWithSession)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var session_id); + /** + * A promise has been rejected by the CDM due to an error. + * + * @param[in] promise_id Identifies the promise that the CDM rejected. + * + * @param[in] exception_code A <code>PP_CdmExceptionCode</code> containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the error description. + */ + void (*PromiseRejected)(PP_Instance instance, + uint32_t promise_id, + PP_CdmExceptionCode exception_code, + uint32_t system_code, + struct PP_Var error_description); + /** + * A message or request has been generated for key_system in the CDM, and + * must be sent to the web application. + * + * For example, when the browser invokes <code>CreateSession()</code> + * on the <code>PPP_ContentDecryptor_Private</code> interface, the plugin + * must send a message containing the license request. + * + * Note that <code>SessionMessage()</code> can be used for purposes other than + * responses to <code>CreateSession()</code> calls. See also the text + * in the comment for <code>SessionReady()</code>, which describes a sequence + * of <code>UpdateSession()</code> and <code>SessionMessage()</code> calls + * required to prepare for decryption. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the ID of a session for + * which this message is intended. + * + * @param[in] message_type A <code>PP_CdmMessageType</code> containing the + * message type. + * + * @param[in] message A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message. + * + * @param[in] legacy_destination_url A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the destination URL for the + * message. + */ + void (*SessionMessage)(PP_Instance instance, + struct PP_Var session_id, + PP_CdmMessageType message_type, + struct PP_Var message, + struct PP_Var legacy_destination_url); + /** + * The keys for a session have changed. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has + * a change in keys. + * + * @param[in] has_additional_usable_key A <code>PP_Bool</code> indicating if + * a new usable key has been added. + * + * @param[in] key_count The number of arguments contained in + * <code>key_information</code> + * + * @param[in] key_information An array of type <code>PP_KeyInformation</code> + * that are the session's key IDs and their status. + */ + void (*SessionKeysChange)(PP_Instance instance, + struct PP_Var session_id, + PP_Bool has_additional_usable_key, + uint32_t key_count, + const struct PP_KeyInformation key_information[]); + /** + * The expiration time for a session has changed. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has + * a new expiration time. + * + * @param[in] new_expiry_time A <code>PP_Time</code> indicating the new + * expiry time of the session. The value is defined as the number of seconds + * since the Epoch (00:00:00 UTC, January 1, 1970). + */ + void (*SessionExpirationChange)(PP_Instance instance, + struct PP_Var session_id, + PP_Time new_expiry_time); + /** + * The session has been closed as the result of a call to the + * <code>ReleaseSession()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface, or due to other + * factors as determined by the CDM. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute of + * the session that is now closed. + */ + void (*SessionClosed)(PP_Instance instance, struct PP_Var session_id); + /** + * An error occurred in a <code>PPP_ContentDecryptor_Private</code> method, + * or within the plugin implementing the interface. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute of + * the session that caused the error. + * + * @param[in] exception_code A <code>PP_CdmExceptionCode</code> containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the error description. + */ + void (*LegacySessionError)(PP_Instance instance, + struct PP_Var session_id, + PP_CdmExceptionCode exception_code, + uint32_t system_code, + struct PP_Var error_description); + /** + * Called after the <code>Decrypt()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to + * deliver decrypted_block to the browser for decoding and rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>Decrypt()</code> when it calls this method. The browser + * will reuse the buffer in a subsequent <code>Decrypt()</code> call. + * + * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data + * block. + * + * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that + * contains the result code and tracking info associated with the + * <code>decrypted_block</code>. + */ + void (*DeliverBlock)(
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_display_color_profile_private.h
Added
@@ -0,0 +1,123 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_display_color_profile_private.idl, + * modified Mon Dec 16 20:53:23 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE_0_1 \ + "PPB_DisplayColorProfile_Private;0.1" +#define PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE \ + PPB_DISPLAYCOLORPROFILE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_DisplayColorProfile</code> struct used for + * getting the color profile of the display. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_DisplayColorProfile_Private</code> defines the methods for getting + * the display color profile and monitoring its changes. + * + * <strong>Setup:<strong> + * @code + * PP_ArrayOutput output = { MyAllocatorFunction, color_profile_data }; + * PP_Resource display_cp = display_cp_interface->Create(instance); + * display_cp_interface->GetColorProfile(display_cp, + * output, + * completion_callback); + * @endcode + */ +struct PPB_DisplayColorProfile_Private_0_1 { + /** + * Create() creates a display color profile resource. + * + * @param[in] instance The module instance. + * @return A <code>PP_Resource</code> containing a display color profile + * resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsDisplayColorProfile() determines if the given resource is a valid + * <code>DisplayColorProfile</code> resource. + * + * @param[in] resource A <code>DisplayColorProfile</code> context resource. + * @return Returns: + * - <code>PP_TRUE</code> if the given resource is a valid + * <code>DisplayColorProfile</code> + * - <code>PP_FALSE</code> if it is an invalid resource or is a resource + * of another type. + */ + PP_Bool (*IsDisplayColorProfile)(PP_Resource resource); + /** + * GetColorProfile() enqueues a request for the current display color profile. + * + * This method is intended for getting the color profile data of the display + * on which the browser window resides. [However currently Chrome only + * considers the system's primary display color profile when doing its color + * management. For consistency this method will also return the color profile + * that Chrome uses for its browser window.] + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] color_profile A <code>PP_OutputArray</code> which on success + * will receive a byte array containing the ICC color profile data (see + * www.color.org for a reference to the ICC color profile specification + * and versions). The returned color profile version is the one supported by + * the host system. + * @param[in] callback The completion callback to be called once the display + * color profile data is available. + * + * @return Returns an error code from <code>pp_errors.h</code>. + */ + int32_t (*GetColorProfile)(PP_Resource display_color_profile_res, + struct PP_ArrayOutput color_profile, + struct PP_CompletionCallback callback); + /** + * RegisterColorProfileChangeCallback() registers a callback to be called next + * time the color profile for the browser window in which the plugin resides + * changes. In order to get notifications for all color profile changes a call + * to RegisterColorProfileChangeCallback() function should be done when the + * previous notification was fired. + * + * There might be 2 scenarios in which the color profile for a window changes: + * a) The window is moved from one display to another; + * b) The user changes the display color space from the system settings. + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] callback The callback to be invoked next time the display + * color profile changes. + * + * @return Returns an error code from <code>pp_errors.h</code>. + */ + int32_t (*RegisterColorProfileChangeCallback)( + PP_Resource display_color_profile_res, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_DisplayColorProfile_Private_0_1 + PPB_DisplayColorProfile_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_DISPLAY_COLOR_PROFILE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_find_private.h
Added
@@ -0,0 +1,81 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_find_private.idl modified Wed Mar 19 13:42:13 2014. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FIND_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_FIND_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FIND_PRIVATE_INTERFACE_0_3 "PPB_Find_Private;0.3" +#define PPB_FIND_PRIVATE_INTERFACE PPB_FIND_PRIVATE_INTERFACE_0_3 + +/** + * @file + * This file defines the <code>PPB_Find_Private</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This is a private interface for doing browser Find in the PDF plugin. + */ +struct PPB_Find_Private_0_3 { + /** + * Sets the instance of this plugin as the mechanism that will be used to + * handle find requests in the renderer. This will only succeed if the plugin + * is embedded within the content of the top level frame. Note that this will + * result in the renderer handing over all responsibility for doing find to + * the plugin and content from the rest of the page will not be searched. + * + * + * In the case that the plugin is loaded directly as the top level document, + * this function does not need to be called. In that case the plugin is + * assumed to handle find requests. + * + * There can only be one plugin which handles find requests. If a plugin calls + * this while an existing plugin is registered, the existing plugin will be + * de-registered and will no longer receive any requests. + */ + void (*SetPluginToHandleFindRequests)(PP_Instance instance); + /** + * Updates the number of find results for the current search term. If + * there are no matches 0 should be passed in. Only when the plugin has + * finished searching should it pass in the final count with final_result set + * to PP_TRUE. + */ + void (*NumberOfFindResultsChanged)(PP_Instance instance, + int32_t total, + PP_Bool final_result); + /** + * Updates the index of the currently selected search item. + */ + void (*SelectedFindResultChanged)(PP_Instance instance, int32_t index); + /** + * Updates the tickmarks on the scrollbar for the find request. |tickmarks| + * contains |count| PP_Rects indicating the tickmark ranges. + */ + void (*SetTickmarks)(PP_Instance instance, + const struct PP_Rect tickmarks[], + uint32_t count); +}; + +typedef struct PPB_Find_Private_0_3 PPB_Find_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FIND_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash.h
Added
@@ -0,0 +1,346 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash.idl modified Thu Apr 18 15:06:12 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" + +#define PPB_FLASH_INTERFACE_12_4 "PPB_Flash;12.4" +#define PPB_FLASH_INTERFACE_12_5 "PPB_Flash;12.5" +#define PPB_FLASH_INTERFACE_12_6 "PPB_Flash;12.6" +#define PPB_FLASH_INTERFACE_13_0 "PPB_Flash;13.0" +#define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_13_0 + +/** + * @file + * This file contains the <code>PPB_Flash</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * No restrictions on Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_NONE = 1, + /** + * Don't allow access to Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_BLOCK = 2, + /** + * Store Flash LSOs in memory only. + */ + PP_FLASHLSORESTRICTIONS_IN_MEMORY = 3 +} PP_FlashLSORestrictions; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashLSORestrictions, 4); + +typedef enum { + /** + * Specifies if the system likely supports 3D hardware acceleration. + * + * The result is a boolean PP_Var, depending on the supported nature of 3D + * acceleration. If querying this function returns true, the 3D system will + * normally use the native hardware for rendering which will be much faster. + * + * Having this set to true only means that 3D should be used to draw 2D and + * video elements. PP_FLASHSETTING_STAGE3D_ENABLED should be checked to + * determine if it's ok to use 3D for arbitrary content. + * + * In rare cases (depending on the platform) this value will be true but a + * created 3D context will use emulation because context initialization + * failed. + */ + PP_FLASHSETTING_3DENABLED = 1, + /** + * Specifies if the given instance is in private/incognito/off-the-record mode + * (returns true) or "regular" mode (returns false). Returns an undefined + * PP_Var on invalid instance. + */ + PP_FLASHSETTING_INCOGNITO = 2, + /** + * Specifies if arbitrary 3d commands are supported (returns true), or if 3d + * should only be used for drawing 2d and video (returns false). + * + * This should only be enabled if PP_FLASHSETTING_3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DENABLED = 3, + /** + * Specifies the string for the language code of the UI of the browser. + * + * For example: "en-US" or "de". + * + * Returns an undefined PP_Var on invalid instance. + */ + PP_FLASHSETTING_LANGUAGE = 4, + /** + * Specifies the number of CPU cores that are present on the system. + */ + PP_FLASHSETTING_NUMCORES = 5, + /** + * Specifies restrictions on how flash should handle LSOs. The result is an + * int from <code>PP_FlashLSORestrictions</code>. + */ + PP_FLASHSETTING_LSORESTRICTIONS = 6, + /** + * Specifies if the driver is reliable enough to use Shader Model 3 commands + * with it. + * + * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7 +} PP_FlashSetting; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4); + +/** + * This enum provides keys for setting breakpad crash report data. + */ +typedef enum { + /** + * Specifies the document URL which contains the flash instance. + */ + PP_FLASHCRASHKEY_URL = 1, + /** + * Specifies the URL of the current swf. + */ + PP_FLASHCRASHKEY_RESOURCE_URL = 2 +} PP_FlashCrashKey; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashCrashKey, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Flash</code> interface contains pointers to various functions + * that are only needed to support Pepper Flash. + */ +struct PPB_Flash_13_0 { + /** + * Sets or clears the rendering hint that the given plugin instance is always + * on top of page content. Somewhat more optimized painting can be used in + * this case. + */ + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + /** + * Draws the given pre-laid-out text. It is almost equivalent to Windows' + * ExtTextOut with the addition of the transformation (a 3x3 matrix given the + * transform to apply before drawing). It also adds the allow_subpixel_aa + * flag which when true, will use subpixel antialiasing if enabled in the + * system settings. For this to work properly, the graphics layer that the + * text is being drawn into must be opaque. + */ + PP_Bool (*DrawGlyphs)( + PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const struct PP_Point* position, + const struct PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format, or an undefined var on error. + */ + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + /** + * Navigate to the URL given by the given URLRequestInfo. (This supports GETs, + * POSTs, and javascript: URLs.) May open a new tab if target is not "_self". + */ + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + /** + * Retrieves the local time zone offset from GM time for the given UTC time. + */ + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + /** + * Gets a (string) with "command-line" options for Flash; used to pass + * run-time debugging parameters, etc. + */ + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + /** + * Loads the given font in a more privileged process on Windows. Call this if + * Windows is giving errors for font calls. See + * content/renderer/font_cache_dispatcher_win.cc + * + * The parameter is a pointer to a LOGFONTW structure. + * + * On non-Windows platforms, this function does nothing. + */ + void (*PreloadFontWin)(const void* logfontw); + /** + * Returns whether the given rectangle (in the plugin) is topmost, i.e., above
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_clipboard.h
Added
@@ -0,0 +1,180 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_clipboard.idl modified Thu Jan 23 10:16:39 2014. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FLASH_CLIPBOARD_INTERFACE_4_0 "PPB_Flash_Clipboard;4.0" +#define PPB_FLASH_CLIPBOARD_INTERFACE_5_0 "PPB_Flash_Clipboard;5.0" +#define PPB_FLASH_CLIPBOARD_INTERFACE_5_1 "PPB_Flash_Clipboard;5.1" +#define PPB_FLASH_CLIPBOARD_INTERFACE PPB_FLASH_CLIPBOARD_INTERFACE_5_1 + +/** + * @file + * This file defines the private <code>PPB_Flash_Clipboard</code> API used by + * Pepper Flash for reading and writing to the clipboard. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types of clipboards that can be accessed. + * These types correspond to clipboard types in WebKit. + */ +typedef enum { + /** The standard clipboard. */ + PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, + /** The selection clipboard (e.g., on Linux). */ + PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 +} PP_Flash_Clipboard_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4); + +/** + * This enumeration contains the predefined clipboard data formats. + */ +typedef enum { + /** Indicates an invalid or unsupported clipboard data format. */ + PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, + /** + * Indicates plaintext clipboard data. The format expected/returned is a + * <code>PP_VARTYPE_STRING</code>. + */ + PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, + /** + * Indicates HTML clipboard data. The format expected/returned is a + * <code>PP_VARTYPE_STRING</code>. + */ + PP_FLASH_CLIPBOARD_FORMAT_HTML = 2, + /** + * Indicates RTF clipboard data. The format expected/returned is a + * <code>PP_VARTYPE_ARRAY_BUFFER</code>. + */ + PP_FLASH_CLIPBOARD_FORMAT_RTF = 3 +} PP_Flash_Clipboard_Format; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Format, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions + * used by Pepper Flash to access the clipboard. + * + */ +struct PPB_Flash_Clipboard_5_1 { + /** + * Registers a custom clipboard format. The format is identified by a + * string. An id identifying the format will be returned if the format is + * successfully registered, which can be used to read/write data of that + * format. If the format has already been registered, the id associated with + * that format will be returned. If the format fails to be registered + * <code>PP_FLASH_CLIPBOARD_FORMAT_INVALID</code> will be returned. + * + * All custom data should be read/written as <code>PP_Var</code> array + * buffers. The clipboard format is pepper-specific meaning that although the + * data will be stored on the system clipboard, it can only be accessed in a + * sensible way by using the pepper API. Data stored in custom formats can + * be safely shared between different applications that use pepper. + */ + uint32_t (*RegisterCustomFormat)(PP_Instance instance_id, + const char* format_name); + /** + * Checks whether a given data format is available from the given clipboard. + * Returns true if the given format is available from the given clipboard. + */ + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + /** + * Reads data in the given <code>format</code> from the clipboard. An + * undefined <code>PP_Var</code> is returned if there is an error in reading + * the clipboard data and a null <code>PP_Var</code> is returned if there is + * no data of the specified <code>format</code> to read. + */ + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + /** + * Writes the given array of data items to the clipboard. All existing + * clipboard data in any format is erased before writing this data. Thus, + * passing an array of size 0 has the effect of clearing the clipboard without + * writing any data. Each data item in the array should have a different + * <code>PP_Flash_Clipboard_Format</code>. If multiple data items have the + * same format, only the last item with that format will be written. + * If there is an error writing any of the items in the array to the + * clipboard, none will be written and an error code is returned. + * The error code will be <code>PP_ERROR_NOSPACE</code> if the value is + * too large to be written, <code>PP_ERROR_BADARGUMENT</code> if a PP_Var + * cannot be converted into the format supplied or <code>PP_FAILED</code> + * if the format is not supported. + */ + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const uint32_t formats[], + const struct PP_Var data_items[]); + /** + * Gets a sequence number which uniquely identifies clipboard state. This can + * be used to version the data on the clipboard and determine whether it has + * changed. The sequence number will be placed in |sequence_number| and + * PP_TRUE returned if the sequence number was retrieved successfully. + */ + PP_Bool (*GetSequenceNumber)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint64_t* sequence_number); +}; + +typedef struct PPB_Flash_Clipboard_5_1 PPB_Flash_Clipboard; + +struct PPB_Flash_Clipboard_4_0 { + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + PP_Flash_Clipboard_Format format); + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + PP_Flash_Clipboard_Format format); + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const PP_Flash_Clipboard_Format formats[], + const struct PP_Var data_items[]); +}; + +struct PPB_Flash_Clipboard_5_0 { + uint32_t (*RegisterCustomFormat)(PP_Instance instance_id, + const char* format_name); + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const uint32_t formats[], + const struct PP_Var data_items[]); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_device_id.h
Added
@@ -0,0 +1,52 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_device_id.idl modified Tue May 14 10:55:27 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_DEVICE_ID_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_DEVICE_ID_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FLASH_DEVICEID_INTERFACE_1_0 "PPB_Flash_DeviceID;1.0" +#define PPB_FLASH_DEVICEID_INTERFACE PPB_FLASH_DEVICEID_INTERFACE_1_0 + +/** + * @file + * This file contains the <code>PPB_Flash_DeviceID</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* TODO(raymes): This is deprecated by the PPB_Flash_DRM interface. Remove this + * interface after a few versions of Chrome have passed. */ +struct PPB_Flash_DeviceID_1_0 { + PP_Resource (*Create)(PP_Instance instance); + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + int32_t (*GetDeviceID)(PP_Resource device_id, + struct PP_Var* id, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_DeviceID_1_0 PPB_Flash_DeviceID; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_DEVICE_ID_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_drm.h
Added
@@ -0,0 +1,93 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_drm.idl modified Mon Nov 11 14:49:53 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_DRM_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_DRM_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FLASH_DRM_INTERFACE_1_0 "PPB_Flash_DRM;1.0" +#define PPB_FLASH_DRM_INTERFACE_1_1 "PPB_Flash_DRM;1.1" +#define PPB_FLASH_DRM_INTERFACE PPB_FLASH_DRM_INTERFACE_1_1 + +/** + * @file + * This file contains the <code>PPB_Flash_DRM</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A resource for performing Flash DRM-related operations. + */ +struct PPB_Flash_DRM_1_1 { + /** + * Creates a PPB_Flash_DRM resource for performing DRM-related operations in + * Flash. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + int32_t (*GetDeviceID)(PP_Resource drm, + struct PP_Var* id, + struct PP_CompletionCallback callback); + /** + * Windows and Mac only. Synchronously outputs the HMONITOR or + * CGDirectDisplayID corresponding to the monitor on which the plugin instance + * is displayed in |hmonitor|. This value is queried asynchronously and this + * will return PP_FALSE if the value is not yet available or an error + * occurred. PP_TRUE is returned on success. + */ + PP_Bool (*GetHmonitor)(PP_Resource drm, int64_t* hmonitor); + /** + * Asynchronously returns a PPB_FileRef resource in |file_ref| which points to + * the Voucher file for performing DRM verification. |callback| will be called + * upon completion. + */ + int32_t (*GetVoucherFile)(PP_Resource drm, + PP_Resource* file_ref, + struct PP_CompletionCallback callback); + /** + * Asynchronously returns a value indicating whether the monitor on which the + * plugin instance is displayed is external. |callback| will be called upon + * completion. + */ + int32_t (*MonitorIsExternal)(PP_Resource drm, + PP_Bool* is_external, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_DRM_1_1 PPB_Flash_DRM; + +struct PPB_Flash_DRM_1_0 { + PP_Resource (*Create)(PP_Instance instance); + int32_t (*GetDeviceID)(PP_Resource drm, + struct PP_Var* id, + struct PP_CompletionCallback callback); + PP_Bool (*GetHmonitor)(PP_Resource drm, int64_t* hmonitor); + int32_t (*GetVoucherFile)(PP_Resource drm, + PP_Resource* file_ref, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_DRM_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_file.h
Added
@@ -0,0 +1,114 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_ + +#include <stdint.h> + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/private/pp_file_handle.h" + +struct PP_FileInfo; + +struct PP_DirEntry_Dev { + const char* name; + PP_Bool is_dir; +}; + +struct PP_DirContents_Dev { + int32_t count; + struct PP_DirEntry_Dev* entries; +}; + +// PPB_Flash_File_ModuleLocal -------------------------------------------------- +#define PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 "PPB_Flash_File_ModuleLocal;3" +#define PPB_FLASH_FILE_MODULELOCAL_INTERFACE \ + PPB_FLASH_FILE_MODULELOCAL_INTERFACE_3_0 + +// This interface provides (for Flash) synchronous access to module-local files. +// Module-local file paths are '/'-separated UTF-8 strings, relative to a +// module-specific root. +struct PPB_Flash_File_ModuleLocal_3_0 { + // Deprecated. Returns true. + bool (*CreateThreadAdapterForInstance)(PP_Instance instance); + // Deprecated. Does nothing. + void (*ClearThreadAdapterForInstance)(PP_Instance instance); + + // Opens a file, returning a file descriptor (posix) or a HANDLE (win32) into + // file. The return value is the ppapi error, PP_OK if success, one of the + // PP_ERROR_* in case of failure. + int32_t (*OpenFile)(PP_Instance instance, + const char* path, + int32_t mode, + PP_FileHandle* file); + + // Renames a file. The return value is the ppapi error, PP_OK if success, one + // of the PP_ERROR_* in case of failure. + int32_t (*RenameFile)(PP_Instance instance, + const char* path_from, + const char* path_to); + + // Deletes a file or directory. If recursive is set and the path points to a + // directory, deletes all the contents of the directory. The return value is + // the ppapi error, PP_OK if success, one of the PP_ERROR_* in case of + // failure. + int32_t (*DeleteFileOrDir)(PP_Instance instance, + const char* path, + PP_Bool recursive); + + // Creates a directory. The return value is the ppapi error, PP_OK if success, + // one of the PP_ERROR_* in case of failure. + int32_t (*CreateDir)(PP_Instance instance, const char* path); + + // Queries information about a file. The return value is the ppapi error, + // PP_OK if success, one of the PP_ERROR_* in case of failure. + int32_t (*QueryFile)(PP_Instance instance, + const char* path, + struct PP_FileInfo* info); + + // Gets the list of files contained in a directory. The return value is the + // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. If + // non-NULL, the returned contents should be freed with FreeDirContents. + int32_t (*GetDirContents)(PP_Instance instance, + const char* path, + struct PP_DirContents_Dev** contents); + + // Frees the data allocated by GetDirContents. + void (*FreeDirContents)(PP_Instance instance, + struct PP_DirContents_Dev* contents); + + // Creates a temporary file. The file will be automatically deleted when all + // handles to it are closed. + // Returns PP_OK if successful, one of the PP_ERROR_* values in case of + // failure. + // + // If successful, |file| is set to a file descriptor (posix) or a HANDLE + // (win32) to the file. If failed, |file| is not touched. + int32_t (*CreateTemporaryFile)(PP_Instance instance, PP_FileHandle* file); +}; + +typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal; + +// PPB_Flash_File_FileRef ------------------------------------------------------ + +#define PPB_FLASH_FILE_FILEREF_INTERFACE "PPB_Flash_File_FileRef;2" + +// This interface provides (for Flash) synchronous access to files whose paths +// are given by a Pepper FileRef. Such FileRefs are typically obtained via the +// Pepper file chooser. +struct PPB_Flash_File_FileRef { + // The functions below correspond exactly to their module-local counterparts + // (except in taking FileRefs instead of paths, of course). We omit the + // functionality which we do not provide for FileRefs. + int32_t (*OpenFile)(PP_Resource file_ref_id, + int32_t mode, + PP_FileHandle* file); + int32_t (*QueryFile)(PP_Resource file_ref_id, + struct PP_FileInfo* info); +}; + +#endif // PPAPI_C_PRIVATE_PPB_FLASH_FILE_H_
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_font_file.h
Added
@@ -0,0 +1,80 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_font_file.idl modified Fri Oct 23 10:34:57 2015. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_private_font_charset.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" + +#define PPB_FLASH_FONTFILE_INTERFACE_0_1 "PPB_Flash_FontFile;0.1" +#define PPB_FLASH_FONTFILE_INTERFACE_0_2 "PPB_Flash_FontFile;0.2" +#define PPB_FLASH_FONTFILE_INTERFACE PPB_FLASH_FONTFILE_INTERFACE_0_2 + +/** + * @file + * This file contains the <code>PPB_Flash_FontFile</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Flash_FontFile_0_2 { + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + */ + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + /* Determines if a given resource is Flash font file. + */ + PP_Bool (*IsFlashFontFile)(PP_Resource resource); + /* Returns the requested font table. + * |output_length| should pass in the size of |output|. And it will return + * the actual length of returned data. |output| could be NULL in order to + * query the size of the buffer size needed. In that case, the input value of + * |output_length| is ignored. + * Note: it is Linux only and fails directly on other platforms. + */ + PP_Bool (*GetFontTable)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); + /** + * Returns whether <code>PPB_Flash_FontFile</code> is supported on Windows. + */ + PP_Bool (*IsSupportedForWindows)(void); +}; + +typedef struct PPB_Flash_FontFile_0_2 PPB_Flash_FontFile; + +struct PPB_Flash_FontFile_0_1 { + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + PP_Bool (*IsFlashFontFile)(PP_Resource resource); + PP_Bool (*GetFontTable)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_FONT_FILE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_fullscreen.h
Added
@@ -0,0 +1,67 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_fullscreen.idl modified Tue Sep 11 13:52:24 2012. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FLASHFULLSCREEN_INTERFACE_0_1 "PPB_FlashFullscreen;0.1" +#define PPB_FLASHFULLSCREEN_INTERFACE_1_0 "PPB_FlashFullscreen;1.0" +#define PPB_FLASHFULLSCREEN_INTERFACE PPB_FLASHFULLSCREEN_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_FlashFullscreen</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FlashFullscreen_1_0 { + /** + * Checks whether the plugin instance is currently in fullscreen mode. + */ + PP_Bool (*IsFullscreen)(PP_Instance instance); + /** + * Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on + * success, PP_FALSE on failure. + * + * This does not unbind the current Graphics2D or Graphics3D. Pending flushes + * and swapbuffers will execute as if the resource was off-screen. The + * transition is asynchronous. During the transition, IsFullscreen will + * return PP_FALSE, and no Graphics2D or Graphics3D can be bound. The + * transition ends at the next DidChangeView when going into fullscreen mode. + * The transition out of fullscreen mode is synchronous. + */ + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + /** + * Gets the size of the screen in pixels. When going fullscreen, the instance + * will be resized to that size. + */ + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; + +typedef struct PPB_FlashFullscreen_1_0 PPB_FlashFullscreen; + +struct PPB_FlashFullscreen_0_1 { + PP_Bool (*IsFullscreen)(PP_Instance instance); + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_FULLSCREEN_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_menu.h
Added
@@ -0,0 +1,97 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_menu.idl modified Tue Dec 11 13:47:09 2012. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +/* Struct prototypes */ +struct PP_Flash_Menu; + +#define PPB_FLASH_MENU_INTERFACE_0_2 "PPB_Flash_Menu;0.2" +#define PPB_FLASH_MENU_INTERFACE PPB_FLASH_MENU_INTERFACE_0_2 + +/** + * @file + * This file defines the <code>PPB_Flash_Menu</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/* Menu item type. + * + * TODO(viettrungluu): Radio items not supported yet. Will also probably want + * special menu items tied to clipboard access. + */ +typedef enum { + PP_FLASH_MENUITEM_TYPE_NORMAL = 0, + PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1, + PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2, + PP_FLASH_MENUITEM_TYPE_SUBMENU = 3 +} PP_Flash_MenuItem_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_MenuItem_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Flash_MenuItem { + PP_Flash_MenuItem_Type type; + char* name; + int32_t id; + PP_Bool enabled; + PP_Bool checked; + struct PP_Flash_Menu* submenu; +}; + +struct PP_Flash_Menu { + uint32_t count; + struct PP_Flash_MenuItem *items; +}; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Flash_Menu_0_2 { + PP_Resource (*Create)(PP_Instance instance_id, + const struct PP_Flash_Menu* menu_data); + PP_Bool (*IsFlashMenu)(PP_Resource resource_id); + /* Display a context menu at the given location. If the user selects an item, + * |selected_id| will be set to its |id| and the callback called with |PP_OK|. + * If the user dismisses the menu without selecting an item, + * |PP_ERROR_USERCANCEL| will be indicated. + */ + int32_t (*Show)(PP_Resource menu_id, + const struct PP_Point* location, + int32_t* selected_id, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_Menu_0_2 PPB_Flash_Menu; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_MENU_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_message_loop.h
Added
@@ -0,0 +1,94 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_message_loop.idl modified Tue Jan 17 17:48:30 2012. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FLASH_MESSAGELOOP_INTERFACE_0_1 "PPB_Flash_MessageLoop;0.1" +#define PPB_FLASH_MESSAGELOOP_INTERFACE PPB_FLASH_MESSAGELOOP_INTERFACE_0_1 + +/** + * @file + * This file contains the <code>PPB_Flash_MessageLoop</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Flash_MessageLoop</code> interface supports Pepper Flash to run + * nested message loops. + */ +struct PPB_Flash_MessageLoop_0_1 { + /** + * Allocates a Flash message loop resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> that can be used to run a nested message + * loop if successful; 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a Flash message loop. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a generic + * resource. + * + * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given + * resource is a Flash message loop, otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsFlashMessageLoop)(PP_Resource resource); + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used in places where Flash would normally enter a nested + * message loop (e.g., when displaying context menus), but Pepper provides + * only an asynchronous call. After performing that asynchronous call, call + * <code>Run()</code>. In the callback, call <code>Quit()</code>. + * + * For a given message loop resource, only the first call to + * <code>Run()</code> will start a nested message loop. The subsequent calls + * will return <code>PP_ERROR_FAILED</code> immediately. + * + * @param[in] flash_message_loop The Flash message loop. + * + * @return <code>PP_ERROR_ABORTED</code> if the message loop quits because the + * resource is destroyed; <code>PP_OK</code> if the message loop quits because + * of other reasons (e.g., <code>Quit()</code> is called); + * <code>PP_ERROR_FAILED</code> if this is not the first call to + * <code>Run()</code>. + */ + int32_t (*Run)(PP_Resource flash_message_loop); + /** + * Signals to quit the outermost nested message loop. Use this to exit and + * return back to the caller after you call <code>Run()</code>. + * + * If <code>Quit()</code> is not called to balance the call to + * <code>Run()</code>, the outermost nested message loop will be quitted + * implicitly when the resource is destroyed. + * + * @param[in] flash_message_loop The Flash message loop. + */ + void (*Quit)(PP_Resource flash_message_loop); +}; + +typedef struct PPB_Flash_MessageLoop_0_1 PPB_Flash_MessageLoop; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_flash_print.h
Added
@@ -0,0 +1,45 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_flash_print.idl modified Tue Apr 24 16:55:10 2012. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FLASH_PRINT_H_ +#define PPAPI_C_PRIVATE_PPB_FLASH_PRINT_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FLASH_PRINT_INTERFACE_1_0 "PPB_Flash_Print;1.0" +#define PPB_FLASH_PRINT_INTERFACE PPB_FLASH_PRINT_INTERFACE_1_0 + +/** + * @file + * This file contains the <code>PPB_Flash_Print</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Flash_Print</code> interface contains Flash-specific printing + * functionality. + */ +struct PPB_Flash_Print_1_0 { + /** + * Invokes printing on the given plugin instance. + */ + void (*InvokePrinting)(PP_Instance instance); +}; + +typedef struct PPB_Flash_Print_1_0 PPB_Flash_Print; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_PRINT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_instance_private.h
Added
@@ -0,0 +1,106 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_instance_private.idl modified Tue Jul 23 13:19:04 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_INSTANCE_PRIVATE_INTERFACE_0_1 "PPB_Instance_Private;0.1" +#define PPB_INSTANCE_PRIVATE_INTERFACE PPB_INSTANCE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the PPB_Instance_Private interface implemented by the + * browser and containing pointers to functions available only to trusted plugin + * instances. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_ExternalPluginResult </code> enum contains result codes from + * launching an external plugin. + */ +typedef enum { + /** Successful external plugin call */ + PP_EXTERNAL_PLUGIN_OK = 0, + /** Unspecified external plugin error */ + PP_EXTERNAL_PLUGIN_FAILED = 1, + /** Error creating the module */ + PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2, + /** Error creating and initializing the instance */ + PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3 +} PP_ExternalPluginResult; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ExternalPluginResult, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Instance_Private interface contains functions available only to + * trusted plugin instances. + * + */ +struct PPB_Instance_Private_0_1 { + /** + * GetWindowObject is a pointer to a function that determines + * the DOM window containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing window object on success. + */ + struct PP_Var (*GetWindowObject)(PP_Instance instance); + /** + * GetOwnerElementObject is a pointer to a function that determines + * the DOM element containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing DOM element on success. + */ + struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); + /** + * ExecuteScript is a pointer to a function that executes the given + * script in the context of the frame containing the module. + * + * The exception, if any, will be returned in *exception. As with the PPB_Var + * interface, the exception parameter, if non-NULL, must be initialized + * to a "void" var or the function will immediately return. On success, + * the exception parameter will be set to a "void" var. On failure, the + * return value will be a "void" var. + * + * @param[in] script A string containing the JavaScript to execute. + * @param[in/out] exception PP_Var containing the exception. Initialize + * this to NULL if you don't want exception info; initialize this to a void + * exception if want exception info. + * + * @return The result of the script execution, or a "void" var + * if execution failed. + */ + struct PP_Var (*ExecuteScript)(PP_Instance instance, + struct PP_Var script, + struct PP_Var* exception); +}; + +typedef struct PPB_Instance_Private_0_1 PPB_Instance_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_net_address_private.h
Changed
@@ -60,7 +60,7 @@ */ struct PP_NetAddress_Private { uint32_t size; - int8_t data[128]; + char data[128]; }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_Private, 132); /**
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_pdf.h
Added
@@ -0,0 +1,162 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_C_PRIVATE_PPB_PDF_H_ +#define PPAPI_C_PRIVATE_PPB_PDF_H_ + +#include <stdint.h> + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_private_font_charset.h" + +#define PPB_PDF_INTERFACE "PPB_PDF;1" + +typedef enum { + PP_PDFFEATURE_HIDPI = 0, + PP_PDFFEATURE_PRINTING = 1 +} PP_PDFFeature; + +struct PP_PrivateFontFileDescription { + const char* face; + uint32_t weight; + bool italic; +}; + +struct PP_PrivateFindResult { + int start_index; + int length; +}; + +struct PP_PrivateAccessibilityViewportInfo { + double zoom; + struct PP_Point scroll; + struct PP_Point offset; +}; + +struct PP_PrivateAccessibilityDocInfo { + uint32_t page_count; + PP_Bool text_accessible; + PP_Bool text_copyable; +}; + +typedef enum { + PP_PRIVATEDIRECTION_NONE = 0, + PP_PRIVATEDIRECTION_LTR = 1, + PP_PRIVATEDIRECTION_RTL = 2, + PP_PRIVATEDIRECTION_TTB = 3, + PP_PRIVATEDIRECTION_BTT = 4, + PP_PRIVATEDIRECTION_LAST = PP_PRIVATEDIRECTION_BTT +} PP_PrivateDirection; + +struct PP_PrivateAccessibilityPageInfo { + uint32_t page_index; + struct PP_Rect bounds; + uint32_t text_run_count; + uint32_t char_count; +}; + +struct PP_PrivateAccessibilityTextRunInfo { + uint32_t len; + double font_size; + struct PP_FloatRect bounds; + PP_PrivateDirection direction; +}; + +struct PP_PrivateAccessibilityCharInfo { + uint32_t unicode_character; + double char_width; +}; + +struct PPB_PDF { + // Returns a resource identifying a font file corresponding to the given font + // request after applying the browser-specific fallback. + // + // Currently Linux-only. + PP_Resource (*GetFontFileWithFallback)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + + // Given a resource previously returned by GetFontFileWithFallback, returns + // a pointer to the requested font table. Linux only. + bool (*GetFontTableForPrivateFontFile)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); + + // Search the given string using ICU. Use PPB_Core's MemFree on results when + // done. + void (*SearchString)( + PP_Instance instance, + const unsigned short* string, + const unsigned short* term, + bool case_sensitive, + struct PP_PrivateFindResult** results, + int* count); + + // Since WebFrame doesn't know about PPAPI requests, it'll think the page has + // finished loading even if there are outstanding requests by the plugin. + // Take this out once WebFrame knows about requests by PPAPI plugins. + void (*DidStartLoading)(PP_Instance instance); + void (*DidStopLoading)(PP_Instance instance); + + // Sets content restriction for a full-page plugin (i.e. can't copy/print). + // The value is a bitfield of ContentRestriction enums. + void (*SetContentRestriction)(PP_Instance instance, int restrictions); + + // Notifies the browser that the given action has been performed. + void (*UserMetricsRecordAction)(PP_Instance instance, struct PP_Var action); + + // Notifies the browser that the PDF has an unsupported feature. + void (*HasUnsupportedFeature)(PP_Instance instance); + + // Invoke SaveAs... dialog, similar to the right-click or wrench menu. + void (*SaveAs)(PP_Instance instance); + + // Invoke Print dialog for plugin. + void (*Print)(PP_Instance instance); + + PP_Bool(*IsFeatureEnabled)(PP_Instance instance, PP_PDFFeature feature); + + // Sets the selected text of the plugin. + void(*SetSelectedText)(PP_Instance instance, const char* selected_text); + + // Sets the link currently under the cursor. + void (*SetLinkUnderCursor)(PP_Instance instance, const char* url); + + // Gets pointers to both the mmap'd V8 snapshot files and their sizes. + // This is needed when loading V8's initial snapshot from external files. + void (*GetV8ExternalSnapshotData)(PP_Instance instance, + const char** natives_data_out, + int* natives_size_out, + const char** snapshot_data_out, + int* snapshot_size_out); + + // Sends information about the viewport to the renderer for accessibility + // support. + void (*SetAccessibilityViewportInfo)( + PP_Instance instance, + struct PP_PrivateAccessibilityViewportInfo* viewport_info); + + // Sends information about the PDF document to the renderer for accessibility + // support. + void (*SetAccessibilityDocInfo)( + PP_Instance instance, + struct PP_PrivateAccessibilityDocInfo* doc_info); + + // Sends information about one page in a PDF document to the renderer for + // accessibility support. + void (*SetAccessibilityPageInfo)( + PP_Instance instance, + struct PP_PrivateAccessibilityPageInfo* page_info, + struct PP_PrivateAccessibilityTextRunInfo text_runs[], + struct PP_PrivateAccessibilityCharInfo chars[]); +}; + +#endif // PPAPI_C_PRIVATE_PPB_PDF_H_
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_platform_verification_private.h
Added
@@ -0,0 +1,110 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_platform_verification_private.idl, + * modified Fri Oct 18 15:02:09 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_PLATFORM_VERIFICATION_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_PLATFORM_VERIFICATION_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 \ + "PPB_PlatformVerification_Private;0.2" +#define PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE \ + PPB_PLATFORMVERIFICATION_PRIVATE_INTERFACE_0_2 + +/** + * @file + * This file defines the API for platform verification. Currently, it only + * supports Chrome OS. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_PlatformVerification_Private</code> interface allows authorized + * services to verify that the underlying platform is trusted. An example of a + * trusted platform is a Chrome OS device in verified boot mode. + */ +struct PPB_PlatformVerification_Private_0_2 { + /** + * Create() creates a <code>PPB_PlatformVerification_Private</code> object. + * + * @pram[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a + * <code>PPB_PlatformVerification_Private</code> if successful, 0 if creation + * failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsPlatformVerification() determines if the provided resource is a + * <code>PPB_PlatformVerification_Private</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_PlatformVerification_Private</code>. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_PlatformVerification_Private</code>, <code>PP_FALSE</code> if the + * resource is invalid or some type other than + * <code>PPB_PlatformVerification_Private</code>. + */ + PP_Bool (*IsPlatformVerification)(PP_Resource resource); + /** + * Requests a platform challenge for a given service id. + * + * @param[in] service_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the service_id for the challenge. + * + * @param[in] challenge A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the challenge data. + * + * @param[out] signed_data A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the data signed by the + * platform. + * + * @param[out] signed_data_signature A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the signature of the + * signed data block. + * + * @param[out] platform_key_certificate A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> that contains the device specific + * certificate for the requested service_id. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called after + * the platform challenge has been completed. This callback will only run if + * the return code is <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*ChallengePlatform)(PP_Resource instance, + struct PP_Var service_id, + struct PP_Var challenge, + struct PP_Var* signed_data, + struct PP_Var* signed_data_signature, + struct PP_Var* platform_key_certificate, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_PlatformVerification_Private_0_2 + PPB_PlatformVerification_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_PLATFORM_VERIFICATION_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_proxy_private.h
Added
@@ -0,0 +1,47 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_C_PRIVATE_PROXY_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PROXY_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" + +#define PPB_PROXY_PRIVATE_INTERFACE "PPB_Proxy_Private;6" + +// Exposes functions needed by the out-of-process proxy to call into the +// renderer PPAPI implementation. +struct PPB_Proxy_Private { + // Called when the given plugin process has crashed. + void (*PluginCrashed)(PP_Module module); + + // Returns the instance for the given resource, or 0 on failure. + PP_Instance (*GetInstanceForResource)(PP_Resource resource); + + // Sets a callback that will be used to make sure that PP_Instance IDs + // are unique in the plugin. + // + // Since the plugin may be shared between several browser processes, we need + // to do extra work to make sure that an instance ID is globally unqiue. The + // given function will be called and will return true if the given + // PP_Instance is OK to use in the plugin. It will then be marked as "in use" + // On failure (returns false), the host implementation will generate a new + // instance ID and try again. + void (*SetReserveInstanceIDCallback)( + PP_Module module, + PP_Bool (*is_seen)(PP_Module, PP_Instance)); + + // Allows adding additional refcounts to the PluginModule that owns the + // proxy dispatcher (and all interface proxies). For every AddRef call + // there must be a corresponding release call. + void (*AddRefModule)(PP_Module module); + void (*ReleaseModule)(PP_Module module); + + // Allows asserts to be written for some bad conditions while cleaning up. + PP_Bool (*IsInModuleDestructor)(PP_Module module); +}; + +#endif // PPAPI_C_PRIVATE_PROXY_PRIVATE_H_
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_testing_private.h
Added
@@ -0,0 +1,167 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_testing_private.idl modified Fri May 1 13:14:52 2015. */ + +#ifndef PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ + +#include "ppapi/c/dev/ppb_url_util_dev.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_TESTING_PRIVATE_INTERFACE_1_0 "PPB_Testing_Private;1.0" +#define PPB_TESTING_PRIVATE_INTERFACE PPB_TESTING_PRIVATE_INTERFACE_1_0 + +/** + * @file + * This file contains interface functions used for unit testing. Do not use in + * production code. They are not guaranteed to be available in normal plugin + * environments so you should not depend on them. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Testing_Private_1_0 { + /** + * Reads the bitmap data out of the backing store for the given + * DeviceContext2D and into the given image. If the data was successfully + * read, it will return PP_TRUE. + * + * This function should not generally be necessary for normal plugin + * operation. If you want to update portions of a device, the expectation is + * that you will either regenerate the data, or maintain a backing store + * pushing updates to the device from your backing store via PaintImageData. + * Using this function will introduce an extra copy which will make your + * plugin slower. In some cases, this may be a very expensive operation (it + * may require slow cross-process transitions or graphics card readbacks). + * + * Data will be read into the image starting at |top_left| in the device + * context, and proceeding down and to the right for as many pixels as the + * image is large. If any part of the image bound would fall outside of the + * backing store of the device if positioned at |top_left|, this function + * will fail and return PP_FALSE. + * + * The image format must be of the format + * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and + * return PP_FALSE. + * + * The returned image data will represent the current status of the backing + * store. This will not include any paint, scroll, or replace operations + * that have not yet been flushed; these operations are only reflected in + * the backing store (and hence ReadImageData) until after a Flush() + * operation has completed. + */ + PP_Bool (*ReadImageData)(PP_Resource device_context_2d, + PP_Resource image, + const struct PP_Point* top_left); + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used for unit testing the API. The normal pattern is to + * issue some asynchronous call that has a callback. Then you call + * RunMessageLoop which will suspend the plugin and go back to processing + * messages, giving the asynchronous operation time to complete. In your + * callback, you save the data and call QuitMessageLoop, which will then + * pop back up and continue with the test. This avoids having to write a + * complicated state machine for simple tests for asynchronous APIs. + */ + void (*RunMessageLoop)(PP_Instance instance); + /** + * Posts a quit message for the outermost nested message loop. Use this to + * exit and return back to the caller after you call RunMessageLoop. + */ + void (*QuitMessageLoop)(PP_Instance instance); + /** + * Returns the number of live objects (resources + strings + objects) + * associated with this plugin instance. Used for detecting leaks. Returns + * (uint32_t)-1 on failure. + */ + uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); + /** + * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE + * otherwise. + */ + PP_Bool (*IsOutOfProcess)(void); + /** + * Posts the plugin's current Power Saver status to JavaScript. The plugin + * itself does not recieve anything. This is not idiomatic for Pepper, + * but convenient for testing. + */ + void (*PostPowerSaverStatus)(PP_Instance instance); + /** + * Subscribes to changes to the plugin's Power Saver status. The status + * changes are not forwarded to the plugin itself, but posted to JavaScript. + * This is not idiomatic for Pepper, but conveienent for testing. + */ + void (*SubscribeToPowerSaverNotifications)(PP_Instance instance); + /** + * Passes the input event to the browser, which sends it back to the + * plugin. The plugin should implement PPP_InputEvent and register for + * the input event type. + * + * This method sends an input event through the browser just as if it had + * come from the user. If the browser determines that it is an event for the + * plugin, it will be sent to be handled by the plugin's PPP_InputEvent + * interface. When generating mouse events, make sure the position is within + * the plugin's area on the page. When generating a keyboard event, make sure + * the plugin is focused. + * + * Note that the browser may generate extra input events in order to + * maintain certain invariants, such as always having a "mouse enter" event + * before any other mouse event. Furthermore, the event the plugin receives + * after sending a simulated event will be slightly different from the + * original event. The browser may change the timestamp, add modifiers, and + * slightly alter the mouse position, due to coordinate transforms it + * performs. + */ + void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event); + /** + * Returns the URL for the document. This is a safe way to retrieve + * window.location.href. + * If the canonicalized URL is valid, the method will parse the URL + * and fill in the components structure. This pointer may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*GetDocumentURL)(PP_Instance instance, + struct PP_URLComponents_Dev* components); + /** + * Fetches up to |array_size| active PP_Vars in the tracker. Returns the + * number of vars in the tracker. The active vars are written to |live_vars| + * contiguously starting at index 0. The vars are not in any particular order. + * If the number of live vars is greater than |array_size|, then an arbitrary + * subset of |array_size| vars is written to |live_vars|. The reference count + * of the returned PP_Vars will *not* be affected by this call. + */ + uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size); + /** + * Sets the threshold size at which point we switch from transmitting + * array buffers in IPC messages to using shared memory. This is only used + * for testing purposes where we need to transmit small buffers using shmem + * (in order to have fast tests). Passing a value of 0 resets the threshold + * to its default. The threshold is in bytes. + */ + void (*SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, + uint32_t threshold); + /** + * Run the V8 garbage collector for tests. + */ + void (*RunV8GC)(PP_Instance instance); +}; + +typedef struct PPB_Testing_Private_1_0 PPB_Testing_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_TESTING_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_video_destination_private.h
Added
@@ -0,0 +1,122 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_video_destination_private.idl, + * modified Thu Apr 25 11:51:30 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_video_frame_private.h" + +#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 \ + "PPB_VideoDestination_Private;0.1" +#define PPB_VIDEODESTINATION_PRIVATE_INTERFACE \ + PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VideoDestination_Private</code> interface + * for a video destination resource, which sends video frames to a MediaStream + * video track in the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_VideoDestination_Private</code> interface contains pointers to + * several functions for creating video destination resources and using them to + * send video frames to a MediaStream video track in the browser. + */ +struct PPB_VideoDestination_Private_0_1 { + /** + * Creates a video destination resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an instance of + * a module. + * + * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a video destination resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video destination resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsVideoDestination)(PP_Resource resource); + /** + * Opens a video destination for putting frames. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_INPROGRESS if destination is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource destination, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Puts a frame to the video destination. + * + * After this call, you should take care to release your references to the + * image embedded in the video frame. If you paint to the image after + * PutFame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination resource. + * @param[in] frame A <code>PP_VideoFrame_Private</code> holding the video + * frame to send to the destination. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_FAILED if destination is not open, if the video frame has + * an invalid image data resource, or if some other browser error occurs. + */ + int32_t (*PutFrame)(PP_Resource destination, + const struct PP_VideoFrame_Private* frame); + /** + * Closes the video destination. + * + * @param[in] destination A <code>PP_Resource</code> corresponding to a video + * destination. + */ + void (*Close)(PP_Resource destination); +}; + +typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_DESTINATION_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_video_source_private.h
Added
@@ -0,0 +1,118 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_video_source_private.idl, + * modified Mon Oct 27 16:13:24 2014. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_video_frame_private.h" + +#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 "PPB_VideoSource_Private;0.1" +#define PPB_VIDEOSOURCE_PRIVATE_INTERFACE PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VideoSource_Private</code> interface for a + * video source resource, which receives video frames from a MediaStream video + * track in the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_VideoSource_Private</code> interface contains pointers to + * several functions for creating video source resources and using them to + * receive video frames from a MediaStream video track in the browser. + */ +struct PPB_VideoSource_Private_0_1 { + /** + * Creates a video source resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying an instance of + * a module. + * + * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a video source resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a video source resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsVideoSource)(PP_Resource resource); + /** + * Opens a video source for getting frames. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[in] stream_url A <code>PP_Var</code> string holding a URL + * identifying a MediaStream. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_INPROGRESS if source is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource source, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Gets a frame from the video source. The returned image data is only valid + * until the next call to GetFrame. + * The image data resource inside the returned frame will have its reference + * count incremented by one and must be managed by the plugin. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + * @param[out] frame A <code>PP_VideoFrame_Private</code> to hold a video + * frame from the source. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_FAILED if the source is not open, or if some other + * browser error occurs. + */ + int32_t (*GetFrame)(PP_Resource source, + struct PP_VideoFrame_Private* frame, + struct PP_CompletionCallback callback); + /** + * Closes the video source. + * + * @param[in] source A <code>PP_Resource</code> corresponding to a video + * source resource. + */ + void (*Close)(PP_Resource source); +}; + +typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_VIDEO_SOURCE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_content_decryptor_private.h
Added
@@ -0,0 +1,314 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppp_content_decryptor_private.idl, + * modified Mon Oct 19 13:04:26 2015. + */ + +#ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/pp_content_decryptor.h" + +#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_16 \ + "PPP_ContentDecryptor_Private;0.16" +#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ + PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_16 + +/** + * @file + * This file defines the <code>PPP_ContentDecryptor_Private</code> + * interface. Note: This is a special interface, only to be used for Content + * Decryption Modules, not normal plugins. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPP_ContentDecryptor_Private</code> structure contains the function + * pointers the decryption plugin must implement to provide services needed by + * the browser. This interface provides the plugin side support for the Content + * Decryption Module (CDM) for Encrypted Media Extensions: + * http://www.w3.org/TR/encrypted-media/ + */ +struct PPP_ContentDecryptor_Private_0_16 { + /** + * Initialize for the specified key system. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of initialization. + * + * @param[in] key_system A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the name of the key system. + * @param[in] allow_distinctive_identifier Inform the CDM that it may use a + * distinctive identifier. + * @param[in] allow_persistent_state Inform the CDM that it may use persistent + * state. + */ + void (*Initialize)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var key_system, + PP_Bool allow_distinctive_identifier, + PP_Bool allow_persistent_state); + /** + * Provides a server certificate to be used to encrypt messages to the + * license server. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of setting the certificate. + * + * @param[in] server_certificate A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used. + */ + void (*SetServerCertificate)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var server_certificate); + /** + * Creates a session and subsequently generates a request for a license. + * <code>init_data_type</code> contains the MIME type of + * <code>init_data</code>. <code>init_data</code> is a data buffer + * containing data for use in generating the request. + * + * Note: <code>CreateSessionAndGenerateRequest()</code> must create a + * session ID and provide it to the browser via <code>SessionCreated()</code> + * on the <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure when creating the session. + * + * @param[in] session_type A <code>PP_SessionType</code> that indicates the + * type of session to be created. + * + * @param[in] init_data_type A <code>PP_InitDataType</code> that indicates + * the Initialization Data Type for init_data. + * + * @param[in] init_data A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific + * initialization data. + */ + void (*CreateSessionAndGenerateRequest)(PP_Instance instance, + uint32_t promise_id, + PP_SessionType session_type, + PP_InitDataType init_data_type, + struct PP_Var init_data); + /** + * Loads a session whose session ID is <code>session_id</code>. + * + * Note: After the session is successfully loaded, the CDM must call + * <code>SessionCreated()</code> with <code>session_id</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of loading the session. + * + * @param[in] session_type A <code>PP_SessionType</code> that indicates the + * type of session to be loaded. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session ID of the session + * to load. + */ + void (*LoadSession)(PP_Instance instance, + uint32_t promise_id, + PP_SessionType session_type, + struct PP_Var session_id); + /** + * Provides a license or other message to the decryptor. + * + * When the CDM needs more information, it must call + * <code>SessionMessage()</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface, and the browser + * must notify the web application. When the CDM has finished processing + * <code>response</code> and needs no more information, it must call + * <code>SessionReady()</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface, and the browser + * must notify the web application. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of updating the session. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session ID of the session + * to be updated. + * + * @param[in] response A <code>PP_Var</code> of type + * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the license or other + * message for the given session ID. + */ + void (*UpdateSession)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var session_id, + struct PP_Var response); + /** + * Close the specified session and related resources. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of closing the session. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session ID of the session + * to be closed. + * + */ + void (*CloseSession)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var session_id); + /** + * Remove stored data associated with this session. + * + * @param[in] promise_id A reference for the promise that gets resolved or + * rejected depending upon the success or failure of removing the session + * data. + * + * @param[in] session_id A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the session ID of the session + * to be removed. + * + */ + void (*RemoveSession)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var session_id); + /** + * Decrypts the block and returns the unencrypted block via + * <code>DeliverBlock()</code> on the + * <code>PPB_ContentDecryptor_Private</code> interface. The returned block + * contains encoded data. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource that contains an encrypted data + * block. + * + * @param[in] encrypted_block_info A <code>PP_EncryptedBlockInfo</code> that + * contains all auxiliary information needed for decryption of the + * <code>encrypted_block</code>. + */ + void (*Decrypt)(PP_Instance instance, + PP_Resource encrypted_block, + const struct PP_EncryptedBlockInfo* encrypted_block_info); + /**
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_find_private.h
Added
@@ -0,0 +1,58 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppp_find_private.idl modified Thu Mar 20 11:34:17 2014. */ + +#ifndef PPAPI_C_PRIVATE_PPP_FIND_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPP_FIND_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_FIND_PRIVATE_INTERFACE_0_3 "PPP_Find_Private;0.3" +#define PPP_FIND_PRIVATE_INTERFACE PPP_FIND_PRIVATE_INTERFACE_0_3 + +/** + * @file + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_Find_Private_0_3 { + /** + * Finds the given UTF-8 text starting at the current selection. The number of + * results will be updated asynchronously via NumberOfFindResultsChanged in + * PPB_Find. Note that multiple StartFind calls can happen before StopFind is + * called in the case of the search term changing. + * + * Return PP_FALSE if the plugin doesn't support find in page. Consequently, + * it won't call any callbacks. + */ + PP_Bool (*StartFind)(PP_Instance instance, + const char* text, + PP_Bool case_sensitive); + /** + * Go to the next/previous result. + */ + void (*SelectFindResult)(PP_Instance instance, PP_Bool forward); + /** + * Tells the plugin that the find operation has stopped, so it should clear + * any highlighting. + */ + void (*StopFind)(PP_Instance instance); +}; + +typedef struct PPP_Find_Private_0_3 PPP_Find_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPP_FIND_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_flash_browser_operations.h
Added
@@ -0,0 +1,234 @@ +/* Copyright 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppp_flash_browser_operations.idl, + * modified Fri Aug 22 11:10:06 2014. + */ + +#ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_ +#define PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0 \ + "PPP_Flash_BrowserOperations;1.0" +#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2 \ + "PPP_Flash_BrowserOperations;1.2" +#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3 \ + "PPP_Flash_BrowserOperations;1.3" +#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE \ + PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3 + +/** + * @file + * This file contains the <code>PPP_Flash_BrowserOperations</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0, + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1 +} PP_Flash_BrowserOperations_SettingType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SettingType, 4); + +typedef enum { + /* This value is only used with <code>SetSitePermission()</code>. */ + PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3 +} PP_Flash_BrowserOperations_Permission; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_Permission, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Flash_BrowserOperations_SiteSetting { + const char* site; + PP_Flash_BrowserOperations_Permission permission; +}; +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +typedef void (*PPB_Flash_BrowserOperations_GetSettingsCallback)( + void* user_data, + PP_Bool success, + PP_Flash_BrowserOperations_Permission default_permission, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This interface allows the browser to request the plugin do things. + */ +struct PPP_Flash_BrowserOperations_1_3 { + /** + * This function allows the plugin to implement the "Clear site data" feature. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin data is + * stored. On UTF16 systems (Windows), this will be encoded as UTF-8. It will + * be an absolute path and will not have a directory separator (slash) at the + * end. + * @param[in] site String specifying which site to clear the data for. This + * will be null to clear data for all sites. + * @param[in] flags Currently always 0 in Chrome to clear all data. This may + * be extended in the future to clear only specific types of data. + * @param[in] max_age The maximum age in seconds to clear data for. This + * allows the plugin to implement "clear past hour" and "clear past data", + * etc. + * + * @return PP_TRUE on success, PP_FALSE on failure. + * + * See also the NPP_ClearSiteData function in NPAPI. + * https://wiki.mozilla.org/NPAPI:ClearSiteData + */ + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); + /** + * Requests the plugin to deauthorize content licenses. It prevents Flash from + * playing protected content, such as movies and music the user may have + * rented or purchased. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path); + /** + * Gets permission settings. <code>callback</code> will be called exactly once + * to return the settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to retrieve. + * @param[in] callback The callback to return retrieved data. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + */ + void (*GetPermissionSettings)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PPB_Flash_BrowserOperations_GetSettingsCallback callback, + void* user_data); + /** + * Sets default permission. It applies to all sites except those with + * site-specific settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] permission The default permission. + * @param[in] clear_site_specific Whether to remove all site-specific + * settings. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*SetDefaultPermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PP_Flash_BrowserOperations_Permission permission, + PP_Bool clear_site_specific); + /** + * Sets site-specific permission. If a site has already got site-specific + * permission and it is not in <code>sites</code>, it won't be affected. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] site_count How many items are there in <code>sites</code>. + * @param[in] sites The site-specific settings. If a site is specified with + * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it + * will be removed from the site-specific list. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*SetSitePermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); + /** + * Returns a list of sites that have stored data, for use with the + * "Clear site data" feature. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin data is stored. + * @param[out] sites A NULL-terminated array of sites that have stored data. + * Use FreeSiteList on the array when done. + * + * See also the NPP_GetSitesWithData function in NPAPI: + * https://wiki.mozilla.org/NPAPI:ClearSiteData + */ + void (*GetSitesWithData)(const char* plugin_data_path, char*** sites); + /** + * Frees the list of sites returned by GetSitesWithData. + * + * @param[in] sites A NULL-terminated array of strings. + */ + void (*FreeSiteList)(char* sites[]); +}; + +typedef struct PPP_Flash_BrowserOperations_1_3 PPP_Flash_BrowserOperations; +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_instance_private.h
Added
@@ -0,0 +1,61 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppp_instance_private.idl modified Thu Mar 28 10:22:54 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPP_INSTANCE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPP_INSTANCE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPP_INSTANCE_PRIVATE_INTERFACE_0_1 "PPP_Instance_Private;0.1" +#define PPP_INSTANCE_PRIVATE_INTERFACE PPP_INSTANCE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the PPP_InstancePrivate structure; a series of functions + * that a trusted plugin may implement to provide capabilities only available + * to trusted plugins. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_Instance_Private interface contains pointers to a series of + * functions that may be implemented in a trusted plugin to provide capabilities + * that aren't possible in untrusted modules. + */ +struct PPP_Instance_Private_0_1 { + /** + * GetInstanceObject returns a PP_Var representing the scriptable object for + * the given instance. Normally this will be a PPP_Class_Deprecated object + * that exposes methods and properties to JavaScript. + * + * On Failure, the returned PP_Var should be a "void" var. + * + * The returned PP_Var should have a reference added for the caller, which + * will be responsible for Release()ing that reference. + * + * @param[in] instance A PP_Instance identifying the instance from which the + * instance object is being requested. + * @return A PP_Var containing scriptable object. + */ + struct PP_Var (*GetInstanceObject)(PP_Instance instance); +}; + +typedef struct PPP_Instance_Private_0_1 PPP_Instance_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPP_INSTANCE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_pdf.h
Added
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_C_PRIVATE_PPP_PDF_H_ +#define PPAPI_C_PRIVATE_PPP_PDF_H_ + +#include <stdint.h> + +#include "ppapi/c/dev/pp_print_settings_dev.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_var.h" + +#define PPP_PDF_INTERFACE_1 "PPP_Pdf;1" +#define PPP_PDF_INTERFACE PPP_PDF_INTERFACE_1 + +typedef enum { + // Rotates the page 90 degrees clockwise from its current orientation. + PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW, + // Rotates the page 90 degrees counterclockwise from its current orientation. + PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW +} PP_PrivatePageTransformType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrivatePageTransformType, 4); + +typedef enum { + PP_PRIVATEDUPLEXMODE_NONE = 0, + PP_PRIVATEDUPLEXMODE_SIMPLEX = 1, + PP_PRIVATEDUPLEXMODE_SHORT_EDGE = 2, + PP_PRIVATEDUPLEXMODE_LONG_EDGE = 3, + PP_PRIVATEDUPLEXMODE_LAST = PP_PRIVATEDUPLEXMODE_LONG_EDGE +} PP_PrivateDuplexMode_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrivateDuplexMode_Dev, 4); + +struct PP_PdfPrintPresetOptions_Dev { + // Returns whether scaling is disabled. Returns same information as the + // PPP_Printing_Dev's method IsScalingDiabled(). + PP_Bool is_scaling_disabled; + + // Number of copies to be printed. + int32_t copies; + + // DuplexMode to be used for printing. + PP_PrivateDuplexMode_Dev duplex; + + // True if all the pages in the PDF are the same size. + PP_Bool is_page_size_uniform; + + // Only valid if |is_page_size_uniform| is true. The page size. + PP_Size uniform_page_size; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PdfPrintPresetOptions_Dev, 24); + +struct PPP_Pdf_1_1 { + // Returns an absolute URL if the position is over a link. + PP_Var (*GetLinkAtPosition)(PP_Instance instance, + PP_Point point); + + // Requests that the plugin apply the given transform to its view. + void (*Transform)(PP_Instance instance, PP_PrivatePageTransformType type); + + // Return true if print preset options are updated from document. + PP_Bool (*GetPrintPresetOptionsFromDocument)( + PP_Instance instance, + PP_PdfPrintPresetOptions_Dev* options); + + void (*EnableAccessibility)(PP_Instance instance); +}; + +typedef PPP_Pdf_1_1 PPP_Pdf; + +#endif // PPAPI_C_PRIVATE_PPP_PDF_H_
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppp_pexe_stream_handler.h
Added
@@ -0,0 +1,61 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppp_pexe_stream_handler.idl, + * modified Wed Aug 6 13:11:06 2014. + */ + +#ifndef PPAPI_C_PRIVATE_PPP_PEXE_STREAM_HANDLER_H_ +#define PPAPI_C_PRIVATE_PPP_PEXE_STREAM_HANDLER_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_PEXESTREAMHANDLER_INTERFACE_1_0 "PPP_PexeStreamHandler;1.0" +#define PPP_PEXESTREAMHANDLER_INTERFACE PPP_PEXESTREAMHANDLER_INTERFACE_1_0 + +/** + * @file + * This file contains NaCl private interfaces. This interface is not versioned + * and is for internal Chrome use. It may change without notice. */ + + +#include "ppapi/c/private/pp_file_handle.h" + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_PexeStreamHandler_1_0 { + /** + * Invoked as a result of a cache hit for a translated pexe. + */ + void (*DidCacheHit)(void* user_data, PP_FileHandle nexe_file_handle); + /** + * Invoked as a result of a cache miss for a translated pexe. + * Provides the expected length of the pexe, as read from HTTP headers. + */ + void (*DidCacheMiss)(void* user_data, + int64_t expected_total_length, + PP_FileHandle temp_nexe_file); + /** + * Invoked when a block of data has been downloaded. + * Only invoked after DidCacheMiss(). + */ + void (*DidStreamData)(void* user_data, const void* data, int32_t length); + /** + * Invoked when the stream has finished downloading, regardless of whether it + * succeeded. Not invoked if DidCacheHit() was called. + */ + void (*DidFinishStream)(void* user_data, int32_t pp_error); +}; + +typedef struct PPP_PexeStreamHandler_1_0 PPP_PexeStreamHandler; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPP_PEXE_STREAM_HANDLER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppb_broker_trusted.h
Added
@@ -0,0 +1,103 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppb_broker_trusted.idl modified Mon Dec 3 11:10:40 2012. */ + +#ifndef PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ +#define PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_BROKER_TRUSTED_INTERFACE_0_2 "PPB_BrokerTrusted;0.2" +#define PPB_BROKER_TRUSTED_INTERFACE_0_3 "PPB_BrokerTrusted;0.3" +#define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_3 + +/** + * @file + * This file defines the PPB_BrokerTrusted interface, which provides + * access to a trusted broker with greater privileges than the plugin. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_BrokerTrusted interface provides access to a trusted broker + * with greater privileges than the plugin. The interface only supports + * out-of-process plugins and is to be used by proxy implementations. All + * functions should be called from the main thread only. + * + * A PPB_BrokerTrusted resource represents a connection to the broker. Its + * lifetime controls the lifetime of the broker, regardless of whether the + * handle is closed. The handle should be closed before the resource is + * released. + */ +struct PPB_BrokerTrusted_0_3 { + /** + * Returns a trusted broker resource. + */ + PP_Resource (*CreateTrusted)(PP_Instance instance); + /** + * Returns true if the resource is a trusted broker. + */ + PP_Bool (*IsBrokerTrusted)(PP_Resource resource); + /** + * Connects to the trusted broker. It may have already + * been launched by another instance. + * The plugin takes ownership of the handle once the callback has been called + * with a result of PP_OK. The plugin should immediately call GetHandle and + * begin managing it. If the result is not PP_OK, the browser still owns the + * handle. + * + * Returns PP_ERROR_WOULD_BLOCK on success, and invokes + * the |connect_callback| asynchronously to complete. + * As this function should always be invoked from the main thread, + * do not use the blocking variant of PP_CompletionCallback. + * Returns PP_ERROR_FAILED if called from an in-process plugin. + */ + int32_t (*Connect)(PP_Resource broker, + struct PP_CompletionCallback connect_callback); + /** + * Gets the handle to the pipe. Use once Connect has completed. Each instance + * of this interface has its own pipe. + * + * Returns PP_OK on success, and places the result into the given output + * parameter. The handle is only set when returning PP_OK. Calling this + * before connect has completed will return PP_ERROR_FAILED. + */ + int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); + /** + * Returns PP_TRUE if the plugin has permission to launch the broker. A user + * must explicitly grant permission to launch the broker for a particular + * website. This is done through an infobar that is displayed when |Connect| + * is called. This function returns PP_TRUE if the user has already granted + * permission to launch the broker for the website containing this plugin + * instance. Returns PP_FALSE otherwise. + */ + PP_Bool (*IsAllowed)(PP_Resource broker); +}; + +typedef struct PPB_BrokerTrusted_0_3 PPB_BrokerTrusted; + +struct PPB_BrokerTrusted_0_2 { + PP_Resource (*CreateTrusted)(PP_Instance instance); + PP_Bool (*IsBrokerTrusted)(PP_Resource resource); + int32_t (*Connect)(PP_Resource broker, + struct PP_CompletionCallback connect_callback); + int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); +}; +/** + * @} + */ + +#endif /* PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppb_browser_font_trusted.h
Added
@@ -0,0 +1,282 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppb_browser_font_trusted.idl, + * modified Thu Mar 28 10:14:27 2013. + */ + +#ifndef PPAPI_C_TRUSTED_PPB_BROWSER_FONT_TRUSTED_H_ +#define PPAPI_C_TRUSTED_PPB_BROWSER_FONT_TRUSTED_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0 "PPB_BrowserFont_Trusted;1.0" +#define PPB_BROWSERFONT_TRUSTED_INTERFACE PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_BrowserFont_Trusted</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Uses the user's default web page font (normally either the default serif + * or sans serif font). + */ + PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT = 0, + /** + * These families will use the default web page font corresponding to the + * given family. + */ + PP_BROWSERFONT_TRUSTED_FAMILY_SERIF = 1, + PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF = 2, + PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE = 3 +} PP_BrowserFont_Trusted_Family; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Family, 4); + +/** + * Specifies the font weight. Normally users will only use NORMAL or BOLD. + */ +typedef enum { + PP_BROWSERFONT_TRUSTED_WEIGHT_100 = 0, + PP_BROWSERFONT_TRUSTED_WEIGHT_200 = 1, + PP_BROWSERFONT_TRUSTED_WEIGHT_300 = 2, + PP_BROWSERFONT_TRUSTED_WEIGHT_400 = 3, + PP_BROWSERFONT_TRUSTED_WEIGHT_500 = 4, + PP_BROWSERFONT_TRUSTED_WEIGHT_600 = 5, + PP_BROWSERFONT_TRUSTED_WEIGHT_700 = 6, + PP_BROWSERFONT_TRUSTED_WEIGHT_800 = 7, + PP_BROWSERFONT_TRUSTED_WEIGHT_900 = 8, + PP_BROWSERFONT_TRUSTED_WEIGHT_NORMAL = PP_BROWSERFONT_TRUSTED_WEIGHT_400, + PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD = PP_BROWSERFONT_TRUSTED_WEIGHT_700 +} PP_BrowserFont_Trusted_Weight; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Weight, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_BrowserFont_Trusted_Description { + /** + * Font face name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + struct PP_Var face; + /** + * When Create()ing a font and the face is an undefined var, the family + * specifies the generic font family type to use. If the face is specified, + * this will be ignored. + * + * When Describe()ing a font, the family will be the value you passed in when + * the font was created. In other words, if you specify a face name, the + * family will not be updated to reflect whether the font name you requested + * is serif or sans serif. + */ + PP_BrowserFont_Trusted_Family family; + /** + * Size in pixels. + * + * You can specify 0 to get the default font size. The default font size + * may vary depending on the requested font. The typical example is that + * the user may have a different font size for the default monospace font to + * give it a similar optical size to the proportionally spaced fonts. + */ + uint32_t size; + /** + * Normally you will use either normal or bold. + */ + PP_BrowserFont_Trusted_Weight weight; + PP_Bool italic; + PP_Bool small_caps; + /** + * Adjustment to apply to letter and word spacing, respectively. Initialize + * to 0 to get normal spacing. Negative values bring letters/words closer + * together, positive values separate them. + */ + int32_t letter_spacing; + int32_t word_spacing; + /** + * Ensure that this struct is 48-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Description, 48); + +struct PP_BrowserFont_Trusted_Metrics { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Metrics, 20); + +struct PP_BrowserFont_Trusted_TextRun { + /** + * This var must either be a string or a null/undefined var (which will be + * treated as a 0-length string). + */ + struct PP_Var text; + /** + * Set to PP_TRUE if the text is right-to-left. + */ + PP_Bool rtl; + /** + * Set to PP_TRUE to force the directionality of the text regardless of + * content + */ + PP_Bool override_direction; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_TextRun, 24); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Provides an interface for native browser text rendering. + * + * This API is "trusted" not for security reasons, but because it can not be + * implemented efficiently when running out-of-process in Browser Client. In + * this case, WebKit is in another process and every text call would require a + * synchronous IPC to the renderer. It is, however, available to native + * (non-NaCl) out-of-process PPAPI plugins since WebKit is available in the + * plugin process. + */ +struct PPB_BrowserFont_Trusted_1_0 { + /** + * Returns a list of all available font families on the system. You can use + * this list to decide whether to Create() a font. + * + * The return value will be a single string with null characters delimiting + * the end of each font name. For example: "Arial\0Courier\0Times\0". + * + * Returns an undefined var on failure (this typically means you passed an + * invalid instance). + */ + struct PP_Var (*GetFontFamilies)(PP_Instance instance); + /** + * Returns a font which best matches the given description. The return value + * will have a non-zero ID on success, or zero on failure. + */ + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description); + /** + * Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the + * resource is invalid or some type other than a Font. + */ + PP_Bool (*IsFont)(PP_Resource resource); + /** + * Loads the description and metrics of the font into the given structures. + * The description will be different than the description the font was
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppb_char_set_trusted.h
Added
@@ -0,0 +1,124 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppb_char_set_trusted.idl modified Wed Feb 8 16:34:25 2012. */ + +#ifndef PPAPI_C_TRUSTED_PPB_CHAR_SET_TRUSTED_H_ +#define PPAPI_C_TRUSTED_PPB_CHAR_SET_TRUSTED_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_CHARSET_TRUSTED_INTERFACE_1_0 "PPB_CharSet_Trusted;1.0" +#define PPB_CHARSET_TRUSTED_INTERFACE PPB_CHARSET_TRUSTED_INTERFACE_1_0 + +/** + * @file + * + * This file defines the <code>PPB_CharSet_Trusted</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Causes the entire conversion to fail if an error is encountered. The + * conversion function will return NULL. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL, + /** + * Silently skips over errors. Unrepresentable characters and input encoding + * errors will be removed from the output. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP, + /** + * Replaces the error or unrepresentable character with a substitution + * character. When converting to a Unicode character set (UTF-8 or UTF-16) it + * will use the unicode "substitution character" U+FFFD. When converting to + * another character set, the character will be charset-specific. For many + * languages this will be the representation of the '?' character. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE +} PP_CharSet_Trusted_ConversionError; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CharSet_Trusted_ConversionError, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_CharSet_Trusted</code> interface provides functions for + * converting between character sets. + * + * This inteface is provided for trusted plugins only since in Native Client it + * would require an expensive out-of-process IPC call for each conversion, + * which makes performance unacceptable. Native Client plugins should include + * ICU or some other library if they need this feature. + */ +struct PPB_CharSet_Trusted_1_0 { + /** + * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in + * the specified code page. |utf16_len| is measured in UTF-16 units, not + * bytes. This value may not be NULL. + * + * The given output buffer will be filled up to output_length bytes with the + * result. output_length will be updated with the number of bytes required + * for the given string. The output buffer may be null to just retrieve the + * required buffer length. + * + * This function will return PP_FALSE if there was an error converting the + * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output + * character set was unknown. Otherwise, it will return PP_TRUE. + */ + PP_Bool (*UTF16ToCharSet)(const uint16_t utf16[], + uint32_t utf16_len, + const char* output_char_set, + PP_CharSet_Trusted_ConversionError on_error, + char* output_buffer, + uint32_t* output_length); + /** + * Same as UTF16ToCharSet except converts in the other direction. The input + * is in the given charset, and the |input_len| is the number of bytes in + * the |input| string. + * + * Note that the output_utf16_length is measured in UTF-16 characters. + * + * Since UTF16 can represent every Unicode character, the only time the + * replacement character will be used is if the encoding in the input string + * is incorrect. + */ + PP_Bool (*CharSetToUTF16)(const char* input, + uint32_t input_len, + const char* input_char_set, + PP_CharSet_Trusted_ConversionError on_error, + uint16_t* output_buffer, + uint32_t* output_utf16_length); + /** + * Returns a string var representing the current multi-byte character set of + * the current system. + * + * WARNING: You really shouldn't be using this function unless you're dealing + * with legacy data. You should be using UTF-8 or UTF-16 and you don't have + * to worry about the character sets. + */ + struct PP_Var (*GetDefaultCharSet)(PP_Instance instance); +}; + +typedef struct PPB_CharSet_Trusted_1_0 PPB_CharSet_Trusted; +/** + * @} + */ + +#endif /* PPAPI_C_TRUSTED_PPB_CHAR_SET_TRUSTED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppb_file_chooser_trusted.h
Added
@@ -0,0 +1,74 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppb_file_chooser_trusted.idl, + * modified Fri Mar 16 10:00:48 2012. + */ + +#ifndef PPAPI_C_TRUSTED_PPB_FILE_CHOOSER_TRUSTED_H_ +#define PPAPI_C_TRUSTED_PPB_FILE_CHOOSER_TRUSTED_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5 "PPB_FileChooserTrusted;0.5" +#define PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6 "PPB_FileChooserTrusted;0.6" +#define PPB_FILECHOOSER_TRUSTED_INTERFACE PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6 + +/** + * @file + * This file defines the <code>PPB_FileChooser_Trusted</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FileChooserTrusted_0_6 { + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files to open, or a + * single file for saving. The callback is called with PP_OK on successful + * completion with a file (or files) selected or PP_ERROR_USERCANCEL if the + * user selected no file. + * + * @param[in] chooser The file chooser resource. + * @param[in] save_as A <code>PP_Bool</code> value indicating if this dialog + * is choosing a file for saving. + * @param[in] suggested_file_name If saving, the suggested name for the + * file, otherwise, null or undefined. + * @param[in] callback A <code>CompletionCallback</code> to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + int32_t (*ShowWithoutUserGesture)(PP_Resource chooser, + PP_Bool save_as, + struct PP_Var suggested_file_name, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileChooserTrusted_0_6 PPB_FileChooserTrusted; + +struct PPB_FileChooserTrusted_0_5 { + int32_t (*ShowWithoutUserGesture)(PP_Resource chooser, + PP_Bool save_as, + struct PP_Var suggested_file_name, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_TRUSTED_PPB_FILE_CHOOSER_TRUSTED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppb_url_loader_trusted.h
Added
@@ -0,0 +1,77 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppb_url_loader_trusted.idl modified Wed Oct 5 14:06:02 2011. */ + +#ifndef PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_ +#define PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_URLLOADERTRUSTED_INTERFACE_0_3 "PPB_URLLoaderTrusted;0.3" +#define PPB_URLLOADERTRUSTED_INTERFACE PPB_URLLOADERTRUSTED_INTERFACE_0_3 + +/** + * @file + * URL loader trusted interfaces. */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Callback that indicates the status of the download and upload for the + * given URLLoader resource. + */ +typedef void (*PP_URLLoaderTrusted_StatusCallback)( + PP_Instance pp_instance, + PP_Resource pp_resource, + int64_t bytes_sent, + int64_t total_bytes_to_be_sent, + int64_t bytes_received, + int64_t total_bytes_to_be_received); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* Available only to trusted implementations. */ +struct PPB_URLLoaderTrusted_0_3 { + /** + * Grant this URLLoader the capability to make unrestricted cross-origin + * requests. + */ + void (*GrantUniversalAccess)(PP_Resource loader); + /** + * Registers that the given function will be called when the upload or + * downloaded byte count has changed. This is not exposed on the untrusted + * interface because it can be quite chatty and encourages people to write + * feedback UIs that update as frequently as the progress updates. + * + * The other serious gotcha with this callback is that the callback must not + * mutate the URL loader or cause it to be destroyed. + * + * However, the proxy layer needs this information to push to the other + * process, so we expose it here. Only one callback can be set per URL + * Loader. Setting to a NULL callback will disable it. + */ + void (*RegisterStatusCallback)(PP_Resource loader, + PP_URLLoaderTrusted_StatusCallback cb); +}; + +typedef struct PPB_URLLoaderTrusted_0_3 PPB_URLLoaderTrusted; +/** + * @} + */ + +#endif /* PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/trusted/ppp_broker.h
Added
@@ -0,0 +1,102 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From trusted/ppp_broker.idl modified Sat Jul 16 16:51:03 2011. */ + +#ifndef PPAPI_C_TRUSTED_PPP_BROKER_H_ +#define PPAPI_C_TRUSTED_PPP_BROKER_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines functions that your module must implement to support a + * broker. + */ + + +// {PENDING: undefine PP_EXPORT?} + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" + + +#if __GNUC__ >= 4 + +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + + + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Typedefs + * @{ + */ + +/** + * PP_ConnectInstance_Func defines the signature that you implement to + * receive notifications when a plugin instance connects to the broker. + * The broker should listen on the socket before returning. + * + * @param[in] instance The plugin instance connecting to the broker. + * @param[in] handle Handle to a socket the broker can use to communicate with + * the plugin. + * @return PP_OK on success. Any other value on failure. + */ +typedef int32_t (*PP_ConnectInstance_Func)(PP_Instance instance, + int32_t handle); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeBroker() is the entry point for a broker and is + * called by the browser when your module loads. Your code must implement this + * function. + * + * Failure indicates to the browser that this broker can not be used. In this + * case, the broker will be unloaded. + * + * @param[out] connect_instance_func A pointer to a connect instance function. + * @return PP_OK on success. Any other value on failure. +*/ +PP_EXPORT int32_t PPP_InitializeBroker( + PP_ConnectInstance_Func* connect_instance_func); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** PPP_ShutdownBroker() is called before the broker is unloaded. + */ +PP_EXPORT void PPP_ShutdownBroker(); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PPAPI_C_TRUSTED_PPP_BROKER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppextscriptobject.cpp
Added
@@ -0,0 +1,67 @@ +/************************************************************************** + Lighspark, a free flash player implementation + + Copyright (C) 2016 Ludger Krämer <dbluelle@onlinehome.de> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ +#include "ppextscriptobject.h" +#include "plugin_ppapi/plugin.h" + +using namespace lightspark; + +ppExtScriptObject::ppExtScriptObject(ppPluginInstance *_instance, SystemState *sys):ExtScriptObject(sys),instance(_instance) +{ + ppScriptObject= PP_MakeUndefined(); +} + +ExtIdentifier *ppExtScriptObject::createEnumerationIdentifier(const ExtIdentifier &id) const +{ + return new ExtIdentifier(id); +} + +void ppExtScriptObject::setException(const std::string &message) const +{ + LOG(LOG_NOT_IMPLEMENTED,"ppExtScriptObject::setException:"<<message); +} + +void ppExtScriptObject::callAsync(ExtScriptObject::HOST_CALL_DATA *data) +{ + instance->executeScriptAsync(data); +} + +bool ppExtScriptObject::callExternalHandler(const char *scriptString, const ExtVariant **args, uint32_t argc, ASObject **result) +{ + return instance->executeScript(scriptString,args,argc,result); +} + +bool ppExtScriptObject::invoke(const ExtIdentifier& method_name, uint32_t argc, const ExtVariant** objArgs, PP_Var *result) +{ + // This will hold our eventual callback result + const lightspark::ExtVariant* objResult = NULL; + bool res = doinvoke(method_name,objArgs,argc,objResult); + + // Delete converted arguments + for(uint32_t i = 0; i < argc; i++) + delete objArgs[i]; + + if(objResult != NULL) + { + // Copy the result into the raw ppVariant result and delete intermediate result + std::map<const ExtObject*, PP_Var> objectsMap; + ppVariantObject::ExtVariantToppVariant(objectsMap,instance->getppInstance(),*objResult, *result); + delete objResult; + } + return res; +}
View file
lightspark.tar.xz/src/plugin_ppapi/ppextscriptobject.h
Added
@@ -0,0 +1,34 @@ +#ifndef PPEXTSCRIPTOBJECT_H +#define PPEXTSCRIPTOBJECT_H +#include "backends/extscriptobject.h" +#include "ppapi/c/pp_var.h" + +namespace lightspark +{ +class ppPluginInstance; + + +class ppExtScriptObject : public ExtScriptObject +{ +private: + ppPluginInstance* instance; +public: + PP_Var ppScriptObject; + ppExtScriptObject(ppPluginInstance* _instance,SystemState* sys); + + // Enumeration + ExtIdentifier* createEnumerationIdentifier(const ExtIdentifier& id) const; + + void setException(const std::string& message) const; + + void callAsync(HOST_CALL_DATA* data); + + // This is called from hostCallHandler() via doHostCall(EXTERNAL_CALL, ...) + virtual bool callExternalHandler(const char* scriptString, const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result); + + bool invoke(const ExtIdentifier &method_name, uint32_t argc, const ExtVariant **objArgs, PP_Var* result); + ppPluginInstance* getInstance() const { return instance; } +}; + +} +#endif // PPEXTSCRIPTOBJECT_H
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -465,7 +465,6 @@ class MovieClip: public Sprite, public FrameContainer { -friend class ParserThread; private: uint32_t getCurrentScene() const; const Scene_data *getScene(const tiny_string &sceneName) const;
View file
lightspark.tar.xz/src/scripting/toplevel/JSON.cpp
Changed
@@ -37,6 +37,7 @@ void JSON::buildTraits(ASObject* o) { } + ASFUNCTIONBODY(JSON,_constructor) { throwError<ArgumentError>(kCantInstantiateError); @@ -48,6 +49,15 @@ return NULL; } +ASObject *JSON::doParse(const tiny_string &jsonstring, IFunction *reviver) +{ + ASObject* res = NULL; + multiname dummy(NULL); + + parseAll(jsonstring,&res,dummy,reviver); + return res; +} + ASFUNCTIONBODY(JSON,_parse) { tiny_string text; @@ -62,11 +72,7 @@ throwError<TypeError>(kCheckTypeFailedError); reviver = args[1]->as<IFunction>(); } - ASObject* res = NULL; - multiname dummy(NULL); - - parseAll(text,&res,dummy,reviver); - return res; + return doParse(text,reviver); } ASFUNCTIONBODY(JSON,_stringify)
View file
lightspark.tar.xz/src/scripting/toplevel/JSON.h
Changed
@@ -35,6 +35,7 @@ ASFUNCTION(generator); ASFUNCTION(_parse); ASFUNCTION(_stringify); + static ASObject* doParse(const tiny_string &jsonstring, IFunction *reviver); private: static void parseAll(const tiny_string &jsonstring, ASObject** parent , const multiname& key, IFunction *reviver); static int parse(const tiny_string &jsonstring, int pos, ASObject **parent, const multiname &key,IFunction* reviver);
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.