本文整理汇总了C++中LLPluginMessage类的典型用法代码示例。如果您正苦于以下问题:C++ LLPluginMessage类的具体用法?C++ LLPluginMessage怎么用?C++ LLPluginMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLPluginMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMessage
// This is the viewer process (the parent process)
//
// This function is called to send a message to the plugin.
void LLPluginProcessParent::sendMessage(const LLPluginMessage &message)
{
if(message.hasValue("blocking_response"))
{
mBlocked = false;
// reset the heartbeat timer, since there will have been no heartbeats while the plugin was blocked.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
}
if (message.hasValue("gorgon"))
{
// After this message it is expected that the plugin will not send any more messages for a long time.
mBlocked = true;
}
std::string buffer = message.generate();
#if LL_DEBUG
if (message.getName() == "mouse_event")
{
LL_DEBUGS("PluginMouseEvent") << "Sending: " << buffer << LL_ENDL;
}
else
{
LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL;
}
#endif
writeMessageRaw(buffer);
// Try to send message immediately.
if(mMessagePipe)
{
mMessagePipe->pumpOutput();
}
}
示例2: receivePluginMessage
// This function is called when a new message is received from the plugin.
// We get here when calling mPluginManager->update() in the first line of
// AIFilePicker::multiplex_impl.
//
// Note that we can't call finish() or abort() directly in this function,
// as that deletes mPluginManager and we're using the plugin manager
// right now (to receive this message)!
void AIFilePicker::receivePluginMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
{
std::string message_name = message.getName();
if (message_name == "canceled")
{
LL_DEBUGS("Plugin") << "received message \"canceled\"" << LL_ENDL;
set_state(AIFilePicker_canceled);
}
else if (message_name == "done")
{
LL_DEBUGS("Plugin") << "received message \"done\"" << LL_ENDL;
LLSD filenames = message.getValueLLSD("filenames");
mFilenames.clear();
for(LLSD::array_iterator filename = filenames.beginArray(); filename != filenames.endArray(); ++filename)
{
mFilenames.push_back(*filename);
}
set_state(AIFilePicker_done);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL;
}
}
}
示例3: LL_DEBUGS
// This the viewer process (the parent process).
//
// This function is called when a message is received from a plugin.
// It parses the message and passes it on to LLPluginProcessParent::receiveMessage.
void LLPluginProcessParent::receiveMessageRaw(const std::string &message)
{
LL_DEBUGS("PluginRaw") << "Received: " << message << LL_ENDL;
LLPluginMessage parsed;
if(parsed.parse(message) != -1)
{
if(parsed.hasValue("blocking_request"))
{
mBlocked = true;
}
if(parsed.hasValue("perseus"))
{
mBlocked = false;
// reset the heartbeat timer, since there will have been no heartbeats while the plugin was blocked.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
}
if(mPolledInput)
{
// This is being called on the polling thread -- only do minimal processing/queueing.
receiveMessageEarly(parsed);
}
else
{
// This is not being called on the polling thread -- do full message processing at this time.
receiveMessage(parsed);
}
}
}
示例4: authResponse
void MediaPluginCEF::authResponse(LLPluginMessage &message)
{
mAuthOK = message.getValueBoolean("ok");
if (mAuthOK)
{
mAuthUsername = message.getValue("username");
mAuthPassword = message.getValue("password");
}
}
示例5: LL_DEBUGS
void LLPluginProcessParent::receiveMessageRaw(const std::string &message)
{
LL_DEBUGS("Plugin") << "Received: " << message << LL_ENDL;
// FIXME: should this go into a queue instead?
LLPluginMessage parsed;
if(parsed.parse(message) != -1)
{
receiveMessage(parsed);
}
}
示例6: sendMessage
void LLPluginProcessParent::sendMessage(const LLPluginMessage &message)
{
std::string buffer = message.generate();
LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL;
writeMessageRaw(buffer);
}
示例7: receiveMessageEarly
void LLPluginProcessParent::receiveMessageEarly(const LLPluginMessage &message)
{
// NOTE: this function will be called from the polling thread. It will be called with mIncomingQueueMutex _already locked_.
bool handled = false;
std::string message_class = message.getClass();
if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
// no internal messages need to be handled early.
}
else
{
// Call out to the owner and see if they to reply
// TODO: Should this only happen when blocked?
if(mOwner != NULL)
{
handled = mOwner->receivePluginMessageEarly(message);
}
}
if(!handled)
{
// any message that wasn't handled early needs to be queued.
mIncomingQueue.push(message);
}
}
示例8: receivePluginMessage
/* virtual */
void LLPluginClassBasic::receivePluginMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
{
std::string message_name = message.getName();
// This class hasn't defined any incoming messages yet.
// if (message_name == "message_name")
// {
// }
// else
{
LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL;
}
}
}
示例9: sendMessageToParent
// This is the SLPlugin process (the child process).
// This is not part of a DSO.
//
// This function is called by SLPlugin to send 'message' to the viewer (the parent process).
void LLPluginProcessChild::sendMessageToParent(const LLPluginMessage &message)
{
std::string buffer = message.generate();
LL_DEBUGS("Plugin") << "Sending to parent: " << buffer << LL_ENDL;
// Write the serialized message to the pipe.
writeMessageRaw(buffer);
}
示例10: sendMessage
void LLPluginProcessParent::sendMessage(const LLPluginMessage &message)
{
if(message.hasValue("blocking_response"))
{
mBlocked = false;
// reset the heartbeat timer, since there will have been no heartbeats while the plugin was blocked.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
}
std::string buffer = message.generate();
LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL;
writeMessageRaw(buffer);
// Try to send message immediately.
if(mMessagePipe)
{
mMessagePipe->pumpOutput();
}
}
示例11: LL_DEBUGS
void LLPluginProcessParent::receiveMessageRaw(const std::string &message)
{
LL_DEBUGS("Plugin") << "Received: " << message << LL_ENDL;
LLPluginMessage parsed;
if(LLSDParser::PARSE_FAILURE != parsed.parse(message))
{
if(parsed.hasValue("blocking_request"))
{
mBlocked = true;
}
if(mPolledInput)
{
// This is being called on the polling thread -- only do minimal processing/queueing.
receiveMessageEarly(parsed);
}
else
{
// This is not being called on the polling thread -- do full message processing at this time.
receiveMessage(parsed);
}
}
}
示例12: sendMessageToPlugin
// This is the SLPlugin process.
// This is not part of a DSO.
//
// This function is called by SLPlugin to send a message (originating from
// SLPlugin itself) to the loaded DSO. It calls LLPluginInstance::sendMessage.
void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message)
{
if (mInstance)
{
std::string buffer = message.generate();
LL_DEBUGS("Plugin") << "Sending to plugin: " << buffer << LL_ENDL;
LLTimer elapsed;
mInstance->sendMessage(buffer);
mCPUElapsed += elapsed.getElapsedTimeF64();
}
else
{
LL_WARNS("Plugin") << "mInstance == NULL" << LL_ENDL;
}
}
示例13: LL_DEBUGS
/* virtual */
void LLPluginProcessChild::receivePluginMessage(const std::string &message)
{
LL_DEBUGS("Plugin") << "Received from plugin: " << message << LL_ENDL;
if(mBlockingRequest)
{
//
LL_ERRS("Plugin") << "Can't send a message while already waiting on a blocking request -- aborting!" << LL_ENDL;
}
// Incoming message from the plugin instance
bool passMessage = true;
// FIXME: how should we handle queueing here?
// Intercept certain base messages (responses to ones sent by this class)
{
// Decode this message
LLPluginMessage parsed;
parsed.parse(message);
if(parsed.hasValue("blocking_request"))
{
mBlockingRequest = true;
}
std::string message_class = parsed.getClass();
if(message_class == "base")
{
std::string message_name = parsed.getName();
if(message_name == "init_response")
{
// The plugin has finished initializing.
setState(STATE_RUNNING);
// Don't pass this message up to the parent
passMessage = false;
LLPluginMessage new_message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin_response");
LLSD versions = parsed.getValueLLSD("versions");
new_message.setValueLLSD("versions", versions);
if(parsed.hasValue("plugin_version"))
{
std::string plugin_version = parsed.getValue("plugin_version");
new_message.setValueLLSD("plugin_version", plugin_version);
}
// Let the parent know it's loaded and initialized.
sendMessageToParent(new_message);
}
else if(message_name == "shm_remove_response")
{
// Don't pass this message up to the parent
passMessage = false;
std::string name = parsed.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// detach the shared memory region
iter->second->detach();
// and remove it from our map
mSharedMemoryRegions.erase(iter);
// Finally, send the response to the parent.
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shm_remove_response");
message.setValue("name", name);
sendMessageToParent(message);
}
else
{
LL_WARNS("Plugin") << "shm_remove_response for unknown memory segment!" << LL_ENDL;
}
}
}
else if (message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
bool flush = false;
std::string message_name = parsed.getName();
if(message_name == "shutdown")
{
// The plugin is finished.
setState(STATE_UNLOADING);
flush = true;
}
else if (message_name == "flush")
{
flush = true;
passMessage = false;
}
if (flush)
{
flushMessages();
}
}
}
//.........这里部分代码省略.........
示例14: LL_DEBUGS
/* virtual */
void LLPluginProcessChild::receivePluginMessage(const std::string &message)
{
LL_DEBUGS("Plugin") << "Received from plugin: " << message << LL_ENDL;
// Incoming message from the plugin instance
bool passMessage = true;
// FIXME: how should we handle queueing here?
// Intercept certain base messages (responses to ones sent by this class)
{
// Decode this message
LLPluginMessage parsed;
parsed.parse(message);
std::string message_class = parsed.getClass();
if(message_class == "base")
{
std::string message_name = parsed.getName();
if(message_name == "init_response")
{
// The plugin has finished initializing.
setState(STATE_RUNNING);
// Don't pass this message up to the parent
passMessage = false;
LLPluginMessage new_message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin_response");
LLSD versions = parsed.getValueLLSD("versions");
new_message.setValueLLSD("versions", versions);
if(parsed.hasValue("plugin_version"))
{
std::string plugin_version = parsed.getValue("plugin_version");
new_message.setValueLLSD("plugin_version", plugin_version);
}
// Let the parent know it's loaded and initialized.
sendMessageToParent(new_message);
}
else if(message_name == "shm_remove_response")
{
// Don't pass this message up to the parent
passMessage = false;
std::string name = parsed.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// detach the shared memory region
iter->second->detach();
// and remove it from our map
mSharedMemoryRegions.erase(iter);
// Finally, send the response to the parent.
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shm_remove_response");
message.setValue("name", name);
sendMessageToParent(message);
}
else
{
LL_WARNS("Plugin") << "shm_remove_response for unknown memory segment!" << LL_ENDL;
}
}
}
}
if(passMessage)
{
LL_DEBUGS("Plugin") << "Passing through to parent: " << message << LL_ENDL;
writeMessageRaw(message);
}
}
示例15: sendMessage
/**
* Send message to plugin loader shell.
*
* @param[in] message Message data being sent to plugin loader shell
*
*/
void MediaPluginBase::sendMessage(const LLPluginMessage &message)
{
std::string output = message.generate();
mHostSendFunction(output.c_str(), &mHostUserData);
}