diff options
author | Armin Weatherwax | 2010-02-26 17:06:16 +0100 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:40:22 +0200 |
commit | dcdfa1ebab37dd78282bc95093a5f347f5846b1c (patch) | |
tree | 22d6ea3f35b749e51ae4ac882bd56f42d35f9590 /linden/indra/llplugin | |
parent | remove deprecated files (diff) | |
download | meta-impy-dcdfa1ebab37dd78282bc95093a5f347f5846b1c.zip meta-impy-dcdfa1ebab37dd78282bc95093a5f347f5846b1c.tar.gz meta-impy-dcdfa1ebab37dd78282bc95093a5f347f5846b1c.tar.bz2 meta-impy-dcdfa1ebab37dd78282bc95093a5f347f5846b1c.tar.xz |
port SG2.0 Mediaplugs (webkit supports flash now)
Diffstat (limited to '')
20 files changed, 178 insertions, 67 deletions
diff --git a/linden/indra/llplugin/CMakeLists.txt b/linden/indra/llplugin/CMakeLists.txt index e41cdf7..e41cdf7 100644..100755 --- a/linden/indra/llplugin/CMakeLists.txt +++ b/linden/indra/llplugin/CMakeLists.txt | |||
diff --git a/linden/indra/llplugin/llpluginclassmedia.cpp b/linden/indra/llplugin/llpluginclassmedia.cpp index a6f6f30..2e8bf3f 100644..100755 --- a/linden/indra/llplugin/llpluginclassmedia.cpp +++ b/linden/indra/llplugin/llpluginclassmedia.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginclassmedia.cpp | 2 | * @file llpluginclassmedia.cpp |
3 | * @brief LLPluginClassMedia handles a plugin which knows about the "media" message class. | 3 | * @brief LLPluginClassMedia handles a plugin which knows about the "media" message class. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
@@ -36,6 +38,8 @@ | |||
36 | #include "llpluginclassmedia.h" | 38 | #include "llpluginclassmedia.h" |
37 | #include "llpluginmessageclasses.h" | 39 | #include "llpluginmessageclasses.h" |
38 | 40 | ||
41 | #include "llqtwebkit.h" | ||
42 | |||
39 | static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256; | 43 | static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256; |
40 | 44 | ||
41 | static int nextPowerOf2( int value ) | 45 | static int nextPowerOf2( int value ) |
@@ -101,6 +105,8 @@ void LLPluginClassMedia::reset() | |||
101 | mSetMediaHeight = -1; | 105 | mSetMediaHeight = -1; |
102 | mRequestedMediaWidth = 0; | 106 | mRequestedMediaWidth = 0; |
103 | mRequestedMediaHeight = 0; | 107 | mRequestedMediaHeight = 0; |
108 | mRequestedTextureWidth = 0; | ||
109 | mRequestedTextureHeight = 0; | ||
104 | mFullMediaWidth = 0; | 110 | mFullMediaWidth = 0; |
105 | mFullMediaHeight = 0; | 111 | mFullMediaHeight = 0; |
106 | mTextureWidth = 0; | 112 | mTextureWidth = 0; |
@@ -123,7 +129,8 @@ void LLPluginClassMedia::reset() | |||
123 | mCanPaste = false; | 129 | mCanPaste = false; |
124 | mMediaName.clear(); | 130 | mMediaName.clear(); |
125 | mMediaDescription.clear(); | 131 | mMediaDescription.clear(); |
126 | 132 | mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f); | |
133 | |||
127 | // media_browser class | 134 | // media_browser class |
128 | mNavigateURI.clear(); | 135 | mNavigateURI.clear(); |
129 | mNavigateResultCode = -1; | 136 | mNavigateResultCode = -1; |
@@ -132,6 +139,9 @@ void LLPluginClassMedia::reset() | |||
132 | mHistoryForwardAvailable = false; | 139 | mHistoryForwardAvailable = false; |
133 | mStatusText.clear(); | 140 | mStatusText.clear(); |
134 | mProgressPercent = 0; | 141 | mProgressPercent = 0; |
142 | mClickURL.clear(); | ||
143 | mClickTarget.clear(); | ||
144 | mClickTargetType = TARGET_NONE; | ||
135 | 145 | ||
136 | // media_time class | 146 | // media_time class |
137 | mCurrentTime = 0.0f; | 147 | mCurrentTime = 0.0f; |
@@ -233,6 +243,10 @@ void LLPluginClassMedia::idle(void) | |||
233 | message.setValueS32("height", mRequestedMediaHeight); | 243 | message.setValueS32("height", mRequestedMediaHeight); |
234 | message.setValueS32("texture_width", mRequestedTextureWidth); | 244 | message.setValueS32("texture_width", mRequestedTextureWidth); |
235 | message.setValueS32("texture_height", mRequestedTextureHeight); | 245 | message.setValueS32("texture_height", mRequestedTextureHeight); |
246 | message.setValueReal("background_r", mBackgroundColor.mV[VX]); | ||
247 | message.setValueReal("background_g", mBackgroundColor.mV[VY]); | ||
248 | message.setValueReal("background_b", mBackgroundColor.mV[VZ]); | ||
249 | message.setValueReal("background_a", mBackgroundColor.mV[VW]); | ||
236 | mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue. | 250 | mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue. |
237 | 251 | ||
238 | LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL; | 252 | LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL; |
@@ -370,7 +384,7 @@ bool LLPluginClassMedia::textureValid(void) | |||
370 | 384 | ||
371 | bool LLPluginClassMedia::getDirty(LLRect *dirty_rect) | 385 | bool LLPluginClassMedia::getDirty(LLRect *dirty_rect) |
372 | { | 386 | { |
373 | bool result = !mDirtyRect.isNull(); | 387 | bool result = !mDirtyRect.isNull();//awfixme isEmpty(); |
374 | 388 | ||
375 | if(dirty_rect != NULL) | 389 | if(dirty_rect != NULL) |
376 | { | 390 | { |
@@ -458,7 +472,7 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int | |||
458 | sendMessage(message); | 472 | sendMessage(message); |
459 | } | 473 | } |
460 | 474 | ||
461 | bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers) | 475 | bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data) |
462 | { | 476 | { |
463 | bool result = true; | 477 | bool result = true; |
464 | 478 | ||
@@ -515,6 +529,7 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie | |||
515 | message.setValueS32("key", key_code); | 529 | message.setValueS32("key", key_code); |
516 | 530 | ||
517 | message.setValue("modifiers", translateModifiers(modifiers)); | 531 | message.setValue("modifiers", translateModifiers(modifiers)); |
532 | message.setValueLLSD("native_key_data", native_key_data); | ||
518 | 533 | ||
519 | sendMessage(message); | 534 | sendMessage(message); |
520 | } | 535 | } |
@@ -533,12 +548,13 @@ void LLPluginClassMedia::scrollEvent(int x, int y, MASK modifiers) | |||
533 | sendMessage(message); | 548 | sendMessage(message); |
534 | } | 549 | } |
535 | 550 | ||
536 | bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers) | 551 | bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD native_key_data) |
537 | { | 552 | { |
538 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event"); | 553 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event"); |
539 | 554 | ||
540 | message.setValue("text", text); | 555 | message.setValue("text", text); |
541 | message.setValue("modifiers", translateModifiers(modifiers)); | 556 | message.setValue("modifiers", translateModifiers(modifiers)); |
557 | message.setValueLLSD("native_key_data", native_key_data); | ||
542 | 558 | ||
543 | sendMessage(message); | 559 | sendMessage(message); |
544 | 560 | ||
@@ -663,6 +679,26 @@ void LLPluginClassMedia::paste() | |||
663 | sendMessage(message); | 679 | sendMessage(message); |
664 | } | 680 | } |
665 | 681 | ||
682 | LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) | ||
683 | { | ||
684 | // convert a LinkTargetType value from llqtwebkit to an ETargetType | ||
685 | // so that we don't expose the llqtwebkit header in viewer code | ||
686 | switch (target_type) | ||
687 | { | ||
688 | case LLQtWebKit::LTT_TARGET_NONE: | ||
689 | return LLPluginClassMedia::TARGET_NONE; | ||
690 | |||
691 | case LLQtWebKit::LTT_TARGET_BLANK: | ||
692 | return LLPluginClassMedia::TARGET_BLANK; | ||
693 | |||
694 | case LLQtWebKit::LTT_TARGET_EXTERNAL: | ||
695 | return LLPluginClassMedia::TARGET_EXTERNAL; | ||
696 | |||
697 | default: | ||
698 | return LLPluginClassMedia::TARGET_OTHER; | ||
699 | } | ||
700 | } | ||
701 | |||
666 | /* virtual */ | 702 | /* virtual */ |
667 | void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) | 703 | void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) |
668 | { | 704 | { |
@@ -710,7 +746,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) | |||
710 | newDirtyRect.mBottom = temp; | 746 | newDirtyRect.mBottom = temp; |
711 | } | 747 | } |
712 | 748 | ||
713 | if(mDirtyRect.isNull()) | 749 | if(mDirtyRect.isNull())//awfixme isEmpty()) |
714 | { | 750 | { |
715 | mDirtyRect = newDirtyRect; | 751 | mDirtyRect = newDirtyRect; |
716 | } | 752 | } |
@@ -915,12 +951,15 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) | |||
915 | { | 951 | { |
916 | mClickURL = message.getValue("uri"); | 952 | mClickURL = message.getValue("uri"); |
917 | mClickTarget = message.getValue("target"); | 953 | mClickTarget = message.getValue("target"); |
954 | U32 target_type = message.getValueU32("target_type"); | ||
955 | mClickTargetType = ::getTargetTypeFromLLQtWebkit(target_type); | ||
918 | mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF); | 956 | mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF); |
919 | } | 957 | } |
920 | else if(message_name == "click_nofollow") | 958 | else if(message_name == "click_nofollow") |
921 | { | 959 | { |
922 | mClickURL = message.getValue("uri"); | 960 | mClickURL = message.getValue("uri"); |
923 | mClickTarget.clear(); | 961 | mClickTarget.clear(); |
962 | mClickTargetType = TARGET_NONE; | ||
924 | mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW); | 963 | mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW); |
925 | } | 964 | } |
926 | else | 965 | else |
diff --git a/linden/indra/llplugin/llpluginclassmedia.h b/linden/indra/llplugin/llpluginclassmedia.h index c45010e..ab54348 100644..100755 --- a/linden/indra/llplugin/llpluginclassmedia.h +++ b/linden/indra/llplugin/llpluginclassmedia.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginclassmedia.h | 2 | * @file llpluginclassmedia.h |
3 | * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class. | 3 | * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINCLASSMEDIA_H | 35 | #ifndef LL_LLPLUGINCLASSMEDIA_H |
@@ -38,7 +40,7 @@ | |||
38 | #include "llrect.h" | 40 | #include "llrect.h" |
39 | #include "llpluginclassmediaowner.h" | 41 | #include "llpluginclassmediaowner.h" |
40 | #include <queue> | 42 | #include <queue> |
41 | 43 | #include "v4color.h" | |
42 | 44 | ||
43 | class LLPluginClassMedia : public LLPluginProcessParentOwner | 45 | class LLPluginClassMedia : public LLPluginProcessParentOwner |
44 | { | 46 | { |
@@ -85,6 +87,8 @@ public: | |||
85 | void setSize(int width, int height); | 87 | void setSize(int width, int height); |
86 | void setAutoScale(bool auto_scale); | 88 | void setAutoScale(bool auto_scale); |
87 | 89 | ||
90 | void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; }; | ||
91 | |||
88 | // Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent. | 92 | // Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent. |
89 | // This will initially be false, and will also be false for some time after setSize while the resize is processed. | 93 | // This will initially be false, and will also be false for some time after setSize while the resize is processed. |
90 | // Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values | 94 | // Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values |
@@ -111,12 +115,12 @@ public: | |||
111 | KEY_EVENT_REPEAT | 115 | KEY_EVENT_REPEAT |
112 | }EKeyEventType; | 116 | }EKeyEventType; |
113 | 117 | ||
114 | bool keyEvent(EKeyEventType type, int key_code, MASK modifiers); | 118 | bool keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data); |
115 | 119 | ||
116 | void scrollEvent(int x, int y, MASK modifiers); | 120 | void scrollEvent(int x, int y, MASK modifiers); |
117 | 121 | ||
118 | // Text may be unicode (utf8 encoded) | 122 | // Text may be unicode (utf8 encoded) |
119 | bool textInput(const std::string &text, MASK modifiers); | 123 | bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data); |
120 | 124 | ||
121 | void loadURI(const std::string &uri); | 125 | void loadURI(const std::string &uri); |
122 | 126 | ||
@@ -211,6 +215,17 @@ public: | |||
211 | // This is valid after MEDIA_EVENT_CLICK_LINK_HREF | 215 | // This is valid after MEDIA_EVENT_CLICK_LINK_HREF |
212 | std::string getClickTarget() const { return mClickTarget; }; | 216 | std::string getClickTarget() const { return mClickTarget; }; |
213 | 217 | ||
218 | typedef enum | ||
219 | { | ||
220 | TARGET_NONE, // empty href target string | ||
221 | TARGET_BLANK, // target to open link in user's preferred browser | ||
222 | TARGET_EXTERNAL, // target to open link in external browser | ||
223 | TARGET_OTHER // nonempty and unsupported target type | ||
224 | }ETargetType; | ||
225 | |||
226 | // This is valid after MEDIA_EVENT_CLICK_LINK_HREF | ||
227 | ETargetType getClickTargetType() const { return mClickTargetType; }; | ||
228 | |||
214 | std::string getMediaName() const { return mMediaName; }; | 229 | std::string getMediaName() const { return mMediaName; }; |
215 | std::string getMediaDescription() const { return mMediaDescription; }; | 230 | std::string getMediaDescription() const { return mMediaDescription; }; |
216 | 231 | ||
@@ -327,6 +342,8 @@ protected: | |||
327 | std::string mMediaName; | 342 | std::string mMediaName; |
328 | std::string mMediaDescription; | 343 | std::string mMediaDescription; |
329 | 344 | ||
345 | LLColor4 mBackgroundColor; | ||
346 | |||
330 | ///////////////////////////////////////// | 347 | ///////////////////////////////////////// |
331 | // media_browser class | 348 | // media_browser class |
332 | std::string mNavigateURI; | 349 | std::string mNavigateURI; |
@@ -339,6 +356,7 @@ protected: | |||
339 | std::string mLocation; | 356 | std::string mLocation; |
340 | std::string mClickURL; | 357 | std::string mClickURL; |
341 | std::string mClickTarget; | 358 | std::string mClickTarget; |
359 | ETargetType mClickTargetType; | ||
342 | 360 | ||
343 | ///////////////////////////////////////// | 361 | ///////////////////////////////////////// |
344 | // media_time class | 362 | // media_time class |
diff --git a/linden/indra/llplugin/llpluginclassmediaowner.h b/linden/indra/llplugin/llpluginclassmediaowner.h index 182eb92..239f692 100644..100755 --- a/linden/indra/llplugin/llpluginclassmediaowner.h +++ b/linden/indra/llplugin/llpluginclassmediaowner.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginclassmediaowner.h | 2 | * @file llpluginclassmediaowner.h |
3 | * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class. | 3 | * @brief LLPluginClassMedia handles interaction with a plugin which knows about the "media" message class. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINCLASSMEDIAOWNER_H | 35 | #ifndef LL_LLPLUGINCLASSMEDIAOWNER_H |
diff --git a/linden/indra/llplugin/llplugininstance.cpp b/linden/indra/llplugin/llplugininstance.cpp index 5185b36..ce10cb6 100644..100755 --- a/linden/indra/llplugin/llplugininstance.cpp +++ b/linden/indra/llplugin/llplugininstance.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llplugininstance.cpp | 2 | * @file llplugininstance.cpp |
3 | * @brief LLPluginInstance handles loading the dynamic library of a plugin and setting up its entry points for message passing. | 3 | * @brief LLPluginInstance handles loading the dynamic library of a plugin and setting up its entry points for message passing. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
diff --git a/linden/indra/llplugin/llplugininstance.h b/linden/indra/llplugin/llplugininstance.h index 0b53b5f..baa51cc 100644..100755 --- a/linden/indra/llplugin/llplugininstance.h +++ b/linden/indra/llplugin/llplugininstance.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /** | 1 | /** |
2 | * @file llplugininstance.h | 2 | * @file llplugininstance.h |
3 | * @brief LLPluginInstance handles loading the dynamic library of a plugin and setting up its entry points for message passing. | ||
4 | * | 3 | * |
4 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 7 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +28,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 29 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 30 | * $/LicenseInfo$ |
31 | * @endcond | ||
31 | */ | 32 | */ |
32 | 33 | ||
33 | #ifndef LL_LLPLUGININSTANCE_H | 34 | #ifndef LL_LLPLUGININSTANCE_H |
diff --git a/linden/indra/llplugin/llpluginmessage.cpp b/linden/indra/llplugin/llpluginmessage.cpp index 67ac995..8efc774 100644..100755 --- a/linden/indra/llplugin/llpluginmessage.cpp +++ b/linden/indra/llplugin/llpluginmessage.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginmessage.cpp | 2 | * @file llpluginmessage.cpp |
3 | * @brief LLPluginMessage encapsulates the serialization/deserialization of messages passed to and from plugins. | 3 | * @brief LLPluginMessage encapsulates the serialization/deserialization of messages passed to and from plugins. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
diff --git a/linden/indra/llplugin/llpluginmessage.h b/linden/indra/llplugin/llpluginmessage.h index 8bcb896..82eb89f 100644..100755 --- a/linden/indra/llplugin/llpluginmessage.h +++ b/linden/indra/llplugin/llpluginmessage.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /** | 1 | /** |
2 | * @file llpluginmessage.h | 2 | * @file llpluginmessage.h |
3 | * @brief LLPluginMessage encapsulates the serialization/deserialization of messages passed to and from plugins. | ||
4 | * | 3 | * |
4 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 7 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +28,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 29 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 30 | * $/LicenseInfo$ |
31 | * @endcond | ||
31 | */ | 32 | */ |
32 | 33 | ||
33 | #ifndef LL_LLPLUGINMESSAGE_H | 34 | #ifndef LL_LLPLUGINMESSAGE_H |
diff --git a/linden/indra/llplugin/llpluginmessageclasses.h b/linden/indra/llplugin/llpluginmessageclasses.h index 1f60d5e..9a39e98 100644..100755 --- a/linden/indra/llplugin/llpluginmessageclasses.h +++ b/linden/indra/llplugin/llpluginmessageclasses.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginmessageclasses.h | 2 | * @file llpluginmessageclasses.h |
3 | * @brief This file defines the versions of existing message classes for LLPluginMessage. | 3 | * @brief This file defines the versions of existing message classes for LLPluginMessage. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINMESSAGECLASSES_H | 35 | #ifndef LL_LLPLUGINMESSAGECLASSES_H |
diff --git a/linden/indra/llplugin/llpluginmessagepipe.cpp b/linden/indra/llplugin/llpluginmessagepipe.cpp index 209f49f..85ed227 100644..100755 --- a/linden/indra/llplugin/llpluginmessagepipe.cpp +++ b/linden/indra/llplugin/llpluginmessagepipe.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginmessagepipe.cpp | 2 | * @file llpluginmessagepipe.cpp |
3 | * @brief Classes that implement connections from the plugin system to pipes/pumps. | 3 | * @brief Classes that implement connections from the plugin system to pipes/pumps. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
@@ -303,7 +305,14 @@ void LLPluginMessagePipe::processInput(void) | |||
303 | while((delim = mInput.find(MESSAGE_DELIMITER, start)) != std::string::npos) | 305 | while((delim = mInput.find(MESSAGE_DELIMITER, start)) != std::string::npos) |
304 | { | 306 | { |
305 | // Let the owner process this message | 307 | // Let the owner process this message |
306 | mOwner->receiveMessageRaw(mInput.substr(start, delim - start)); | 308 | if (mOwner) |
309 | { | ||
310 | mOwner->receiveMessageRaw(mInput.substr(start, delim - start)); | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | LL_WARNS("Plugin") << "!mOwner" << LL_ENDL; | ||
315 | } | ||
307 | 316 | ||
308 | start = delim + 1; | 317 | start = delim + 1; |
309 | } | 318 | } |
diff --git a/linden/indra/llplugin/llpluginmessagepipe.h b/linden/indra/llplugin/llpluginmessagepipe.h index 9bf1781..63fd569 100644..100755 --- a/linden/indra/llplugin/llpluginmessagepipe.h +++ b/linden/indra/llplugin/llpluginmessagepipe.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginmessagepipe.h | 2 | * @file llpluginmessagepipe.h |
3 | * @brief Classes that implement connections from the plugin system to pipes/pumps. | 3 | * @brief Classes that implement connections from the plugin system to pipes/pumps. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINMESSAGEPIPE_H | 35 | #ifndef LL_LLPLUGINMESSAGEPIPE_H |
diff --git a/linden/indra/llplugin/llpluginprocesschild.cpp b/linden/indra/llplugin/llpluginprocesschild.cpp index 9b5eafc..e13376f 100644..100755 --- a/linden/indra/llplugin/llpluginprocesschild.cpp +++ b/linden/indra/llplugin/llpluginprocesschild.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginprocesschild.cpp | 2 | * @file llpluginprocesschild.cpp |
3 | * @brief LLPluginProcessChild handles the child side of the external-process plugin API. | 3 | * @brief LLPluginProcessChild handles the child side of the external-process plugin API. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
@@ -42,6 +44,7 @@ static const F32 PLUGIN_IDLE_SECONDS = 1.0f / 100.0f; // Each call to idle will | |||
42 | 44 | ||
43 | LLPluginProcessChild::LLPluginProcessChild() | 45 | LLPluginProcessChild::LLPluginProcessChild() |
44 | { | 46 | { |
47 | mState = STATE_UNINITIALIZED; | ||
45 | mInstance = NULL; | 48 | mInstance = NULL; |
46 | mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); | 49 | mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); |
47 | mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz | 50 | mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz |
@@ -53,8 +56,14 @@ LLPluginProcessChild::~LLPluginProcessChild() | |||
53 | if(mInstance != NULL) | 56 | if(mInstance != NULL) |
54 | { | 57 | { |
55 | sendMessageToPlugin(LLPluginMessage("base", "cleanup")); | 58 | sendMessageToPlugin(LLPluginMessage("base", "cleanup")); |
56 | delete mInstance; | 59 | |
57 | mInstance = NULL; | 60 | // IMPORTANT: under some (unknown) circumstances the apr_dso_unload() triggered when mInstance is deleted |
61 | // appears to fail and lock up which means that a given instance of the slplugin process never exits. | ||
62 | // This is bad, especially when users try to update their version of SL - it fails because the slplugin | ||
63 | // process as well as a bunch of plugin specific files are locked and cannot be overwritten. | ||
64 | exit( 0 ); | ||
65 | //delete mInstance; | ||
66 | //mInstance = NULL; | ||
58 | } | 67 | } |
59 | } | 68 | } |
60 | 69 | ||
@@ -270,14 +279,21 @@ bool LLPluginProcessChild::isDone(void) | |||
270 | 279 | ||
271 | void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message) | 280 | void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message) |
272 | { | 281 | { |
273 | std::string buffer = message.generate(); | 282 | if (mInstance) |
274 | 283 | { | |
275 | LL_DEBUGS("Plugin") << "Sending to plugin: " << buffer << LL_ENDL; | 284 | std::string buffer = message.generate(); |
276 | LLTimer elapsed; | 285 | |
277 | 286 | LL_DEBUGS("Plugin") << "Sending to plugin: " << buffer << LL_ENDL; | |
278 | mInstance->sendMessage(buffer); | 287 | LLTimer elapsed; |
279 | 288 | ||
280 | mCPUElapsed += elapsed.getElapsedTimeF64(); | 289 | mInstance->sendMessage(buffer); |
290 | |||
291 | mCPUElapsed += elapsed.getElapsedTimeF64(); | ||
292 | } | ||
293 | else | ||
294 | { | ||
295 | LL_WARNS("Plugin") << "mInstance == NULL" << LL_ENDL; | ||
296 | } | ||
281 | } | 297 | } |
282 | 298 | ||
283 | void LLPluginProcessChild::sendMessageToParent(const LLPluginMessage &message) | 299 | void LLPluginProcessChild::sendMessageToParent(const LLPluginMessage &message) |
@@ -352,6 +368,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message) | |||
352 | else | 368 | else |
353 | { | 369 | { |
354 | LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL; | 370 | LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL; |
371 | delete region; | ||
355 | } | 372 | } |
356 | } | 373 | } |
357 | 374 | ||
diff --git a/linden/indra/llplugin/llpluginprocesschild.h b/linden/indra/llplugin/llpluginprocesschild.h index 16a1ae8..8e9579e 100644..100755 --- a/linden/indra/llplugin/llpluginprocesschild.h +++ b/linden/indra/llplugin/llpluginprocesschild.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginprocesschild.h | 2 | * @file llpluginprocesschild.h |
3 | * @brief LLPluginProcessChild handles the child side of the external-process plugin API. | 3 | * @brief LLPluginProcessChild handles the child side of the external-process plugin API. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINPROCESSCHILD_H | 35 | #ifndef LL_LLPLUGINPROCESSCHILD_H |
@@ -88,8 +90,9 @@ private: | |||
88 | STATE_ERROR, // generic bailout state | 90 | STATE_ERROR, // generic bailout state |
89 | STATE_DONE // state machine will sit in this state after either error or normal termination. | 91 | STATE_DONE // state machine will sit in this state after either error or normal termination. |
90 | }; | 92 | }; |
91 | EState mState; | ||
92 | void setState(EState state); | 93 | void setState(EState state); |
94 | |||
95 | EState mState; | ||
93 | 96 | ||
94 | LLHost mLauncherHost; | 97 | LLHost mLauncherHost; |
95 | LLSocket::ptr_t mSocket; | 98 | LLSocket::ptr_t mSocket; |
diff --git a/linden/indra/llplugin/llpluginprocessparent.cpp b/linden/indra/llplugin/llpluginprocessparent.cpp index bd36d11..9b8ea8b 100644..100755 --- a/linden/indra/llplugin/llpluginprocessparent.cpp +++ b/linden/indra/llplugin/llpluginprocessparent.cpp | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginprocessparent.cpp | 2 | * @file llpluginprocessparent.cpp |
3 | * @brief LLPluginProcessParent handles the parent side of the external-process plugin API. | 3 | * @brief LLPluginProcessParent handles the parent side of the external-process plugin API. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
@@ -49,11 +51,13 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) | |||
49 | mOwner = owner; | 51 | mOwner = owner; |
50 | mBoundPort = 0; | 52 | mBoundPort = 0; |
51 | mState = STATE_UNINITIALIZED; | 53 | mState = STATE_UNINITIALIZED; |
54 | mSleepTime = 0.0; | ||
55 | mCPUUsage = 0.0; | ||
52 | mDisableTimeout = false; | 56 | mDisableTimeout = false; |
53 | mDebug = false; | 57 | mDebug = false; |
54 | 58 | ||
55 | mPluginLaunchTimeout = 60.0f; | 59 | mPluginLaunchTimeout = 60.0f; |
56 | mPluginLockupTimeout = 30.0f; | 60 | mPluginLockupTimeout = 15.0f; |
57 | 61 | ||
58 | // Don't start the timer here -- start it when we actually launch the plugin process. | 62 | // Don't start the timer here -- start it when we actually launch the plugin process. |
59 | mHeartbeat.stop(); | 63 | mHeartbeat.stop(); |
diff --git a/linden/indra/llplugin/llpluginprocessparent.h b/linden/indra/llplugin/llpluginprocessparent.h index 00c60b5..6dbe0c1 100644..100755 --- a/linden/indra/llplugin/llpluginprocessparent.h +++ b/linden/indra/llplugin/llpluginprocessparent.h | |||
@@ -2,9 +2,10 @@ | |||
2 | * @file llpluginprocessparent.h | 2 | * @file llpluginprocessparent.h |
3 | * @brief LLPluginProcessParent handles the parent side of the external-process plugin API. | 3 | * @brief LLPluginProcessParent handles the parent side of the external-process plugin API. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #ifndef LL_LLPLUGINPROCESSPARENT_H | 35 | #ifndef LL_LLPLUGINPROCESSPARENT_H |
diff --git a/linden/indra/llplugin/llpluginsharedmemory.cpp b/linden/indra/llplugin/llpluginsharedmemory.cpp index c946619..a475f12 100644..100755 --- a/linden/indra/llplugin/llpluginsharedmemory.cpp +++ b/linden/indra/llplugin/llpluginsharedmemory.cpp | |||
@@ -1,10 +1,11 @@ | |||
1 | /** | 1 | /** |
2 | * @file llpluginsharedmemory.cpp | 2 | * @file llpluginsharedmemory.cpp |
3 | * @brief LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API. | 3 | * LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API. |
4 | * | 4 | * |
5 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 6 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 7 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 8 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 9 | * |
9 | * Second Life Viewer Source Code | 10 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 11 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +29,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 31 | * $/LicenseInfo$ |
32 | * @endcond | ||
31 | */ | 33 | */ |
32 | 34 | ||
33 | #include "linden_common.h" | 35 | #include "linden_common.h" |
diff --git a/linden/indra/llplugin/llpluginsharedmemory.h b/linden/indra/llplugin/llpluginsharedmemory.h index 2dc550e..1d23cbe 100644..100755 --- a/linden/indra/llplugin/llpluginsharedmemory.h +++ b/linden/indra/llplugin/llpluginsharedmemory.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /** | 1 | /** |
2 | * @file llpluginsharedmemory.h | 2 | * @file llpluginsharedmemory.h |
3 | * @brief LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API. | ||
4 | * | 3 | * |
4 | * @cond | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 7 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +28,7 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 29 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 30 | * $/LicenseInfo$ |
31 | * @endcond | ||
31 | */ | 32 | */ |
32 | 33 | ||
33 | #ifndef LL_LLPLUGINSHAREDMEMORY_H | 34 | #ifndef LL_LLPLUGINSHAREDMEMORY_H |
diff --git a/linden/indra/llplugin/slplugin/CMakeLists.txt b/linden/indra/llplugin/slplugin/CMakeLists.txt index 4a7d670..4a7d670 100644..100755 --- a/linden/indra/llplugin/slplugin/CMakeLists.txt +++ b/linden/indra/llplugin/slplugin/CMakeLists.txt | |||
diff --git a/linden/indra/llplugin/slplugin/slplugin.cpp b/linden/indra/llplugin/slplugin/slplugin.cpp index fa3924b..526734a 100644..100755 --- a/linden/indra/llplugin/slplugin/slplugin.cpp +++ b/linden/indra/llplugin/slplugin/slplugin.cpp | |||
@@ -1,10 +1,12 @@ | |||
1 | /** | 1 | /** |
2 | * @file slplugin.cpp | 2 | * @file slplugin.cpp |
3 | * @brief Loader shell for plugins, intended to be launched by the plugin host application, which directly loads a plugin dynamic library. | 3 | * @brief Loader shell for plugins, intended to be launched by the plugin host application, which directly loads a plugin dynamic library. |
4 | * | 4 | * |
5 | * @cond | ||
6 | * | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 7 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 8 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 9 | * Copyright (c) 2008-2010, Linden Research, Inc. |
8 | * | 10 | * |
9 | * Second Life Viewer Source Code | 11 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 12 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -28,6 +30,8 @@ | |||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 30 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 31 | * COMPLETENESS OR PERFORMANCE. |
30 | * $/LicenseInfo$ | 32 | * $/LicenseInfo$ |
33 | * | ||
34 | * @endcond | ||
31 | */ | 35 | */ |
32 | 36 | ||
33 | 37 | ||
@@ -49,15 +53,15 @@ | |||
49 | 53 | ||
50 | /* | 54 | /* |
51 | On Mac OS, since we call WaitNextEvent, this process will show up in the dock unless we set the LSBackgroundOnly flag in the Info.plist. | 55 | On Mac OS, since we call WaitNextEvent, this process will show up in the dock unless we set the LSBackgroundOnly flag in the Info.plist. |
52 | 56 | ||
53 | Normally non-bundled binaries don't have an info.plist file, but it's possible to embed one in the binary by adding this to the linker flags: | 57 | Normally non-bundled binaries don't have an info.plist file, but it's possible to embed one in the binary by adding this to the linker flags: |
54 | 58 | ||
55 | -sectcreate __TEXT __info_plist /path/to/slplugin_info.plist | 59 | -sectcreate __TEXT __info_plist /path/to/slplugin_info.plist |
56 | 60 | ||
57 | which means adding this to the gcc flags: | 61 | which means adding this to the gcc flags: |
58 | 62 | ||
59 | -Wl,-sectcreate,__TEXT,__info_plist,/path/to/slplugin_info.plist | 63 | -Wl,-sectcreate,__TEXT,__info_plist,/path/to/slplugin_info.plist |
60 | 64 | ||
61 | */ | 65 | */ |
62 | 66 | ||
63 | #if LL_DARWIN || LL_LINUX | 67 | #if LL_DARWIN || LL_LINUX |
@@ -68,7 +72,7 @@ static void crash_handler(int sig) | |||
68 | // TODO: add our own crash reporting | 72 | // TODO: add our own crash reporting |
69 | _exit(1); | 73 | _exit(1); |
70 | } | 74 | } |
71 | #endif | 75 | #endif |
72 | 76 | ||
73 | #if LL_WINDOWS | 77 | #if LL_WINDOWS |
74 | #include <windows.h> | 78 | #include <windows.h> |
@@ -81,7 +85,7 @@ LONG WINAPI myWin32ExceptionHandler( struct _EXCEPTION_POINTERS* exception_infop | |||
81 | //std::cerr << "intercepted an unhandled exception and will exit immediately." << std::endl; | 85 | //std::cerr << "intercepted an unhandled exception and will exit immediately." << std::endl; |
82 | 86 | ||
83 | // TODO: replace exception handler before we exit? | 87 | // TODO: replace exception handler before we exit? |
84 | return EXCEPTION_EXECUTE_HANDLER; | 88 | return EXCEPTION_EXECUTE_HANDLER; |
85 | } | 89 | } |
86 | 90 | ||
87 | // Taken from : http://blog.kalmbachnet.de/?postid=75 | 91 | // Taken from : http://blog.kalmbachnet.de/?postid=75 |
@@ -153,7 +157,7 @@ bool checkExceptionHandler() | |||
153 | if (prev_filter == NULL) | 157 | if (prev_filter == NULL) |
154 | { | 158 | { |
155 | ok = FALSE; | 159 | ok = FALSE; |
156 | if (myWin32ExceptionHandler == NULL) | 160 | if (NULL == myWin32ExceptionHandler) |
157 | { | 161 | { |
158 | LL_WARNS("AppInit") << "Exception handler uninitialized." << LL_ENDL; | 162 | LL_WARNS("AppInit") << "Exception handler uninitialized." << LL_ENDL; |
159 | } | 163 | } |
@@ -167,7 +171,7 @@ bool checkExceptionHandler() | |||
167 | } | 171 | } |
168 | #endif | 172 | #endif |
169 | 173 | ||
170 | // If this application on Windows platform is a console application, a console is always | 174 | // If this application on Windows platform is a console application, a console is always |
171 | // created which is bad. Making it a Windows "application" via CMake settings but not | 175 | // created which is bad. Making it a Windows "application" via CMake settings but not |
172 | // adding any code to explicitly create windows does the right thing. | 176 | // adding any code to explicitly create windows does the right thing. |
173 | #if LL_WINDOWS | 177 | #if LL_WINDOWS |
@@ -178,7 +182,7 @@ int main(int argc, char **argv) | |||
178 | { | 182 | { |
179 | ll_init_apr(); | 183 | ll_init_apr(); |
180 | 184 | ||
181 | // Set up llerror logging | 185 | // Set up llerror logging |
182 | { | 186 | { |
183 | LLError::initForApplication("."); | 187 | LLError::initForApplication("."); |
184 | LLError::setDefaultLevel(LLError::LEVEL_INFO); | 188 | LLError::setDefaultLevel(LLError::LEVEL_INFO); |
@@ -191,14 +195,14 @@ int main(int argc, char **argv) | |||
191 | { | 195 | { |
192 | LL_ERRS("slplugin") << "usage: " << "SLPlugin" << " launcher_port" << LL_ENDL; | 196 | LL_ERRS("slplugin") << "usage: " << "SLPlugin" << " launcher_port" << LL_ENDL; |
193 | }; | 197 | }; |
194 | 198 | ||
195 | U32 port = 0; | 199 | U32 port = 0; |
196 | if(!LLStringUtil::convertToU32(lpCmdLine, port)) | 200 | if(!LLStringUtil::convertToU32(lpCmdLine, port)) |
197 | { | 201 | { |
198 | LL_ERRS("slplugin") << "port number must be numeric" << LL_ENDL; | 202 | LL_ERRS("slplugin") << "port number must be numeric" << LL_ENDL; |
199 | }; | 203 | }; |
200 | 204 | ||
201 | // Insert our exception handler into the system so this plugin doesn't | 205 | // Insert our exception handler into the system so this plugin doesn't |
202 | // display a crash message if something bad happens. The host app will | 206 | // display a crash message if something bad happens. The host app will |
203 | // see the missing heartbeat and log appropriately. | 207 | // see the missing heartbeat and log appropriately. |
204 | initExceptionHandler(); | 208 | initExceptionHandler(); |
@@ -207,7 +211,7 @@ int main(int argc, char **argv) | |||
207 | { | 211 | { |
208 | LL_ERRS("slplugin") << "usage: " << argv[0] << " launcher_port" << LL_ENDL; | 212 | LL_ERRS("slplugin") << "usage: " << argv[0] << " launcher_port" << LL_ENDL; |
209 | } | 213 | } |
210 | 214 | ||
211 | U32 port = 0; | 215 | U32 port = 0; |
212 | if(!LLStringUtil::convertToU32(argv[1], port)) | 216 | if(!LLStringUtil::convertToU32(argv[1], port)) |
213 | { | 217 | { |
@@ -228,17 +232,17 @@ int main(int argc, char **argv) | |||
228 | LLPluginProcessChild *plugin = new LLPluginProcessChild(); | 232 | LLPluginProcessChild *plugin = new LLPluginProcessChild(); |
229 | 233 | ||
230 | plugin->init(port); | 234 | plugin->init(port); |
231 | 235 | ||
232 | LLTimer timer; | 236 | LLTimer timer; |
233 | timer.start(); | 237 | timer.start(); |
234 | 238 | ||
235 | #if LL_WINDOWS | 239 | #if LL_WINDOWS |
236 | checkExceptionHandler(); | 240 | checkExceptionHandler(); |
237 | #endif | 241 | #endif |
238 | 242 | ||
239 | while(!plugin->isDone()) | 243 | while(!plugin->isDone()) |
240 | { | 244 | { |
241 | timer.reset(); | 245 | timer.reset(); |
242 | plugin->idle(); | 246 | plugin->idle(); |
243 | #if LL_DARWIN | 247 | #if LL_DARWIN |
244 | { | 248 | { |
@@ -249,7 +253,7 @@ int main(int argc, char **argv) | |||
249 | #endif | 253 | #endif |
250 | F64 elapsed = timer.getElapsedTimeF64(); | 254 | F64 elapsed = timer.getElapsedTimeF64(); |
251 | F64 remaining = plugin->getSleepTime() - elapsed; | 255 | F64 remaining = plugin->getSleepTime() - elapsed; |
252 | 256 | ||
253 | if(remaining <= 0.0f) | 257 | if(remaining <= 0.0f) |
254 | { | 258 | { |
255 | // We've already used our full allotment. | 259 | // We've already used our full allotment. |
@@ -262,26 +266,26 @@ int main(int argc, char **argv) | |||
262 | { | 266 | { |
263 | 267 | ||
264 | // LL_INFOS("slplugin") << "elapsed = " << elapsed * 1000.0f << " ms, remaining = " << remaining * 1000.0f << " ms, sleeping for " << remaining * 1000.0f << " ms" << LL_ENDL; | 268 | // LL_INFOS("slplugin") << "elapsed = " << elapsed * 1000.0f << " ms, remaining = " << remaining * 1000.0f << " ms, sleeping for " << remaining * 1000.0f << " ms" << LL_ENDL; |
265 | // timer.reset(); | 269 | // timer.reset(); |
266 | 270 | ||
267 | // This also services the network as needed. | 271 | // This also services the network as needed. |
268 | plugin->sleep(remaining); | 272 | plugin->sleep(remaining); |
269 | 273 | ||
270 | // LL_INFOS("slplugin") << "slept for "<< timer.getElapsedTimeF64() * 1000.0f << " ms" << LL_ENDL; | 274 | // LL_INFOS("slplugin") << "slept for "<< timer.getElapsedTimeF64() * 1000.0f << " ms" << LL_ENDL; |
271 | } | 275 | } |
272 | 276 | ||
273 | #if LL_WINDOWS | 277 | #if LL_WINDOWS |
274 | // More agressive checking of interfering exception handlers. | 278 | // More agressive checking of interfering exception handlers. |
275 | // Doesn't appear to be required so far - even for plugins | 279 | // Doesn't appear to be required so far - even for plugins |
276 | // that do crash with a single call to the intercept | 280 | // that do crash with a single call to the intercept |
277 | // exception handler such as QuickTime. | 281 | // exception handler such as QuickTime. |
278 | //checkExceptionHandler(); | 282 | //checkExceptionHandler(); |
279 | #endif | 283 | #endif |
280 | } | 284 | } |
281 | 285 | ||
282 | delete plugin; | 286 | delete plugin; |
283 | 287 | ||
284 | ll_cleanup_apr(); | 288 | ll_cleanup_apr(); |
285 | 289 | ||
286 | return 0; | 290 | return 0; |
287 | } | 291 | } |
diff --git a/linden/indra/llplugin/slplugin/slplugin_info.plist b/linden/indra/llplugin/slplugin/slplugin_info.plist index b1daf87..b1daf87 100644..100755 --- a/linden/indra/llplugin/slplugin/slplugin_info.plist +++ b/linden/indra/llplugin/slplugin/slplugin_info.plist | |||