54 if (mCacheFileName) free(mCacheFileName); |
54 if (mCacheFileName) free(mCacheFileName); |
55 } |
55 } |
56 |
56 |
57 //------------------------------------------------------------------------- |
57 //------------------------------------------------------------------------- |
58 void |
58 void |
59 DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen, bool aIsPrivBrowsing ) |
59 DataStruct::SetData ( nsISupports* aData, uint32_t aDataLen, bool aIsPrivateData ) |
60 { |
60 { |
61 // Now, check to see if we consider the data to be "too large" |
61 // Now, check to see if we consider the data to be "too large" |
62 // as well as ensuring that private browsing mode is disabled |
62 // as well as ensuring that private browsing mode is disabled |
63 if (aDataLen > kLargeDatasetSize && !aIsPrivBrowsing) { |
63 if (aDataLen > kLargeDatasetSize && !aIsPrivateData) { |
64 // if so, cache it to disk instead of memory |
64 // if so, cache it to disk instead of memory |
65 if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) ) |
65 if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) ) |
66 return; |
66 return; |
67 else |
67 else |
68 NS_WARNING("Oh no, couldn't write data to the cache file"); |
68 NS_WARNING("Oh no, couldn't write data to the cache file"); |
400 // first check our intrinsic flavors to see if one has been registered. |
400 // first check our intrinsic flavors to see if one has been registered. |
401 uint32_t i = 0; |
401 uint32_t i = 0; |
402 for (i = 0; i < mDataArray.Length(); ++i) { |
402 for (i = 0; i < mDataArray.Length(); ++i) { |
403 DataStruct& data = mDataArray.ElementAt(i); |
403 DataStruct& data = mDataArray.ElementAt(i); |
404 if ( data.GetFlavor().Equals(aFlavor) ) { |
404 if ( data.GetFlavor().Equals(aFlavor) ) { |
405 data.SetData ( aData, aDataLen, mPrivateData); |
405 data.SetData ( aData, aDataLen, mPrivateData ); |
406 return NS_OK; |
406 return NS_OK; |
407 } |
407 } |
408 } |
408 } |
409 |
409 |
410 // if not, try using a format converter to find a flavor to put the data in |
410 // if not, try using a format converter to find a flavor to put the data in |