Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -1,54 +0,0 @@
2007-01-25 Miguel de Icaza <miguel@novell.com>
* DispatcherTimer.cs: Add new class.
* Dispatcher.cs (ExitAllframes): Implement.
(everywhere): Add support for hooks.
* DispatcherHooks: Implement
* DispatcherOperation.cs: Store result.
* Dispatcher.cs:
Check frame.Continue for early termination.
PokableQueue: new class used so we can move DispatcherOperation
tasks from one thread to another.
2007-01-24 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Implement reprioritization.
We now take locks instead of using a separate async queue, as
things like DispatcherOperation.Priority (reprioritization) can be
called from a separate thread without crashing.
2007-01-23 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Start with the Async methods.
2007-01-20 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Move all tasks, not only the first one from the
async queue into the proper priority queues.
Eliminate the `Task' class, it is mostly redundant, instead move
all the data into DispatcherOperation.
* DispatcherOperation.cs, DispatcherOperationStatus.cs: Add new
files.
* Dispatcher.cs: Make our class `Task' internal, so we can pass
that to DispatcherOperation.
* Dispatcher.cs: Queue will now queue
locally (if same thread) or post to the dispatcher queue if
invoked from a different thread.
2007-01-13 Miguel de Icaza <miguel@novell.com>
* Dispatcher.cs: Initially I thought this
was a stroke of genius. Looking at the actual results, it does
not seem as brilliant as I had hoped.

View File

@ -1,22 +1,22 @@
// TODO:
// DispatcherObject returned by BeginInvoke must allow:
// * Waiting until delegate is invoked.
// See: BeginInvoke documentation for details
// DispatcherObject returned by BeginInvoke must allow:
// * Waiting until delegate is invoked.
// See: BeginInvoke documentation for details
//
// Implement the "Invoke" methods, they are currently not working.
// Implement the "Invoke" methods, they are currently not working.
//
// Add support for disabling the dispatcher and resuming it.
// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
// Add support for aborting an operation (emit the hook.operationaborted too)
// Add support for disabling the dispatcher and resuming it.
// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
// Add support for aborting an operation (emit the hook.operationaborted too)
//
// Very confusing information about Shutdown: it states that shutdown is
// not over, until all events are unwinded, and also states that all events
// are aborted at that point. See 'Dispatcher.InvokeShutdown' docs,
//
// Testing reveals that
// -> InvokeShutdown() stops processing, even if events are available,
// there is no "unwinding" of events, even of higher priority events,
// they are just ignored.
// -> InvokeShutdown() stops processing, even if events are available,
// there is no "unwinding" of events, even of higher priority events,
// they are just ignored.
//
// The documentation for the Dispatcher family is poorly written, complete
// sections are cut-and-pasted that add no value and the important pieces
@ -43,9 +43,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
// Copyright (c) 2016 Quamotion (http://quamotion.mobi)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
// Frederik Carlier (frederik.carlier@quamotion.mobi)
//
using System;
using System.Collections;
@ -181,6 +183,21 @@ namespace System.Windows.Threading {
return op;
}
public DispatcherOperation InvokeAsync (Action callback)
{
return this.BeginInvoke(callback);
}
public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority)
{
return this.BeginInvoke(callback, priority);
}
public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority, CancellationToken cancellationToken)
{
return this.BeginInvoke(callback, priority);
}
public object Invoke (Delegate method, params object[] args)
{
throw new NotImplementedException ();
@ -521,32 +538,33 @@ namespace System.Windows.Threading {
public void Enqueue (object obj)
{
if (size == array.Length)
Grow ();
array[tail] = obj;
tail = (tail+1) % array.Length;
size++;
if (size == array.Length)
Grow ();
array[tail] = obj;
tail = (tail+1) % array.Length;
size++;
}
public object Dequeue ()
{
if (size < 1)
throw new InvalidOperationException ();
object result = array[head];
array [head] = null;
head = (head + 1) % array.Length;
size--;
return result;
}
{
if (size < 1)
throw new InvalidOperationException ();
object result = array[head];
array [head] = null;
head = (head + 1) % array.Length;
size--;
return result;
}
void Grow () {
int newc = array.Length * 2;
object[] new_contents = new object[newc];
array.CopyTo (new_contents, 0);
array = new_contents;
head = 0;
tail = head + size;
}
void Grow ()
{
int newc = array.Length * 2;
object[] new_contents = new object[newc];
array.CopyTo (new_contents, 0);
array = new_contents;
head = 0;
tail = head + size;
}
public int Count {
get {

View File

@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
namespace System.Windows.Threading {
@ -90,6 +91,12 @@ namespace System.Windows.Threading {
throw new NotImplementedException ();
}
public Task Task {
get {
throw new NotImplementedException();
}
}
public DispatcherOperationStatus Status {
get {
return status;