Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
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 + if(shuttingDown) + return false; + + // Check if the method exists + std::map<ExtIdentifier, lightspark::ExtCallback*>::iterator it; + it = methods.find(id); + if(it == methods.end()) + return false; + + LOG(LOG_CALLS,"Plugin callback from the browser: " << id.getString()); + + // 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, id, args, 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, &result); + + // 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; + + return res; +} + + +bool ExtScriptObject::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& ExtScriptObject::getProperty(const lightspark::ExtIdentifier& id) const +{ + std::map<ExtIdentifier, ExtVariant>::const_iterator it = properties.find(id); + assert(it != properties.end()); + return it->second; +} +bool ExtScriptObject::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; +} + +bool ExtScriptObject::enumerate(ExtIdentifier ***ids, uint32_t *count) 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] = createEnumerationIdentifier(prop_it->first); + i++; + } + std::map<ExtIdentifier, lightspark::ExtCallback*>::const_iterator meth_it; + for(meth_it = methods.begin(); meth_it != methods.end(); ++meth_it) + { + (*ids)[i] = createEnumerationIdentifier(meth_it->first); + i++; + } + + return true; +} +// Standard Flash methods +bool ExtScriptObject::stdGetVariable(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + if(argc!=1 || args[0]->getType()!=lightspark::ExtVariant::EV_STRING) + return false; + //Only support properties currently + ExtIdentifier argId(args[0]->getString()); + if(so.hasProperty(argId)) + { + *result=new ExtVariant(so.getProperty(argId)); + return true; + } + + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdGetVariable"); + *result = new ExtVariant(); + return false; +} + +bool ExtScriptObject::stdSetVariable(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdSetVariable"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdGotoFrame(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdGotoFrame"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdIsPlaying(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdIsPlaying"); + *result = new ExtVariant(true); + return true; +} + +bool ExtScriptObject::stdLoadMovie(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdLoadMovie"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdPan(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdPan"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdPercentLoaded(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdPercentLoaded"); + *result = new ExtVariant(100); + return true; +} + +bool ExtScriptObject::stdPlay(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdPlay"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdRewind(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdRewind"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdStopPlay(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdStopPlay"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdSetZoomRect(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdSetZoomRect"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdZoom(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdZoom"); + *result = new ExtVariant(false); + return false; +} + +bool ExtScriptObject::stdTotalFrames(const lightspark::ExtScriptObject& so, + const lightspark::ExtIdentifier& id, + const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) +{ + LOG(LOG_NOT_IMPLEMENTED, "ExtScriptObject::stdTotalFrames"); + *result = new ExtVariant(false); + return false; +}
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; - for(meth_it = methods.begin(); meth_it != methods.end(); ++meth_it) - { - (*ids)[i] = new NPIdentifierObject(meth_it->first); - i++; - } - - return true; -} - -// This method allows calling a function on the main thread in a generic way. -void NPScriptObject::doHostCall(NPScriptObject::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) - NPN_PluginThreadAsyncCall(instance, &NPScriptObject::hostCallHandler, &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 NPScriptObject::hostCallHandler(void* d) -{ - HOST_CALL_DATA* callData = static_cast<HOST_CALL_DATA*>(d); - - nsPluginInstance* plugin = static_cast<nsPluginInstance*>(callData->so->instance->pdata); - lightspark::SystemState* prevSys = getSys(); - bool tlsSysSet = false; - if(plugin && plugin->m_sys) - { - tlsSysSet = true; - setTLSSys(plugin->m_sys); - } - - // Assert we are in the main plugin thread - callData->so->assertThread(); - - switch(callData->type) - { - case EXTERNAL_CALL: - *static_cast<bool*>(callData->returnValue) = callExternalHandler(callData->so->instance, - 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); + return new NPIdentifierObject(id); } -// ExtScriptObject interface: calling external methods -bool NPScriptObject::callExternal(const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result) +void NPScriptObject::callAsync(ExtScriptObject::HOST_CALL_DATA *data) { - // 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; + NPN_PluginThreadAsyncCall(instance, &NPScriptObject::hostCallHandler, data); } -bool NPScriptObject::callExternalHandler(NPP instance, const char* scriptString, - const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result) +bool NPScriptObject::callExternalHandler(const char* scriptString, const lightspark::ExtVariant** args, uint32_t argc, lightspark::ASObject** result) { // !!! We assume this method is only called on the main thread !!! @@ -862,139 +562,12 @@ void NPScriptObject::setException(const std::string& message) const { - if(marshallExceptions) + if(getMarshallExceptions()) NPN_SetException(gw, message.c_str()); else NPN_SetException(gw, "Error in Actionscript. Use a try/catch block to find error."); } -// Standard Flash methods -bool NPScriptObject::stdGetVariable(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - if(argc!=1 || args[0]->getType()!=lightspark::ExtVariant::EV_STRING) - return false; - //Only support properties currently - ExtIdentifier argId(args[0]->getString()); - if(so.hasProperty(argId)) - { - *result=new ExtVariant(so.getProperty(argId)); - return true; - } - - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdGetVariable"); - *result = new ExtVariant(); - return false; -} - -bool NPScriptObject::stdSetVariable(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdSetVariable"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdGotoFrame(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdGotoFrame"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdIsPlaying(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdIsPlaying"); - *result = new ExtVariant(true); - return true; -} - -bool NPScriptObject::stdLoadMovie(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdLoadMovie"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdPan(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdPan"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdPercentLoaded(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdPercentLoaded"); - *result = new ExtVariant(100); - return true; -} - -bool NPScriptObject::stdPlay(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdPlay"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdRewind(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdRewind"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdStopPlay(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdStopPlay"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdSetZoomRect(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdSetZoomRect"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdZoom(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdZoom"); - *result = new ExtVariant(false); - return false; -} - -bool NPScriptObject::stdTotalFrames(const lightspark::ExtScriptObject& so, - const lightspark::ExtIdentifier& id, - const lightspark::ExtVariant** args, uint32_t argc, const lightspark::ExtVariant** result) -{ - LOG(LOG_NOT_IMPLEMENTED, "NPScriptObject::stdTotalFrames"); - *result = new ExtVariant(false); - return false; -} /* -- NPScriptObjectGW -- */ // NPScriptObjectGW NPClass for use with NPRuntime @@ -1016,13 +589,10 @@ }; // Constructor -NPScriptObjectGW::NPScriptObjectGW(NPP inst) : instance(inst) +NPScriptObjectGW::NPScriptObjectGW(NPP inst) : m_sys(NULL),instance(inst) { assert(instance != NULL); - so = new NPScriptObject(this); - NPN_GetValue(instance, NPNVWindowNPObject, &windowObject); - NPN_GetValue(instance, NPNVPluginElementNPObject, &pluginElementObject); } // Destructor @@ -1032,6 +602,14 @@ // This is the only way we can guarantee that it is deleted _before_ SystemState is deleted. } +void NPScriptObjectGW::createScriptObject(SystemState *sys) +{ + m_sys = sys; + so = new NPScriptObject(this,m_sys); + NPN_GetValue(instance, NPNVWindowNPObject, &windowObject); + NPN_GetValue(instance, NPNVPluginElementNPObject, &pluginElementObject); +} + // Properties bool NPScriptObjectGW::getProperty(NPObject* obj, NPIdentifier id, NPVariant* result) {
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) + { + LOG(LOG_ERROR,"exception during ppObjectObject::ppObjectObject: GetProperty"<<g_var_interface->VarToUtf8(exception,&len)); + continue; + } + switch(prop.type) + { + case PP_VARTYPE_INT32: + id = ExtIdentifier(prop.value.as_int); + break; + case PP_VARTYPE_STRING: + id = ExtIdentifier(g_var_interface->VarToUtf8(prop,&len)); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"ppVariantObject::ppObjectObject for type:"<<(int)prop.type); + continue; + } + setProperty(id,ppVariantObject(objectsMap,value)); + } +} + + +PP_Var ppObjectObject::getppObject(std::map<const ExtObject*, PP_Var>& objectsMap,PP_Instance instance, const ExtObject* obj) +{ + auto it=objectsMap.find(obj); + if(it!=objectsMap.end()) + { + return it->second; + } + uint32_t count = obj->getLength(); + + tiny_string s("new Object()"); + PP_Var exception = PP_MakeUndefined(); + PP_Var scr = g_var_interface->VarFromUtf8(s.raw_buf(),s.numBytes()); + PP_Var result =g_instance_private_interface->ExecuteScript(instance,scr,&exception); + uint32_t len; + if (exception.type == PP_VARTYPE_STRING) + { + LOG(LOG_ERROR,"exception during ppObjectObject::getppObject Construct:"<<g_var_interface->VarToUtf8(exception,&len)); + return result; + } + + objectsMap[obj] = result; + + PP_Var varProperty; + ExtIdentifier** ids = NULL; + // Set all values of the object + if(obj->enumerate(&ids, &count)) + { + for(uint32_t i = 0; i < count; i++) + { + const ExtVariant& property = obj->getProperty(*ids[i]); + ppVariantObject::ExtVariantToppVariant(objectsMap,instance, property, varProperty); + + PP_Var propname; + switch (ids[i]->getType()) + { + case ExtVariant::EV_STRING: + { + std::string name = ids[i]->getString(); + propname = g_var_interface->VarFromUtf8(name.c_str(),name.length()); + break; + } + case ExtVariant::EV_INT32: + propname = PP_MakeInt32(ids[i]->getInt()); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"ppObjectObject::getppObject for type "<<property.getType()); + continue; + } + g_var_deprecated_interface->SetProperty(result,propname,varProperty,&exception); + if (exception.type == PP_VARTYPE_STRING) + { + LOG(LOG_ERROR,"exception during ppObjectObject::getppObject SetProperty:"<<g_var_interface->VarToUtf8(exception,&len)); + } + delete ids[i]; + } + } + if(ids != NULL) + delete[] ids; + return result; +} + ppDownloadManager::ppDownloadManager(PP_Instance _instance, SystemState *sys):instance(_instance),m_sys(sys) { type = NPAPI; @@ -159,21 +384,11 @@ PP_Resource response = g_urlloader_interface->GetResponseInfo(th->ppurlloader); PP_Var v; uint32_t len; - v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_STATUSCODE); - LOG(LOG_INFO,"statuscode:"<<v.value.as_int); - v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_STATUSLINE); - tiny_string statusline = g_var_interface->VarToUtf8(v,&len); - LOG(LOG_INFO,"statusline:"<<statusline); v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_HEADERS); tiny_string headers = g_var_interface->VarToUtf8(v,&len); LOG(LOG_INFO,"headers:"<<len<<" "<<headers); - //th->parseHeaders(headers.raw_buf(),true); + th->parseHeaders(headers.raw_buf(),true); - int64_t bytes_received; - int64_t total_bytes_to_be_received; - g_urlloader_interface->GetDownloadProgress(th->ppurlloader,&bytes_received,&total_bytes_to_be_received); - if (total_bytes_to_be_received >0) - th->setLength(total_bytes_to_be_received); if (th->isMainClipDownloader) { v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_URL); @@ -181,6 +396,8 @@ LOG(LOG_INFO,"mainclip url:"<<url); th->m_sys->mainClip->setOrigin(url); + th->m_sys->parseParametersFromURL(th->m_sys->mainClip->getOrigin()); + th->m_sys->mainClip->setBaseURL(url); } @@ -195,18 +412,19 @@ ppDownloader* th = (ppDownloader*)userdata; if (result < 0) { - LOG(LOG_ERROR,"download failed:"<<result<<" "<<th->getURL()<<" "<<th->getReceivedLength()<<"/"<<th->getLength()); + LOG(LOG_ERROR,"download failed:"<<result<<" "<<th->getURL()<<" "<<th->downloadedlength<<"/"<<th->getLength()); th->setFailed(); return; } - bool haslength = th->getReceivedLength() < th->getLength(); th->append(th->buffer,result); - if ((haslength && th->getReceivedLength() == th->getLength())|| - (!haslength && result == 0)) // no content-length header set and no bytes read => finish download - + if (th->downloadedlength == 0 && th->isMainClipDownloader) + th->m_pluginInstance->startMainParser(); + th->downloadedlength += result; + + if (th->downloadedlength == th->getLength()) { th->setFinished(); - LOG(LOG_INFO,"download done:"<<th->getURL()<<" "<<th->getReceivedLength()<<" "<<th->getLength()); + LOG(LOG_INFO,"download done:"<<th->getURL()<<" "<<th->downloadedlength<<" "<<th->getLength()); return; } struct PP_CompletionCallback cb; @@ -215,26 +433,17 @@ cb.user_data = th; g_urlloader_interface->ReadResponseBody(th->ppurlloader,th->buffer,4096,cb); } -ppDownloader::ppDownloader(const lightspark::tiny_string& _url, PP_Instance _instance, lightspark::ILoadable* owner,SystemState* sys): - Downloader(_url, _MR(new MemoryStreamCache), owner),isMainClipDownloader(true),m_sys(sys),state(INIT) +ppDownloader::ppDownloader(const lightspark::tiny_string& _url, PP_Instance _instance, lightspark::ILoadable* owner, ppPluginInstance *ppinstance): + Downloader(_url, _MR(new MemoryStreamCache), owner),isMainClipDownloader(true),m_sys(ppinstance->getSystemState()),m_pluginInstance(ppinstance),downloadedlength(0),state(INIT) { - PP_Var btrue; - btrue.type = PP_VARTYPE_BOOL; - btrue.value.as_bool = PP_TRUE; - ppurlloader = g_urlloader_interface->Create(_instance); + g_urlloadedtrusted_interface->GrantUniversalAccess(ppurlloader); PP_Resource pprequest_info = g_urlrequestinfo_interface->Create(_instance); PP_Var url = g_var_interface->VarFromUtf8(_url.raw_buf(),_url.numBytes()); g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_URL,url); - g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS,btrue); + g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,PP_MakeBool(PP_TRUE)); LOG(LOG_INFO,"constructing downloader:"<<_url); - - if (_url.startsWith("//")) - { - g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,btrue); - } - struct PP_CompletionCallback cb; cb.func = dlStartCallback; cb.flags = 0; @@ -246,16 +455,18 @@ } ppDownloader::ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> _cache, PP_Instance _instance, lightspark::ILoadable* owner): - Downloader(_url, _cache, owner),isMainClipDownloader(false),m_sys(NULL),state(INIT) + Downloader(_url, _cache, owner),isMainClipDownloader(false),m_sys(NULL),m_pluginInstance(NULL),downloadedlength(0),state(INIT) { + LOG(LOG_ERROR,"Download constructor2 not implemented"); ppurlloader = g_urlloader_interface->Create(_instance); } ppDownloader::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): - Downloader(_url, _cache, _data, headers, owner),isMainClipDownloader(false),m_sys(NULL),state(INIT) + Downloader(_url, _cache, _data, headers, owner),isMainClipDownloader(false),m_sys(NULL),m_pluginInstance(NULL),downloadedlength(0),state(INIT) { + LOG(LOG_ERROR,"Download constructor3 not implemented"); ppurlloader = g_urlloader_interface->Create(_instance); } @@ -263,7 +474,6 @@ m_ppinstance(instance), mainDownloaderStreambuf(NULL),mainDownloaderStream(NULL), mainDownloader(NULL), - //scriptObject(NULL), m_pt(NULL) { m_last_size.width = 0; @@ -275,10 +485,7 @@ //Files running in the plugin have REMOTE sandbox m_sys->securityManager->setSandboxType(lightspark::SecurityManager::REMOTE); -// scriptObject = -// (NPScriptObjectGW *) NPN_CreateObject(mInstance, &NPScriptObjectGW::npClass); -// m_sys->extScriptObject = scriptObject->getScriptObject(); -// scriptObject->m_sys = m_sys; + m_sys->extScriptObject = new ppExtScriptObject(this,m_sys); //Parse OBJECT/EMBED tag attributes tiny_string swffile; for(int i=0;i<argc;i++) @@ -292,7 +499,7 @@ } else if(strcasecmp(argn[i],"name")==0) { - //m_sys->extScriptObject->setProperty(argn[i],argv[i]); + m_sys->extScriptObject->setProperty(argn[i],argv[i]); } else if(strcasecmp(argn[i],"src")==0) { @@ -304,17 +511,21 @@ m_sys->downloadManager=new ppDownloadManager(m_ppinstance,m_sys); EngineData::startSDLMain(); - mainDownloader=new ppDownloader(swffile,m_ppinstance,m_sys->mainClip->loaderInfo.getPtr(),m_sys); - mainDownloaderStreambuf = mainDownloader->getCache()->createReader(); - mainDownloaderStream.rdbuf(mainDownloaderStreambuf); - m_pt=new lightspark::ParseThread(mainDownloaderStream,m_sys->mainClip); - m_sys->addJob(m_pt); - - //EngineData::mainthread_running = true; + mainDownloader=new ppDownloader(swffile,m_ppinstance,m_sys->mainClip->loaderInfo.getPtr(),this); + // loader is notified through parsethread + mainDownloader->getCache()->setNotifyLoader(false); } //The sys var should be NULL in this thread setTLSSys( NULL ); } +void ppPluginInstance::startMainParser() +{ + mainDownloaderStreambuf = mainDownloader->getCache()->createReader(); + mainDownloaderStream.rdbuf(mainDownloaderStreambuf); + m_pt=new lightspark::ParseThread(mainDownloaderStream,m_sys->mainClip); + m_sys->addJob(m_pt); + +} ppPluginInstance::~ppPluginInstance() { @@ -325,8 +536,12 @@ if (mainDownloaderStreambuf) delete mainDownloaderStreambuf; - // Kill all stuff relating to NPScriptObject which is still running -// static_cast<NPScriptObject*>(m_sys->extScriptObject)->destroy(); + if (m_sys->extScriptObject) + { + m_sys->extScriptObject->destroy(); + delete m_sys->extScriptObject; + m_sys->extScriptObject = NULL; + } m_sys->setShutdownFlag(); @@ -337,17 +552,11 @@ } void swapbuffer_callback(void* userdata,int result) { - SystemState* sys = (SystemState*)userdata; - setTLSSys(sys); - - sys->getRenderThread()->doRender(); - - struct PP_CompletionCallback cb; - cb.func = swapbuffer_callback; - cb.flags = 0; - cb.user_data = sys; - g_graphics_3d_interface->SwapBuffers(((ppPluginEngineData*)sys->getEngineData())->getGraphics(),cb); + ppPluginEngineData* data = (ppPluginEngineData*)userdata; + RELEASE_WRITE(data->inRendering,false); } + + void ppPluginInstance::handleResize(PP_Resource view) { struct PP_Rect position; @@ -372,24 +581,321 @@ LOG(LOG_ERROR,"Instance_DidChangeView: couldn't create graphics"); return; } + LOG(LOG_INFO,"Instance_DidChangeView: create:"<<position.size.width<<" "<<position.size.height); ppPluginEngineData* e = new ppPluginEngineData(this, position.size.width, position.size.height,m_sys); m_sys->setParamsAndEngine(e, false); - } - else - { g_graphics_3d_interface->ResizeBuffers(m_graphics,position.size.width, position.size.height); m_sys->getRenderThread()->SetEngineData(m_sys->getEngineData()); m_sys->getRenderThread()->init(); struct PP_CompletionCallback cb; cb.func = swapbuffer_callback; cb.flags = 0; - cb.user_data = m_sys; + cb.user_data = m_sys->getEngineData(); g_graphics_3d_interface->SwapBuffers(m_graphics,cb); } + else + { + LOG(LOG_INFO,"Instance_DidChangeView: resize after creation:"<<position.size.width<<" "<<position.size.height); + g_graphics_3d_interface->ResizeBuffers(m_graphics,position.size.width, position.size.height); + m_sys->getEngineData()->width =position.size.width; + m_sys->getEngineData()->height =position.size.height; + m_sys->getRenderThread()->requestResize(position.size.width,position.size.height,true); + } m_last_size.width = position.size.width; m_last_size.height = position.size.height; } } +typedef struct { + const char* ppkey; + SDL_Keycode sdlkeycode; +} ppKeyMap; + +// the ppkey values are taken from https://www.w3.org/TR/uievents-key/ +ppKeyMap ppkeymap[] = { + { "KeyA", SDLK_a }, + { "AltLeft", SDLK_LALT }, + { "KeyB", SDLK_b }, + { "BrowserBack", SDLK_AC_BACK }, + { "Backquote", SDLK_BACKQUOTE }, + { "Backslash", SDLK_BACKSLASH }, + { "Backspace", SDLK_BACKSPACE }, +// { "Blue", SDLK_UNKNOWN }, // TODO + { "KeyC", SDLK_c }, + { "CapsLock", SDLK_CAPSLOCK }, + { "Comma", SDLK_COMMA }, + { "ControlLeft", SDLK_LCTRL }, + { "KeyD", SDLK_d }, + { "Delete", SDLK_DELETE }, + { "ArrowDown", SDLK_DOWN }, + { "KeyE", SDLK_e }, + { "End", SDLK_END }, + { "Enter", SDLK_RETURN }, + { "Equal", SDLK_EQUALS }, + { "Escape", SDLK_ESCAPE }, + { "KeyF", SDLK_f }, + { "F1", SDLK_F1 }, + { "F2", SDLK_F2 }, + { "F3", SDLK_F3 }, + { "F4", SDLK_F4 }, + { "F5", SDLK_F5 }, + { "F6", SDLK_F6 }, + { "F7", SDLK_F7 }, + { "F8", SDLK_F8 }, + { "F9", SDLK_F9 }, + { "F10", SDLK_F10 }, + { "F11", SDLK_F11 }, + { "F12", SDLK_F12 }, +// { "F13", SDLK_F13 },// TODO +// { "F14", SDLK_F14 },// TODO +// { "F15", SDLK_F15 },// TODO + { "KeyG", SDLK_g }, +// { "Green", SDLK_UNKNOWN }, // TODO + { "KeyH", SDLK_h }, + { "Help", SDLK_HELP }, + { "Home", SDLK_HOME }, + { "KeyI", SDLK_i }, + { "Insert", SDLK_INSERT }, + { "KeyJ", SDLK_j }, + { "KeyK", SDLK_k }, + { "KeyL", SDLK_l }, + { "ArrowLeft", SDLK_LEFT }, + { "BracketLeft", SDLK_LEFTBRACKET }, + { "KeyM", SDLK_m }, + { "Minus", SDLK_MINUS }, + { "KeyN", SDLK_n }, + { "Digit0", SDLK_0 }, + { "Digit1", SDLK_1 }, + { "Digit2", SDLK_2 }, + { "Digit3", SDLK_3 }, + { "Digit4", SDLK_4 }, + { "Digit5", SDLK_5 }, + { "Digit6", SDLK_6 }, + { "Digit7", SDLK_7 }, + { "Digit8", SDLK_8 }, + { "Digit9", SDLK_9 }, + { "Numpad0", SDLK_KP_0 }, + { "Numpad1", SDLK_KP_1 }, + { "Numpad2", SDLK_KP_2 }, + { "Numpad3", SDLK_KP_3 }, + { "Numpad4", SDLK_KP_4 }, + { "Numpad5", SDLK_KP_5 }, + { "Numpad6", SDLK_KP_6 }, + { "Numpad7", SDLK_KP_7 }, + { "Numpad8", SDLK_KP_8 }, + { "Numpad9", SDLK_KP_9 }, + { "NumpadAdd", SDLK_KP_MEMADD }, + { "NumpadDecimal", SDLK_KP_PERIOD }, + { "NumpadDivide", SDLK_KP_DIVIDE }, + { "NumpadEnter", SDLK_KP_ENTER }, + { "NumpadMultiply", SDLK_KP_MULTIPLY }, + { "NumpadSubtract", SDLK_KP_MINUS }, + { "KeyO", SDLK_o }, + { "KeyP", SDLK_p }, + { "PageDown", SDLK_PAGEDOWN }, + { "PageUp", SDLK_PAGEUP }, + { "Pause", SDLK_PAUSE }, + { "Period", SDLK_PERIOD }, + { "KeyQ", SDLK_q }, + { "Quote", SDLK_QUOTE }, + { "KeyR", SDLK_r }, +// { "Red", SDLK_UNKNOWN }, // TODO + { "ArrowRight", SDLK_RIGHT }, + { "BracketRight", SDLK_RIGHTBRACKET }, + { "KeyS", SDLK_s }, + { "BrowserSearch", SDLK_AC_SEARCH }, + { "Semicolon", SDLK_SEMICOLON }, + { "ShiftLeft", SDLK_LSHIFT }, + { "Slash", SDLK_SLASH }, + { "Space", SDLK_SPACE }, +// { "Subtitle", SDLK_UNKNOWN }, // TODO + { "KeyT", SDLK_t }, + { "Tab", SDLK_TAB }, + { "KeyU", SDLK_u }, + { "ArrowUp", SDLK_UP }, + { "KeyV", SDLK_v }, + { "KeyW", SDLK_w }, + { "KeyX", SDLK_x }, + { "KeyY", SDLK_y }, +// { "Yellow", SDLK_UNKNOWN }, // TODO + { "KeyZ", SDLK_z }, + { "", SDLK_UNKNOWN } // indicator for last entry +}; +SDL_Keycode getppSDLKeyCode(PP_Resource input_event) +{ + PP_Var v = g_keyboardinputevent_interface->GetCode(input_event); + uint32_t len; + const char* key = g_var_interface->VarToUtf8(v,&len); + int i = 0; + while (*ppkeymap[i].ppkey) + { + if (strcmp(ppkeymap[i].ppkey,key) == 0) + return ppkeymap[i].sdlkeycode; + ++i; + } + LOG(LOG_NOT_IMPLEMENTED,"no matching keycode for input event found:"<<key); + return SDLK_UNKNOWN; +}; +static uint16_t getppKeyModifier(PP_Resource input_event) +{ + uint32_t mod = g_inputevent_interface->GetModifiers(input_event); + uint16_t res = KMOD_NONE; + if (mod & PP_INPUTEVENT_MODIFIER_CONTROLKEY) + res |= KMOD_CTRL; + if (mod & PP_INPUTEVENT_MODIFIER_ALTKEY) + res |= KMOD_ALT; + if (mod & PP_INPUTEVENT_MODIFIER_SHIFTKEY) + res |= KMOD_SHIFT; + return res; +} + +PP_Bool ppPluginInstance::handleInputEvent(PP_Resource input_event) +{ + SDL_Event ev; + switch (g_inputevent_interface->GetType(input_event)) + { + case PP_INPUTEVENT_TYPE_KEYDOWN: + { + + ev.type = SDL_KEYDOWN; + ev.key.keysym.sym = getppSDLKeyCode(input_event); + ev.key.keysym.mod = getppKeyModifier(input_event); + SDL_SetModState((SDL_Keymod)ev.key.keysym.mod); + break; + } + case PP_INPUTEVENT_TYPE_KEYUP: + { + ev.type = SDL_KEYUP; + ev.key.keysym.sym = getppSDLKeyCode(input_event); + ev.key.keysym.mod = getppKeyModifier(input_event); + SDL_SetModState((SDL_Keymod)ev.key.keysym.mod); + break; + } + case PP_INPUTEVENT_TYPE_MOUSEDOWN: + { + ev.type = SDL_MOUSEBUTTONDOWN; + + switch (g_mouseinputevent_interface->GetButton(input_event)) + { + case PP_INPUTEVENT_MOUSEBUTTON_LEFT: + ev.button.button = SDL_BUTTON_LEFT; + ev.button.state = g_inputevent_interface->GetModifiers(input_event) & PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN ? SDL_PRESSED : SDL_RELEASED; + break; + case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: + ev.button.button = SDL_BUTTON_RIGHT; + ev.button.state = g_inputevent_interface->GetModifiers(input_event) & PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN ? SDL_PRESSED : SDL_RELEASED; + break; + default: + ev.button.button = 0; + ev.button.state = SDL_RELEASED; + break; + } + ev.button.clicks = g_mouseinputevent_interface->GetClickCount(input_event); + PP_Point p = g_mouseinputevent_interface->GetPosition(input_event); + ev.button.x = p.x; + ev.button.y = p.y; + break; + } + case PP_INPUTEVENT_TYPE_MOUSEUP: + { + ev.type = SDL_MOUSEBUTTONUP; + switch (g_mouseinputevent_interface->GetButton(input_event)) + { + case PP_INPUTEVENT_MOUSEBUTTON_LEFT: + ev.button.button = SDL_BUTTON_LEFT; + ev.button.state = g_inputevent_interface->GetModifiers(input_event) & PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN ? SDL_PRESSED : SDL_RELEASED; + break; + case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: + ev.button.button = SDL_BUTTON_RIGHT; + ev.button.state = g_inputevent_interface->GetModifiers(input_event) & PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN ? SDL_PRESSED : SDL_RELEASED; + break; + default: + ev.button.button = 0; + ev.button.state = SDL_RELEASED; + break; + } + ev.button.clicks = 0; + PP_Point p = g_mouseinputevent_interface->GetPosition(input_event); + ev.button.x = p.x; + ev.button.y = p.y; + break; + } + case PP_INPUTEVENT_TYPE_MOUSEMOVE: + { + ev.type = SDL_MOUSEMOTION; + ev.motion.state = g_inputevent_interface->GetModifiers(input_event) & PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN ? SDL_PRESSED : SDL_RELEASED; + PP_Point p = g_mouseinputevent_interface->GetMovement(input_event); + ev.motion.x = p.x; + ev.motion.y = p.y; + break; + } + case PP_INPUTEVENT_TYPE_WHEEL: + { + PP_FloatPoint p = g_wheelinputevent_interface->GetDelta(input_event); + ev.type = SDL_MOUSEWHEEL; +#if SDL_VERSION_ATLEAST(2, 0, 4) + ev.wheel.direction = p.y > 0 ? SDL_MOUSEWHEEL_NORMAL : SDL_MOUSEWHEEL_FLIPPED ; +#endif + ev.wheel.x = p.x; + ev.wheel.y = p.y; + break; + } + case PP_INPUTEVENT_TYPE_MOUSELEAVE: + { + ev.type = SDL_WINDOWEVENT_LEAVE; + break; + } + default: + LOG(LOG_NOT_IMPLEMENTED,"ppp_inputevent:"<<(int)g_inputevent_interface->GetType(input_event)); + return PP_FALSE; + } + EngineData::mainloop_handleevent(&ev,this->m_sys); + return PP_TRUE; +} + +void executescript_callback(void* userdata,int result) +{ + ExtScriptObject::hostCallHandler(userdata); +} +void ppPluginInstance::executeScriptAsync(ExtScriptObject::HOST_CALL_DATA *data) +{ + struct PP_CompletionCallback cb; + cb.func = executescript_callback; + cb.flags = 0; + cb.user_data = data; + g_core_interface->CallOnMainThread(0,cb,0); +} +bool ppPluginInstance::executeScript(const std::string script, const ExtVariant **args, uint32_t argc, ASObject **result) +{ + PP_Var scr = g_var_interface->VarFromUtf8(script.c_str(),script.length()); + PP_Var exception = PP_MakeUndefined(); + PP_Var func = g_instance_private_interface->ExecuteScript(m_ppinstance,scr,&exception); + *result = NULL; + uint32_t len; + if (exception.type == PP_VARTYPE_STRING) + { + LOG(LOG_ERROR,"error preparing script:"<<script<<" "<<g_var_interface->VarToUtf8(exception,&len)); + return false; + } + PP_Var* variantArgs = g_newa(PP_Var,argc); + for(uint32_t i = 0; i < argc; i++) + { + std::map<const ExtObject *, PP_Var> objectsMap; + ppVariantObject::ExtVariantToppVariant(objectsMap,m_ppinstance, *(args[i]), variantArgs[i]); + } + + PP_Var resultVariant = g_var_deprecated_interface->Call(func,PP_MakeUndefined(),argc,variantArgs,&exception); + + if (exception.type == PP_VARTYPE_STRING) + { + LOG(LOG_ERROR,"error calling script:"<<script<<" "<<g_var_interface->VarToUtf8(exception,&len)); + return false; + } + std::map<int64_t, std::unique_ptr<ExtObject>> ppObjectsMap; + ppVariantObject tmp(ppObjectsMap, resultVariant); + std::map<const ExtObject*, ASObject*> asObjectsMap; + *(result) = tmp.getASObject(asObjectsMap); + return true; +} std::map<PP_Instance,ppPluginInstance*> all_instances; @@ -400,6 +906,8 @@ ppPluginInstance* newinstance = new ppPluginInstance(instance,argc,argn,argv); all_instances[instance] = newinstance; + g_inputevent_interface->RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + g_inputevent_interface->RequestFilteringInputEvents(instance, PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); return PP_TRUE; } static void Instance_DidDestroy(PP_Instance instance) @@ -412,7 +920,6 @@ } static void Instance_DidChangeView(PP_Instance instance,PP_Resource view) { - LOG(LOG_INFO,"Instance_DidChangeView:"<<instance); auto it = all_instances.find(instance); if (it == all_instances.end()) { @@ -434,6 +941,191 @@ { LOG(LOG_INFO,"handleMessage:"<<(int)message.type); } + +static bool PPP_Class_HasProperty(void* object,struct PP_Var name,struct PP_Var* exception) +{ + uint32_t len; + switch (name.type) + { + case PP_VARTYPE_INT32: + return ((ppExtScriptObject*)object)->hasProperty(ExtIdentifier(name.value.as_int)); + case PP_VARTYPE_STRING: + return ((ppExtScriptObject*)object)->hasProperty(g_var_interface->VarToUtf8(name,&len)); + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_HasProperty for type "<<(int)name.type); + break; + } + return false; + +} +static bool PPP_Class_HasMethod(void* object,struct PP_Var name,struct PP_Var* exception) +{ + uint32_t len; + switch (name.type) + { + case PP_VARTYPE_INT32: + return ((ppExtScriptObject*)object)->hasMethod(ExtIdentifier(name.value.as_int)); + case PP_VARTYPE_STRING: + return ((ppExtScriptObject*)object)->hasMethod(g_var_interface->VarToUtf8(name,&len)); + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_HasMethod for type "<<(int)name.type); + break; + } + return false; +} +static struct PP_Var PPP_Class_GetProperty(void* object,struct PP_Var name,struct PP_Var* exception) +{ + ExtVariant v; + uint32_t len; + switch (name.type) + { + case PP_VARTYPE_INT32: + v = ((ppExtScriptObject*)object)->getProperty(ExtIdentifier(name.value.as_int)); + break; + case PP_VARTYPE_STRING: + v = ((ppExtScriptObject*)object)->getProperty(g_var_interface->VarToUtf8(name,&len)); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_HasMethod for type "<<(int)name.type); + break; + } + PP_Var result; + std::map<const ExtObject*, PP_Var> objectsMap; + ppVariantObject::ExtVariantToppVariant(objectsMap,((ppExtScriptObject*)object)->getInstance()->getppInstance(),v, result); + return result; +} +static void PPP_Class_GetAllPropertyNames(void* object,uint32_t* property_count,struct PP_Var** properties,struct PP_Var* exception) +{ + ExtIdentifier** ids = NULL; + bool success = ((ppExtScriptObject*)object)->enumerate(&ids, property_count); + if(success) + { + *properties = new PP_Var[*property_count]; + for(uint32_t i = 0; i < *property_count; i++) + { + switch (ids[i]->getType()) + { + case ExtIdentifier::EI_STRING: + *properties[i] = g_var_interface->VarFromUtf8(ids[i]->getString().c_str(),ids[i]->getString().length()); + break; + case ExtIdentifier::EI_INT32: + *properties[i] = PP_MakeInt32(ids[i]->getInt()); + break; + } + delete ids[i]; + } + } + else + { + properties = NULL; + property_count = 0; + } + + if(ids != NULL) + delete ids; +} + +static void PPP_Class_SetProperty(void* object,struct PP_Var name,struct PP_Var value,struct PP_Var* exception) +{ + uint32_t len; + std::map<int64_t, std::unique_ptr<ExtObject>> objectsMap; + switch (name.type) + { + case PP_VARTYPE_INT32: + ((ppExtScriptObject*)object)->setProperty(ExtIdentifier(name.value.as_int),ppVariantObject(objectsMap,value)); + break; + case PP_VARTYPE_STRING: + ((ppExtScriptObject*)object)->setProperty(ExtIdentifier(g_var_interface->VarToUtf8(name,&len)),ppVariantObject(objectsMap,value)); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_setProperty for type "<<(int)name.type); + break; + } +} + +static void PPP_Class_RemoveProperty(void* object,struct PP_Var name,struct PP_Var* exception) +{ + uint32_t len; + switch (name.type) + { + case PP_VARTYPE_INT32: + ((ppExtScriptObject*)object)->removeProperty(ExtIdentifier(name.value.as_int)); + break; + case PP_VARTYPE_STRING: + ((ppExtScriptObject*)object)->removeProperty(ExtIdentifier(g_var_interface->VarToUtf8(name,&len))); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_removeProperty for type "<<(int)name.type); + break; + } +} + +static struct PP_Var PPP_Class_Call(void* object,struct PP_Var name,uint32_t argc,struct PP_Var* argv,struct PP_Var* exception) +{ + PP_Var objResult = PP_MakeUndefined(); + uint32_t len; + ExtIdentifier method_name; + switch (name.type) + { + case PP_VARTYPE_INT32: + method_name=ExtIdentifier(name.value.as_int); + break; + case PP_VARTYPE_STRING: + method_name=ExtIdentifier(g_var_interface->VarToUtf8(name,&len)); + break; + default: + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_Call for method name type "<<(int)name.type); + return PP_MakeUndefined(); + } + std::map<int64_t, std::unique_ptr<ExtObject>> objectsMap; + const ExtVariant** objArgs = g_newa(const ExtVariant*,argc); + for (uint32_t i = 0; i < argc; i++) + { + objArgs[i]=new ppVariantObject(objectsMap,argv[i]); + } + ((ppExtScriptObject*)object)->invoke(method_name,argc,objArgs,&objResult); + + return objResult; +} + +static struct PP_Var PPP_Class_Construct(void* object,uint32_t argc,struct PP_Var* argv,struct PP_Var* exception) +{ + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_Construct:"<<object); + return PP_MakeUndefined(); +} + +static void PPP_Class_Deallocate(void* object) +{ + LOG(LOG_NOT_IMPLEMENTED,"PPP_Class_Deallocate:"<<object); +} + +static PPP_Class_Deprecated ppp_class_deprecated_scriptobject = { + &PPP_Class_HasProperty, + &PPP_Class_HasMethod, + &PPP_Class_GetProperty, + &PPP_Class_GetAllPropertyNames, + &PPP_Class_SetProperty, + &PPP_Class_RemoveProperty, + &PPP_Class_Call, + &PPP_Class_Construct, + &PPP_Class_Deallocate +}; + +static PP_Var Instance_Private_GetInstanceObject(PP_Instance instance) +{ + auto it = all_instances.find(instance); + if (it == all_instances.end()) + { + LOG(LOG_ERROR,"Instance_Private_GetInstanceObject: no matching PPPluginInstance found"); + return PP_MakeNull(); + } + ppExtScriptObject* scr = (ppExtScriptObject*)it->second->getSystemState()->extScriptObject; + if (scr == NULL) + return PP_MakeNull(); + scr->ppScriptObject = g_var_deprecated_interface->CreateObject(instance,&ppp_class_deprecated_scriptobject,(void*)it->second->getSystemState()->extScriptObject); + return scr->ppScriptObject; +} + static PPP_Instance instance_interface = { &Instance_DidCreate, &Instance_DidDestroy, @@ -444,7 +1136,24 @@ static PPP_Messaging messaging_interface = { &Messaging_HandleMessage, }; +static PPP_Instance_Private instance_private_interface = { + &Instance_Private_GetInstanceObject, +}; +static PP_Bool InputEvent_HandleInputEvent(PP_Instance instance, PP_Resource input_event) +{ + auto it = all_instances.find(instance); + if (it == all_instances.end()) + { + LOG(LOG_ERROR,"InputEvent_HandleInputEvent: no matching PPPluginInstance found"); + return PP_FALSE; + } + ppPluginInstance* info = it->second; + return info->handleInputEvent(input_event); +} +static PPP_InputEvent input_event_interface = { + &InputEvent_HandleInputEvent, +}; extern "C" { PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id,PPB_GetInterface get_browser_interface) @@ -472,7 +1181,15 @@ g_urlloader_interface = (const PPB_URLLoader*)get_browser_interface(PPB_URLLOADER_INTERFACE); g_urlrequestinfo_interface = (const PPB_URLRequestInfo*)get_browser_interface(PPB_URLREQUESTINFO_INTERFACE); g_urlresponseinfo_interface = (const PPB_URLResponseInfo*)get_browser_interface(PPB_URLRESPONSEINFO_INTERFACE); - g_gles2_interface = (PPB_OpenGLES2*)get_browser_interface(PPB_OPENGLES2_INTERFACE); + g_gles2_interface = (const PPB_OpenGLES2*)get_browser_interface(PPB_OPENGLES2_INTERFACE); + g_urlloadedtrusted_interface = (const PPB_URLLoaderTrusted*)get_browser_interface(PPB_URLLOADERTRUSTED_INTERFACE); + g_instance_private_interface = (const PPB_Instance_Private*)get_browser_interface(PPB_INSTANCE_PRIVATE_INTERFACE); + g_var_deprecated_interface = (const PPB_Var_Deprecated*)get_browser_interface(PPB_VAR_DEPRECATED_INTERFACE); + g_inputevent_interface = (const PPB_InputEvent*)get_browser_interface(PPB_INPUT_EVENT_INTERFACE); + g_mouseinputevent_interface = (const PPB_MouseInputEvent*)get_browser_interface(PPB_MOUSE_INPUT_EVENT_INTERFACE); + g_keyboardinputevent_interface = (const PPB_KeyboardInputEvent*)get_browser_interface(PPB_KEYBOARD_INPUT_EVENT_INTERFACE); + g_wheelinputevent_interface = (const PPB_WheelInputEvent*)get_browser_interface(PPB_WHEEL_INPUT_EVENT_INTERFACE); + g_flashclipboard_interface = (const PPB_Flash_Clipboard*)get_browser_interface(PPB_FLASH_CLIPBOARD_INTERFACE); if (!g_core_interface || !g_instance_interface || @@ -482,7 +1199,15 @@ !g_urlloader_interface || !g_urlrequestinfo_interface || !g_urlresponseinfo_interface || - !g_gles2_interface) + !g_gles2_interface || + !g_urlloadedtrusted_interface || + !g_instance_private_interface || + !g_var_deprecated_interface || + !g_inputevent_interface || + !g_mouseinputevent_interface || + !g_keyboardinputevent_interface || + !g_wheelinputevent_interface || + !g_flashclipboard_interface) { LOG(LOG_ERROR,"get_browser_interface failed:" << g_core_interface <<" " @@ -493,7 +1218,15 @@ << g_urlloader_interface<<" " << g_urlrequestinfo_interface<<" " << g_urlresponseinfo_interface<<" " - << g_gles2_interface); + << g_gles2_interface<<" " + << g_urlloadedtrusted_interface<<" " + << g_instance_private_interface<<" " + << g_var_deprecated_interface<<" " + << g_inputevent_interface<<" " + << g_mouseinputevent_interface<<" " + << g_keyboardinputevent_interface<<" " + << g_wheelinputevent_interface<<" " + << g_flashclipboard_interface); return PP_ERROR_NOINTERFACE; } return PP_OK; @@ -514,6 +1247,14 @@ { return &messaging_interface; } + if (strcmp(interface_name, PPP_INSTANCE_PRIVATE_INTERFACE) == 0) + { + return &instance_private_interface; + } + if (strcmp(interface_name, PPP_INPUT_EVENT_INTERFACE) == 0) + { + return &input_event_interface; + } return NULL; } @@ -521,6 +1262,7 @@ void ppPluginEngineData::stopMainDownload() { + LOG(LOG_NOT_IMPLEMENTED,"stopMainDownload"); // if(instance->mainDownloader) // instance->mainDownloader->stop(); } @@ -533,6 +1275,7 @@ void ppPluginEngineData::openPageInBrowser(const tiny_string& url, const tiny_string& window) { + LOG(LOG_NOT_IMPLEMENTED,"openPageInBrowser:"<<url<<" "<<window); //instance->openLink(url, window); } @@ -543,6 +1286,7 @@ void ppPluginEngineData::grabFocus() { + LOG(LOG_NOT_IMPLEMENTED,"grabFocus"); /* if (!widget_gtk) return; @@ -553,7 +1297,11 @@ void ppPluginEngineData::setClipboardText(const std::string txt) { - LOG(LOG_NOT_IMPLEMENTED,"setCLipboardText"); + uint32_t formats[1]; + formats[0] = PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT; + PP_Var data[1]; + data[0] = g_var_interface->VarFromUtf8(txt.c_str(),txt.length()); + g_flashclipboard_interface->WriteData(this->instance->getppInstance(),PP_FLASH_CLIPBOARD_TYPE_STANDARD,1,formats,data); } bool ppPluginEngineData::getScreenData(SDL_DisplayMode *screen) @@ -565,12 +1313,34 @@ double ppPluginEngineData::getScreenDPI() { LOG(LOG_NOT_IMPLEMENTED,"getScreenDPI"); - return 0; + return 96.0; } +void swapbuffer_ppPluginEngineData_callback(void* userdata,int result) +{ + ppPluginEngineData* data = (ppPluginEngineData*)userdata; + if (ACQUIRE_READ(data->inRendering)) + return; + RELEASE_WRITE(data->inRendering,true); + struct PP_CompletionCallback cb; + cb.func = swapbuffer_callback; + cb.flags = 0; + cb.user_data = userdata; + g_graphics_3d_interface->SwapBuffers(data->getGraphics(),cb); + +} void ppPluginEngineData::SwapBuffers() { - //SwapBuffers is handled in callback + if (!g_core_interface->IsMainThread()) + { + struct PP_CompletionCallback cb; + cb.func = swapbuffer_ppPluginEngineData_callback; + cb.flags = 0; + cb.user_data = this; + g_core_interface->CallOnMainThread(0,cb,0); + } + else + swapbuffer_ppPluginEngineData_callback(this,0); } void ppPluginEngineData::InitOpenGL() @@ -589,6 +1359,23 @@ return errorCode!=GL_NO_ERROR; } +uint8_t *ppPluginEngineData::getCurrentPixBuf() const +{ + return currentPixelBufPtr; +} + +uint8_t *ppPluginEngineData::switchCurrentPixBuf(uint32_t w, uint32_t h) +{ + //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; +} + void ppPluginEngineData::exec_glUniform1f(int location, float v0) { g_gles2_interface->Uniform1f(instance->m_graphics,location,v0); @@ -655,7 +1442,9 @@ void ppPluginEngineData::exec_glEnable_GL_TEXTURE_2D() { - g_gles2_interface->Enable(instance->m_graphics,GL_TEXTURE_2D); + // TODO calling this generates error in chromium: + // [.PPAPIContext]GL ERROR :GL_INVALID_ENUM : glEnable: cap was GL_TEXTURE_2D + //g_gles2_interface->Enable(instance->m_graphics,GL_TEXTURE_2D); } void ppPluginEngineData::exec_glEnable_GL_BLEND() @@ -737,9 +1526,9 @@ g_gles2_interface->DeleteTextures(instance->m_graphics,n,textures); } -void ppPluginEngineData::exec_glDeleteBuffers(int32_t n,uint32_t* buffers) +void ppPluginEngineData::exec_glDeleteBuffers() { - g_gles2_interface->DeleteBuffers(instance->m_graphics,n,buffers); + g_gles2_interface->DeleteBuffers(instance->m_graphics,2,pixelBuffers); } void ppPluginEngineData::exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA() @@ -752,9 +1541,9 @@ g_gles2_interface->ActiveTexture(instance->m_graphics,GL_TEXTURE0); } -void ppPluginEngineData::exec_glGenBuffers(int32_t n,uint32_t* buffers) +void ppPluginEngineData::exec_glGenBuffers() { - g_gles2_interface->GenBuffers(instance->m_graphics,n,buffers); + g_gles2_interface->GenBuffers(instance->m_graphics,2,pixelBuffers); } void ppPluginEngineData::exec_glUseProgram(uint32_t program) @@ -841,9 +1630,16 @@ //g_gles2_interface->PixelStorei(instance->m_graphics,GL_UNPACK_SKIP_ROWS,param); } -void ppPluginEngineData::exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels) +void ppPluginEngineData::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) { - g_gles2_interface->TexSubImage2D(instance->m_graphics,GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); + //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); + } + g_gles2_interface->TexSubImage2D(instance->m_graphics,GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_HOST, gdata); + delete[] gdata; } void ppPluginEngineData::exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data) {
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; + /** + * Size in bytes of decrypted data, which may be less than the size of the + * corresponding buffer. + */ + uint32_t data_size; + /** + * Information needed by the client to track the block to be decrypted. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedBlockInfo, 24); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_DecryptedFramePlanes</code> provides YUV plane index values for + * accessing plane offsets stored in <code>PP_DecryptedFrameInfo</code>. + */ +typedef enum { + PP_DECRYPTEDFRAMEPLANES_Y = 0, + PP_DECRYPTEDFRAMEPLANES_U = 1, + PP_DECRYPTEDFRAMEPLANES_V = 2 +} PP_DecryptedFramePlanes; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFramePlanes, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_DecryptedFrameInfo</code> contains the result of the + * decrypt and decode operation on the associated frame, information required + * to access the frame data in buffer, and tracking info. + */ +struct PP_DecryptedFrameInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted frame. + */ + PP_DecryptedFrameFormat format; + /** + * Offsets into the buffer resource for accessing video planes. + */ + int32_t plane_offsets[3]; + /** + * Stride of each plane. + */ + int32_t strides[3]; + /** + * Width of the video frame, in pixels. + */ + int32_t width; + /** + * Height of the video frame, in pixels. + */ + int32_t height; + /** + * Information needed by the client to track the decrypted frame. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedFrameInfo, 56); + +/** + * <code>PP_DecryptedSampleInfo</code> contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + /** + * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code> + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + /** + * Information needed by the client to track the decrypted samples. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedSampleInfo, 32); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_AudioCodec</code> contains audio codec type constants. + */ +typedef enum { + PP_AUDIOCODEC_UNKNOWN = 0, + PP_AUDIOCODEC_VORBIS = 1, + PP_AUDIOCODEC_AAC = 2 +} PP_AudioCodec; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioCodec, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_AudioDecoderConfig</code> contains audio decoder configuration + * information required to initialize audio decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When <code>codec</code> requires extra data for + * initialization, the data is sent as a <code>PP_Resource</code> carried + * alongside <code>PP_AudioDecoderConfig</code>. + */ +struct PP_AudioDecoderConfig { + /** + * The audio codec to initialize. + */ + PP_AudioCodec codec; + /** + * Number of audio channels. + */ + int32_t channel_count; + /** + * Size of each audio channel. + */ + int32_t bits_per_channel; + /** + * Audio sampling rate. + */ + int32_t samples_per_second; + /** + * Client-specified identifier for the associated audio decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_AudioDecoderConfig, 20); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_VideoCodec</code> contains video codec type constants. + */ +typedef enum { + PP_VIDEOCODEC_UNKNOWN = 0, + PP_VIDEOCODEC_VP8 = 1, + PP_VIDEOCODEC_H264 = 2, + PP_VIDEOCODEC_VP9 = 3 +} PP_VideoCodec; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodec, 4); + +/** + * <code>PP_VideoCodecProfile</code> contains video codec profile type + * constants required for video decoder configuration. + *. + */ +typedef enum { + PP_VIDEOCODECPROFILE_UNKNOWN = 0, + PP_VIDEOCODECPROFILE_NOT_NEEDED = 1, + PP_VIDEOCODECPROFILE_H264_BASELINE = 2, + PP_VIDEOCODECPROFILE_H264_MAIN = 3, + PP_VIDEOCODECPROFILE_H264_EXTENDED = 4, + PP_VIDEOCODECPROFILE_H264_HIGH = 5, + PP_VIDEOCODECPROFILE_H264_HIGH_10 = 6, + PP_VIDEOCODECPROFILE_H264_HIGH_422 = 7, + PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE = 8 +} PP_VideoCodecProfile; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodecProfile, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_VideoDecoderConfig</code> contains video decoder configuration + * information required to initialize video decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When <code>codec</code> requires extra data for + * initialization, the data is sent as a <code>PP_Resource</code> carried + * alongside <code>PP_VideoDecoderConfig</code>. + */ +struct PP_VideoDecoderConfig { + /** + * The video codec to initialize. + */ + PP_VideoCodec codec; + /** + * Profile to use when initializing the video codec. + */ + PP_VideoCodecProfile profile; + /** + * Output video format. + */ + PP_DecryptedFrameFormat format; + /** + * Width of decoded video frames, in pixels. + */ + int32_t width; + /** + * Height of decoded video frames, in pixels. + */ + int32_t height; + /** + * Client-specified identifier for the associated video decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoDecoderConfig, 24); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_DecryptorStreamType</code> contains stream type constants. + */ +typedef enum { + PP_DECRYPTORSTREAMTYPE_AUDIO = 0, + PP_DECRYPTORSTREAMTYPE_VIDEO = 1 +} PP_DecryptorStreamType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptorStreamType, 4); + +/** + * <code>PP_SessionType</code> contains session type constants. + */ +typedef enum { + PP_SESSIONTYPE_TEMPORARY = 0, + PP_SESSIONTYPE_PERSISTENT_LICENSE = 1, + PP_SESSIONTYPE_PERSISTENT_RELEASE = 2 +} PP_SessionType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_SessionType, 4); + +/** + * <code>PP_InitDataType</code> contains Initialization Data Type constants. + */ +typedef enum { + PP_INITDATATYPE_CENC = 0, + PP_INITDATATYPE_KEYIDS = 1, + PP_INITDATATYPE_WEBM = 2 +} PP_InitDataType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InitDataType, 4); + +/** + * <code>PP_CdmExceptionCode</code> contains exception code constants. + */ +typedef enum { + PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR = 1, + PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR = 2, + PP_CDMEXCEPTIONCODE_INVALIDACCESSERROR = 3, + PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR = 4, + PP_CDMEXCEPTIONCODE_UNKNOWNERROR = 5, + PP_CDMEXCEPTIONCODE_CLIENTERROR = 6, + PP_CDMEXCEPTIONCODE_OUTPUTERROR = 7 +} PP_CdmExceptionCode; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmExceptionCode, 4); + +/** + * <code>PP_CdmMessageType</code> contains message type constants. + */ +typedef enum { + PP_CDMMESSAGETYPE_LICENSE_REQUEST = 0, + PP_CDMMESSAGETYPE_LICENSE_RENEWAL = 1, + PP_CDMMESSAGETYPE_LICENSE_RELEASE = 2 +} PP_CdmMessageType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmMessageType, 4); + +/** + * <code>PP_CdmKeyStatus</code> contains key status constants. + */ +typedef enum { + PP_CDMKEYSTATUS_USABLE = 0, + PP_CDMKEYSTATUS_INVALID = 1, + PP_CDMKEYSTATUS_EXPIRED = 2, + PP_CDMKEYSTATUS_OUTPUTRESTRICTED = 3, + PP_CDMKEYSTATUS_OUTPUTDOWNSCALED = 4, + PP_CDMKEYSTATUS_STATUSPENDING = 5, + PP_CDMKEYSTATUS_RELEASED = 6 +} PP_CdmKeyStatus; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmKeyStatus, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_KeyInformation</code> struct contains information about a + * key used for decryption. + */ +struct PP_KeyInformation { + /** + * Key ID. + */ + uint8_t key_id[512]; + uint32_t key_id_size; + /** + * Status of this key. + */ + PP_CdmKeyStatus key_status; + /** + * Optional error code for keys that are not usable. + */ + uint32_t system_code; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_KeyInformation, 524); +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ */ +
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)( + PP_Instance instance, + PP_Resource decrypted_block, + const struct PP_DecryptedBlockInfo* decrypted_block_info); + /** + * Called after the <code>InitializeAudioDecoder()</code> or + * <code>InitializeVideoDecoder()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to report + * decoder initialization status to the browser. + * + * @param[in] success A <code>PP_Bool</code> that is set to + * <code>PP_TRUE</code> when the decoder initialization request associated + * with <code>request_id</code> was successful. + * + * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> identifying + * the decoder type for which this initialization status response was sent. + * + * @param[in] request_id The <code>request_id</code> value passed to + * <code>InitializeAudioDecoder</code> or <code>InitializeVideoDecoder</code> + * in <code>PP_AudioDecoderConfig</code> or + * <code>PP_VideoDecoderConfig</code>. + */ + void (*DecoderInitializeDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id, + PP_Bool success); + /** + * Called after the <code>DeinitializeDecoder()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to report + * decoder de-initialization completion to the browser. + * + * @param[in] decoder_type The <code>PP_DecryptorStreamType</code> passed to + * <code>DeinitializeDecoder()</code>. + * + * @param[in] request_id The <code>request_id</code> value passed to + * <code>DeinitializeDecoder()</code>. + */ + void (*DecoderDeinitializeDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Called after the <code>ResetDecoder()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to report + * decoder reset completion to the browser. + * + * @param[in] decoder_type The <code>PP_DecryptorStreamType</code> passed to + * <code>ResetDecoder()</code>. + * + * @param[in] request_id The <code>request_id</code> value passed to + * <code>ResetDecoder()</code>. + */ + void (*DecoderResetDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Called after the <code>DecryptAndDecode()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver + * a decrypted and decoded video frame to the browser for rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * + * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource that contains a video frame. + * + * @param[in] decrypted_frame_info A <code>PP_DecryptedFrameInfo</code> that + * contains the result code, tracking info, and buffer format associated with + * <code>decrypted_frame</code>. + */ + void (*DeliverFrame)( + PP_Instance instance, + PP_Resource decrypted_frame, + const struct PP_DecryptedFrameInfo* decrypted_frame_info); + /** + * Called after the <code>DecryptAndDecode()</code> method on the + * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver + * a buffer of decrypted and decoded audio samples to the browser for + * rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * + * <code>audio_frames</code> can contain multiple audio output buffers. Each + * buffer is serialized in this format: + * + * |<------------------- serialized audio buffer ------------------->| + * | int64_t timestamp | int64_t length | length bytes of audio data | + * + * For example, with three audio output buffers, |audio_frames| will look + * like this: + * + * |<---------------- audio_frames ------------------>| + * | audio buffer 0 | audio buffer 1 | audio buffer 2 | + * + * @param[in] audio_frames A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer + * of decoded audio samples. + * + * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that + * contains the tracking info and result code associated with the decrypted + * samples. + */ + void (*DeliverSamples)( + PP_Instance instance, + PP_Resource audio_frames, + const struct PP_DecryptedSampleInfo* decrypted_sample_info); +}; + +typedef struct PPB_ContentDecryptor_Private_0_14 PPB_ContentDecryptor_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ */ +
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 + * all other web content. + */ + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + /** + * Indicates that there's activity and, e.g., the screensaver shouldn't kick + * in. + */ + void (*UpdateActivity)(PP_Instance instance); + /** + * Returns the value associated with the given setting. Invalid enums will + * result in an undefined PP_Var return value. + */ + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + /** + * Allows setting breakpad crash data which will be included in plugin crash + * reports. Returns PP_FALSE if crash data could not be set. + */ + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); + /** + * Enumerates video capture devices. |video_capture| is a valid + * PPB_VideoCapture_Dev resource. Once the operation has completed + * successfully, |devices| will be set up with an array of + * PPB_DeviceRef_Dev resources. + * + * PP_OK is returned on success and different pepper error code on failure. + * The ref count of the returned |devices| has already been increased by 1 for + * the caller. + * + * NOTE: This method is a synchronous version of |EnumerateDevices| in + * PPB_VideoCapture_Dev. + */ + int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance, + PP_Resource video_capture, + struct PP_ArrayOutput devices); +}; + +typedef struct PPB_Flash_13_0 PPB_Flash; + +struct PPB_Flash_12_4 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + 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[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); +}; + +struct PPB_Flash_12_5 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + 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[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); +}; + +struct PPB_Flash_12_6 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + 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[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); + int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance, + PP_Resource video_capture, + struct PP_ArrayOutput devices); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FLASH_H_ */ +
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); + /** + * Initializes the audio decoder using codec and settings in + * <code>decoder_config</code>, and returns the result of the initialization + * request to the browser using the <code>DecoderInitializeDone( + )</code> method + * on the <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] decoder_config A <code>PP_AudioDecoderConfig</code> that + * contains audio decoder settings and a request ID. The request ID is passed + * to the <code>DecoderInitializeDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to + * associate the result with a audio decoder initialization request. + * + * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource containing codec setup data required + * by some codecs. It should be set to 0 when the codec being initialized + * does not require it. + */ + void (*InitializeAudioDecoder)( + PP_Instance instance, + const struct PP_AudioDecoderConfig* decoder_config, + PP_Resource codec_extra_data); + /** + * Initializes the video decoder using codec and settings in + * <code>decoder_config</code>, and returns the result of the initialization + * request to the browser using the <code>DecoderInitializeDone()</code> + * method on the <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] decoder_config A <code>PP_VideoDecoderConfig</code> that + * contains video decoder settings and a request ID. The request ID is passed + * to the <code>DecoderInitializeDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface to allow clients to + * associate the result with a video decoder initialization request. + * + * @param[in] codec_extra_data A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource containing codec setup data required + * by some codecs. It should be set to 0 when the codec being initialized + * does not require it. + */ + void (*InitializeVideoDecoder)( + PP_Instance instance, + const struct PP_VideoDecoderConfig* decoder_config, + PP_Resource codec_extra_data); + /** + * De-initializes the decoder for the <code>PP_DecryptorStreamType</code> + * specified by <code>decoder_type</code> and sets it to an uninitialized + * state. The decoder can be re-initialized after de-initialization completes + * by calling <code>InitializeAudioDecoder</code> or + * <code>InitializeVideoDecoder</code>. + * + * De-initialization completion is reported to the browser using the + * <code>DecoderDeinitializeDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that + * specifies the decoder to de-initialize. + * + * @param[in] request_id A request ID that allows the browser to associate a + * request to de-initialize a decoder with the corresponding call to the + * <code>DecoderDeinitializeDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface. + */ + void (*DeinitializeDecoder)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Resets the decoder for the <code>PP_DecryptorStreamType</code> specified + * by <code>decoder_type</code> to an initialized clean state. Reset + * completion is reported to the browser using the + * <code>DecoderResetDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface. This method can be + * used to signal a discontinuity in the encoded data stream, and is safe to + * call multiple times. + * + * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that + * specifies the decoder to reset. + * + * @param[in] request_id A request ID that allows the browser to associate a + * request to reset the decoder with a corresponding call to the + * <code>DecoderResetDone()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface. + */ + void (*ResetDecoder)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Decrypts encrypted_buffer, decodes it, and returns the unencrypted + * uncompressed (decoded) data to the browser via the + * <code>DeliverFrame()</code> or <code>DeliverSamples()</code> method on the + * <code>PPB_ContentDecryptor_Private</code> interface. + * + * @param[in] decoder_type A <code>PP_DecryptorStreamType</code> that + * specifies the decoder to use after <code>encrypted_buffer</code> is + * decrypted. + * + * @param[in] encrypted_buffer A <code>PP_Resource</code> corresponding to a + * <code>PPB_Buffer_Dev</code> resource that contains encrypted media data. + * + * @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 (*DecryptAndDecode)( + PP_Instance instance, + PP_DecryptorStreamType decoder_type, + PP_Resource encrypted_buffer, + const struct PP_EncryptedBlockInfo* encrypted_block_info); +}; + +typedef struct PPP_ContentDecryptor_Private_0_16 PPP_ContentDecryptor_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ */ +
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; + +struct PPP_Flash_BrowserOperations_1_0 { + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); +}; + +struct PPP_Flash_BrowserOperations_1_2 { + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); + PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path); + void (*GetPermissionSettings)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PPB_Flash_BrowserOperations_GetSettingsCallback callback, + void* user_data); + PP_Bool (*SetDefaultPermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PP_Flash_BrowserOperations_Permission permission, + PP_Bool clear_site_specific); + 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[]); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_ */ +
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 + * created with since it will be filled with the real values from the font + * that was actually selected. + * + * The PP_Var in the description should be of type Void on input. On output, + * this will contain the string and will have a reference count of 1. The + * plugin is responsible for calling Release on this var. + * + * Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var + * in the description isn't Null (to prevent leaks). + */ + PP_Bool (*Describe)(PP_Resource font, + struct PP_BrowserFont_Trusted_Description* description, + struct PP_BrowserFont_Trusted_Metrics* metrics); + /** + * Draws the text to the image buffer. + * + * The given point represents the baseline of the left edge of the font, + * regardless of whether it is left-to-right or right-to-left (in the case of + * RTL text, this will actually represent the logical end of the text). + * + * The clip is optional and may be NULL. In this case, the text will be + * clipped to the image. + * + * The image_data_is_opaque flag indicates whether subpixel antialiasing can + * be performed, if it is supported. When the image below the text is + * opaque, subpixel antialiasing is supported and you should set this to + * PP_TRUE to pick up the user's default preferences. If your plugin is + * partially transparent, then subpixel antialiasing is not possible and + * grayscale antialiasing will be used instead (assuming the user has + * antialiasing enabled at all). + */ + PP_Bool (*DrawTextAt)(PP_Resource font, + PP_Resource image_data, + const struct PP_BrowserFont_Trusted_TextRun* text, + const struct PP_Point* position, + uint32_t color, + const struct PP_Rect* clip, + PP_Bool image_data_is_opaque); + /** + * Returns the width of the given string. If the font is invalid or the var + * isn't a valid string, this will return -1. + * + * Note that this function handles complex scripts such as Arabic, combining + * accents, etc. so that adding the width of substrings won't necessarily + * produce the correct width of the entire string. + * + * Returns -1 on failure. + */ + int32_t (*MeasureText)(PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text); + /** + * Returns the character at the given pixel X position from the beginning of + * the string. This handles complex scripts such as Arabic, where characters + * may be combined or replaced depending on the context. Returns (uint32)-1 + * on failure. + * + * TODO(brettw) this function may be broken. See the CharPosRTL test. It + * seems to tell you "insertion point" rather than painting position. This + * is useful but maybe not what we intended here. + */ + uint32_t (*CharacterOffsetForPixel)( + PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text, + int32_t pixel_position); + /** + * Returns the horizontal advance to the given character if the string was + * placed at the given position. This handles complex scripts such as Arabic, + * where characters may be combined or replaced depending on context. Returns + * -1 on error. + */ + int32_t (*PixelOffsetForCharacter)( + PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text, + uint32_t char_offset); +}; + +typedef struct PPB_BrowserFont_Trusted_1_0 PPB_BrowserFont_Trusted; +/** + * @} + */ + +#endif /* PPAPI_C_TRUSTED_PPB_BROWSER_FONT_TRUSTED_H_ */ +
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
.