Bug 387014 - While Lightning reloads remote calendars, all Thunderbird windows are unresponsive. r=philipp

This commit is contained in:
Daniel Boelzle [:dbo] 2009-05-13 20:31:41 +02:00
Родитель 62baf23cac
Коммит c37f532421
7 изменённых файлов: 39 добавлений и 16 удалений

Просмотреть файл

@ -82,6 +82,15 @@ let cal = {
}
},
/**
* Schedules execution of the passed function to the current thread's queue.
* Do this to work around re-entrancy problems w.r.t. processPendingEvent(), e.g. on chrome startup.
*/
postPone: function cal_postPone(func) {
cal.getThreadManager().currentThread.dispatch({ run: func },
Components.interfaces.nsIEventTarget.DISPATCH_NORMAL);
},
/**
* Call this function regularly to process a pending event, e.g. UI.
*/

Просмотреть файл

@ -41,7 +41,9 @@ interface calIGenericOperationListener;
interface calIOperation;
/**
* Interface for synchronously working providers, e.g. storage, memory.
* Interface for synchronously working providers on storing items,
* e.g. storage, memory. All modifying commands return after the
* modification has been performed.
*
* @note
* This interface is used in conjunction with changelog-based synchronization
@ -53,10 +55,10 @@ interface calIOperation;
* store meta data for individual overridden items, you need to store it
* along with the master item's meta data.
* Finally, keep in mind that the meta data is "calendar local" and not
* automatically transferred when storing the item on another calISyncCalendar.
* automatically transferred when storing the item on another calISyncWriteCalendar.
*/
[scriptable, uuid(cef78f0e-bdbe-4534-8546-29b3e85be148)]
interface calISyncCalendar : calICalendar {
interface calISyncWriteCalendar : calICalendar {
/**
* Adds or replaces meta data of an item.
*
@ -115,6 +117,6 @@ interface calIChangeLog : nsISupports {
* @param aDestination The calendar to sync changes into
* @param aListener The listener to notify when the operation completes.
*/
calIOperation replayChangesOn(in calISyncCalendar aDestination,
calIOperation replayChangesOn(in calISyncWriteCalendar aDestination,
in calIGenericOperationListener aListener);
};

Просмотреть файл

@ -128,7 +128,7 @@ calDavCalendar.prototype = {
// memory calendar to cache things.
this.mTargetCalendar = Components
.classes["@mozilla.org/calendar/calendar;1?type=memory"]
.createInstance(Components.interfaces.calISyncCalendar);
.createInstance(Components.interfaces.calISyncWriteCalendar);
this.mTargetCalendar.superCalendar = this;
this.mObserver = new calDavObserver(this);
@ -172,7 +172,7 @@ calDavCalendar.prototype = {
}
},
// in calISyncCalendar aDestination,
// in calISyncWriteCalendar aDestination,
// in calIGenericOperationListener aListener
replayChangesOn: function caldav_replayChangesOn(aDestination, aChangeLogListener) {
if (!this.mTargetCalendar) {

Просмотреть файл

@ -59,7 +59,7 @@ calMemoryCalendar.prototype = {
//
QueryInterface: function (aIID) {
return doQueryInterface(this, calMemoryCalendar.prototype, aIID,
[Components.interfaces.calISyncCalendar,
[Components.interfaces.calISyncWriteCalendar,
Components.interfaces.calICalendarProvider]);
},
@ -345,7 +345,14 @@ calMemoryCalendar.prototype = {
// in calIDateTime aRangeStart, in calIDateTime aRangeEnd,
// in calIOperationListener aListener );
getItems: function (aItemFilter, aCount,
aRangeStart, aRangeEnd, aListener)
aRangeStart, aRangeEnd, aListener) {
let this_ = this;
cal.postPone(function() {
this_.getItems_(aItemFilter, aCount, aRangeStart, aRangeEnd, aListener);
});
},
getItems_: function (aItemFilter, aCount,
aRangeStart, aRangeEnd, aListener)
{
if (!aListener)
return;
@ -461,7 +468,7 @@ calMemoryCalendar.prototype = {
},
//
// calISyncCalendar interface
// calISyncWriteCalendar interface
//
setMetaData: function memory_setMetaData(id, value) {
this.mMetaData.setProperty(id, value);

Просмотреть файл

@ -283,7 +283,7 @@ calStorageCalendar.prototype = {
QueryInterface: function (aIID) {
return doQueryInterface(this, calStorageCalendar.prototype, aIID,
[Components.interfaces.calICalendarProvider,
Components.interfaces.calISyncCalendar]);
Components.interfaces.calISyncWriteCalendar]);
},
//
@ -659,7 +659,14 @@ calStorageCalendar.prototype = {
// in calIDateTime aRangeStart, in calIDateTime aRangeEnd,
// in calIOperationListener aListener );
getItems: function (aItemFilter, aCount,
aRangeStart, aRangeEnd, aListener)
aRangeStart, aRangeEnd, aListener) {
let this_ = this;
cal.postPone(function() {
this_.getItems_(aItemFilter, aCount, aRangeStart, aRangeEnd, aListener);
});
},
getItems_: function (aItemFilter, aCount,
aRangeStart, aRangeEnd, aListener)
{
//var profStartTime = Date.now();
if (!aListener)
@ -2824,7 +2831,7 @@ calStorageCalendar.prototype = {
},
//
// calISyncCalendar interface
// calISyncWriteCalendar interface
//
setMetaData: function stor_setMetaData(id, value) {

Просмотреть файл

@ -38,9 +38,7 @@
#include "calICalendar.idl"
#include "calIDateTime.idl"
interface calISyncCalendar;
interface calIWcapSession;
interface calIAttendee;
/** Adds WCAP specific capabilities to calICalendar.
*/

Просмотреть файл

@ -92,7 +92,7 @@ function createTodoFromIcalString(icalString) {
function getMemoryCal() {
// create memory calendar
var cal = Cc["@mozilla.org/calendar/calendar;1?type=memory"]
.createInstance(Ci.calISyncCalendar);
.createInstance(Ci.calISyncWriteCalendar);
// remove existing items
var calendar = cal.QueryInterface(Ci.calICalendarProvider);
@ -117,7 +117,7 @@ function getStorageCal() {
// create storage calendar
var cal = Cc["@mozilla.org/calendar/calendar;1?type=storage"]
.createInstance(Ci.calISyncCalendar);
.createInstance(Ci.calISyncWriteCalendar);
cal.uri = uri;
// remove existing items