summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-31 18:13:40 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-31 18:13:40 +0000
commit5edab80091453ee38f28e2240649bf91c9e3e658 (patch)
tree5ed0b46ca44e9f93c0d64986d3b309dcbb94d3ef /o3d
parent89382b154bfcf431169b6ded5ebcd26e0ec94aea (diff)
downloadchromium_src-5edab80091453ee38f28e2240649bf91c9e3e658.zip
chromium_src-5edab80091453ee38f28e2240649bf91c9e3e658.tar.gz
chromium_src-5edab80091453ee38f28e2240649bf91c9e3e658.tar.bz2
Fix for archive request. It turns out this thing
can be called recursively. Because of that ArchiveRequest::raw_data_ would be invalid when the outer call came back. This way we mostly don't use that field. Also updated the docs so it can me marked as deprecated. Review URL: http://codereview.chromium.org/173620 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/documentation/jsdoc-toolkit-templates/class.tmpl18
-rw-r--r--o3d/documentation/jsdoc-toolkit-templates/static/stylesheet.css4
-rw-r--r--o3d/import/cross/archive_request.cc33
-rw-r--r--o3d/import/cross/archive_request.h8
-rw-r--r--o3d/plugin/idl/archive_request.idl23
-rw-r--r--o3d/plugin/idl/raw_data.idl4
6 files changed, 54 insertions, 36 deletions
diff --git a/o3d/documentation/jsdoc-toolkit-templates/class.tmpl b/o3d/documentation/jsdoc-toolkit-templates/class.tmpl
index 8a3766c..e1865f6 100644
--- a/o3d/documentation/jsdoc-toolkit-templates/class.tmpl
+++ b/o3d/documentation/jsdoc-toolkit-templates/class.tmpl
@@ -95,7 +95,11 @@ thisClass = data;
<td class="type">
<if test="method.type.length">{+linkifyTypeSpec(makeName('[Method Summary]', thisClass.alias, method.name), method.type)+}&nbsp;</if>
</td>
- <td><a class="el" href="#{+method.name+}">{+method.name+}</a>{+makeSignature(method.params)+}</td>
+ <td><a class="el" href="#{+method.name+}">{+method.name+}</a>{+makeSignature(method.params)+}
+ <if test="isDeprecated(method)">
+ <span class="deprecated">[[]**DEPRECATED**]</span>
+ </if>
+ </td>
<td>{+linkifySingleType(makeName('[Method Summary inherit]'), getParentName(method))+}</td>
</tr>
</if>
@@ -115,7 +119,11 @@ thisClass = data;
<if test="property.isStatic||!property.memberOf">&lt;Global&gt;&nbsp;</if>
{+linkifyTypeSpec(makeName('[Property Summary]', thisClass.alias, property.name), getPropertyType(property))+}
</td>
- <td><a class="el" href="#{+property.name+}">{+property.name+}</a></td>
+ <td><a class="el" href="#{+property.name+}">{+property.name+}</a>
+ <if test="isDeprecated(property)">
+ <span class="deprecated">[[]**DEPRECATED**]</span>
+ </if>
+ </td>
<td>{+linkifySingleType(makeName('[Prop Summary inherit]'), getParentName(property))+}</td>
</tr>
</for>
@@ -299,7 +307,8 @@ thisClass = data;
<dd>
<table border="0" cellspacing="2" cellpadding="0">
<for each="param" in="member.params">
- <tr><td valign="top"></td><td valign="top"><em>{+param.name+}</em></td><td>{+sanitizeForEZT(param.desc)+}</td></tr>
+ <tr><td valign="top"></td><td valign="top"><em>{+param.name+}</em></td><td>
+ {+sanitizeForEZT(param.desc)+}</td></tr>
</for>
</table>
</dd>
@@ -342,6 +351,9 @@ thisClass = data;
<table class="memname">
<tr>
<td class="memname">{+linkifyTypeSpec(makeName('[Property Detail]', thisClass.alias, property.name), getPropertyType(property))+} {+getDocName(data, property)+}
+ <if test="isDeprecated(property)">
+ <span class="deprecated">[[]**DEPRECATED**]</span>
+ </if>
{+ (property.memberOf == thisClass.alias) ? "" : ("[[]inherited from <a class=\"el\" href=\"" + getLinkToClassByAlias(property.memberOf) + "\">" + property.memberOf + "</a>]") +}
</td>
</tr>
diff --git a/o3d/documentation/jsdoc-toolkit-templates/static/stylesheet.css b/o3d/documentation/jsdoc-toolkit-templates/static/stylesheet.css
index 5202687..9ed8e38 100644
--- a/o3d/documentation/jsdoc-toolkit-templates/static/stylesheet.css
+++ b/o3d/documentation/jsdoc-toolkit-templates/static/stylesheet.css
@@ -118,7 +118,9 @@ TD.mdname1 {
font-weight: bold;
-moz-border-radius: 8px 8px 8px 8px;
}
-.memproto .deprecated {
+.memproto .deprecated,
+.memname .deprecated,
+.summary .deprecated {
color: red;
}
.paramkey {
diff --git a/o3d/import/cross/archive_request.cc b/o3d/import/cross/archive_request.cc
index c02e1a5..cab9bc9 100644
--- a/o3d/import/cross/archive_request.cc
+++ b/o3d/import/cross/archive_request.cc
@@ -50,9 +50,9 @@ O3D_DEFN_CLASS(ArchiveRequest, ObjectBase);
// NOTE: The file starts with "aaaaaaaa" in the hope that most tar.gz creation
// utilties can easily sort with this being the file first in the .tgz
// Otherwise you'll have to manually force it to be the first file.
-const char* ArchiveRequest::O3D_MARKER = "aaaaaaaa.o3d";
-const char* ArchiveRequest::O3D_MARKER_CONTENT = "o3d";
-const size_t ArchiveRequest::O3D_MARKER_CONTENT_LENGTH = 3;
+const char* const ArchiveRequest::kO3DMarker = "aaaaaaaa.o3d";
+const char* const ArchiveRequest::kO3DMarkerContent = "o3d";
+const size_t ArchiveRequest::kO3DMarkerContentLength = 3;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArchiveRequest::ArchiveRequest(ServiceLocator* service_locator,
@@ -196,34 +196,37 @@ bool ArchiveRequest::ReceiveFileData(MemoryReadStream *input_stream,
if (!is_metadata && onfileavailable()) {
// keep track of the "current" data object which the callback will use
- raw_data_ = RawData::Create(service_locator(),
- current_filename_,
- temp_buffer_,
- file_memory_stream_.GetTotalStreamLength() );
+ RawData::Ref raw_data = RawData::Create(
+ service_locator(),
+ current_filename_,
+ temp_buffer_,
+ file_memory_stream_.GetTotalStreamLength() );
// keeps them all around until the ArchiveRequest goes away
- raw_data_list_.push_back(raw_data_);
+ raw_data_list_.push_back(raw_data);
- // If it's the first file is must be the O3D_MARKER or else it's an error.
+ // If it's the first file is must be the kO3DMarker or else it's an error.
if (raw_data_list_.size() == 1) {
- if (raw_data_->uri().compare(O3D_MARKER) != 0 ||
- raw_data_->StringValue().compare(O3D_MARKER_CONTENT) != 0) {
+ if (raw_data->uri().compare(kO3DMarker) != 0 ||
+ raw_data->StringValue().compare(kO3DMarkerContent) != 0) {
set_error(String("Archive '") + uri_ +
String("' is not intended for O3D. Missing '") +
- O3D_MARKER + String("' as first file in archive."));
+ kO3DMarker + String("' as first file in archive."));
return false;
}
} else {
- onfileavailable()->Run(raw_data_);
+ raw_data_ = raw_data;
+ onfileavailable()->Run(raw_data);
+ raw_data_.Reset();
}
// If data hasn't been discarded (inside callback) then writes out to
// temp file so we can get the data back at a later time
- raw_data_.Get()->Flush();
+ raw_data.Get()->Flush();
// Remove the reference to the raw_data so we don't have undefined
// behavior after the callback.
- raw_data_.Reset();
+ raw_data.Reset();
}
}
return true;
diff --git a/o3d/import/cross/archive_request.h b/o3d/import/cross/archive_request.h
index 65158bb..980c449 100644
--- a/o3d/import/cross/archive_request.h
+++ b/o3d/import/cross/archive_request.h
@@ -70,15 +70,15 @@ class ArchiveRequest : public ObjectBase, public ArchiveCallbackClient {
// can not be used to open arbitrary .tgz files but only those files someone
// has specifically prepared for O3D. This file will not be passed to
// the onfileavailable callback.
- static const char* O3D_MARKER;
+ static const char* const kO3DMarker;
- // The contents of the O3D_MARKER file. Arguably the content should not matter
+ // The contents of the O3D marker file. Arguably the content should not matter
// but for the sake of completeness we define the content so there is no
// ambiguity.
- static const char* O3D_MARKER_CONTENT;
+ static const char* const kO3DMarkerContent;
// The size of the O3D_MARKER_CONTENT.
- static const size_t O3D_MARKER_CONTENT_LENGTH;
+ static const size_t kO3DMarkerContentLength;
public:
typedef SmartPointer<ArchiveRequest> Ref;
diff --git a/o3d/plugin/idl/archive_request.idl b/o3d/plugin/idl/archive_request.idl
index ef87f3e..36283b6 100644
--- a/o3d/plugin/idl/archive_request.idl
+++ b/o3d/plugin/idl/archive_request.idl
@@ -53,19 +53,19 @@ callback void ArchiveFileAvailableCallback(RawData rawData);
request.onreadystatechange = myReadyStateChangeCallback;
request.send();
- function myFileAvailableCallback() {
- dump("uri: " + request.data.uri + "\n");
- dump("content: " + request.data.stringValue + "\n");
+ function myFileAvailableCallback(rawData) {
+ dump("uri: " + rawData.uri + "\n");
+ dump("content: " + rawData.stringValue + "\n");
- // You can pass a RawData to various creation functions. Note: request.data
- // is only valid during an onfileavailable callback.
+ // You can pass a RawData to various creation functions. Note: rawData
+ // is only valid until you remove the request.
// Examples:
- if (request.data.uri == 'mytexture.jpg')
- pack.createTexture2d(request.data, makeMips);
- if (request.data.uri == 'myvertices.bin')
- vertexBuffer.set(request.data);
- if (request.data.uri == 'myAudio.mp3')
- audioSystem.createSound(request.data);
+ if (rawData.uri == 'mytexture.jpg')
+ pack.createTexture2d(rawData, makeMips);
+ if (rawData.uri == 'myvertices.bin')
+ vertexBuffer.set(rawData);
+ if (rawData.uri == 'myAudio.mp3')
+ audioSystem.createSound(rawData);
}
function myReadyStateChangeCallback() {
@@ -109,6 +109,7 @@ callback void ArchiveFileAvailableCallback(RawData rawData);
Note: This value is only valid inside the onfileavailable callback.
Note: This property is deprecated. It is now an argument of the
onfileavailable callback.
+ @deprecated
%]
[getter] RawData? data;
diff --git a/o3d/plugin/idl/raw_data.idl b/o3d/plugin/idl/raw_data.idl
index 8089d71..c252f46 100644
--- a/o3d/plugin/idl/raw_data.idl
+++ b/o3d/plugin/idl/raw_data.idl
@@ -38,8 +38,8 @@ namespace o3d {
\code
var request = g_pack.createArchiveRequest();
- request.onfileavailable = function() {
- var texture = g_pack.createTextureFromRawData(request.data, true);
+ request.onfileavailable = function(rawData) {
+ var texture = g_pack.createTextureFromRawData(rawData, true);
...
};