Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5494323d
Commit
5494323d
authored
Jan 19, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move us to HashSet to avoid the overhead of tracking the order
parent
b9716b84
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
39 additions
and
31 deletions
+39
-31
main.dart
examples/stocks/lib/main.dart
+1
-0
stock_home.dart
examples/stocks/lib/stock_home.dart
+1
-1
cassowary.dart
packages/cassowary/lib/cassowary.dart
+1
-0
solver.dart
packages/cassowary/lib/solver.dart
+6
-12
recognizer.dart
packages/flutter/lib/src/gestures/recognizer.dart
+2
-1
ink_well.dart
packages/flutter/lib/src/material/ink_well.dart
+3
-1
scheduler.dart
packages/flutter/lib/src/scheduler/scheduler.dart
+2
-1
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+6
-6
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+7
-5
mixed_viewport.dart
packages/flutter/lib/src/widgets/mixed_viewport.dart
+3
-1
routes_test.dart
packages/flutter/test/widget/routes_test.dart
+3
-1
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+2
-1
remote_listener.dart
packages/flutter_tools/lib/src/test/remote_listener.dart
+2
-1
No files found.
examples/stocks/lib/main.dart
View file @
5494323d
...
...
@@ -5,6 +5,7 @@
library
stocks
;
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:math'
as
math
;
import
'dart:ui'
as
ui
;
...
...
examples/stocks/lib/stock_home.dart
View file @
5494323d
...
...
@@ -203,7 +203,7 @@ class StockHomeState extends State<StockHome> {
stocks:
stocks
.
toList
(),
onAction:
_buyStock
,
onOpen:
(
Stock
stock
,
Key
arrowKey
)
{
Set
<
Key
>
mostValuableKeys
=
new
Set
<
Key
>();
Set
<
Key
>
mostValuableKeys
=
new
Hash
Set
<
Key
>();
mostValuableKeys
.
add
(
arrowKey
);
Navigator
.
pushNamed
(
context
,
'/stock/
${stock.symbol}
'
,
mostValuableKeys:
mostValuableKeys
);
},
...
...
packages/cassowary/lib/cassowary.dart
View file @
5494323d
...
...
@@ -5,6 +5,7 @@
/// An implementation of the Cassowary constraint solving algorithm in Dart.
library
cassowary
;
import
'dart:collection'
;
import
'dart:math'
;
part
'constraint.dart'
;
...
...
packages/cassowary/lib/solver.dart
View file @
5494323d
...
...
@@ -146,13 +146,11 @@ class Solver {
Result
removeEditVariable
(
Variable
variable
)
{
_EditInfo
info
=
_edits
[
variable
];
if
(
info
==
null
)
{
if
(
info
==
null
)
return
Result
.
unknownEditVariable
;
}
if
(
removeConstraint
(
info
.
constraint
)
!=
Result
.
success
)
{
if
(
removeConstraint
(
info
.
constraint
)
!=
Result
.
success
)
return
Result
.
internalSolverError
;
}
_edits
.
remove
(
variable
);
return
Result
.
success
;
...
...
@@ -173,7 +171,7 @@ class Solver {
}
Set
flushUpdates
()
{
Set
updates
=
new
Set
();
Set
updates
=
new
HashSet
<
dynamic
>
();
for
(
Variable
variable
in
_vars
.
keys
)
{
_Symbol
symbol
=
_vars
[
variable
];
...
...
@@ -183,10 +181,8 @@ class Solver {
if
(
variable
.
_applyUpdate
(
updatedValue
)
&&
variable
.
_owner
!=
null
)
{
dynamic
context
=
variable
.
_owner
.
context
;
if
(
context
!=
null
)
{
if
(
context
!=
null
)
updates
.
add
(
context
);
}
}
}
...
...
@@ -212,9 +208,8 @@ class Solver {
}
if
(
needsCleanup
)
{
for
(
dynamic
item
in
applied
.
reversed
)
{
for
(
dynamic
item
in
applied
.
reversed
)
undoer
(
item
);
}
}
return
result
;
...
...
@@ -223,9 +218,8 @@ class Solver {
_Symbol
_symbolForVariable
(
Variable
variable
)
{
_Symbol
symbol
=
_vars
[
variable
];
if
(
symbol
!=
null
)
{
if
(
symbol
!=
null
)
return
symbol
;
}
symbol
=
new
_Symbol
(
_SymbolType
.
external
,
tick
++);
_vars
[
variable
]
=
symbol
;
...
...
packages/flutter/lib/src/gestures/recognizer.dart
View file @
5494323d
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:ui'
show
Point
,
Offset
;
import
'arena.dart'
;
...
...
@@ -43,7 +44,7 @@ abstract class OneSequenceGestureRecognizer extends GestureRecognizer {
GestureArena
_gestureArena
;
final
List
<
GestureArenaEntry
>
_entries
=
<
GestureArenaEntry
>[];
final
Set
<
int
>
_trackedPointers
=
new
Set
<
int
>();
final
Set
<
int
>
_trackedPointers
=
new
Hash
Set
<
int
>();
void
handleEvent
(
PointerEvent
event
);
void
acceptGesture
(
int
pointer
)
{
}
...
...
packages/flutter/lib/src/material/ink_well.dart
View file @
5494323d
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -85,7 +87,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
}
// else we're probably in deactivate()
}
);
_splashes
??=
new
Set
<
InkSplash
>();
_splashes
??=
new
Hash
Set
<
InkSplash
>();
_splashes
.
add
(
splash
);
_currentSplash
=
splash
;
updateHighlight
(
true
);
...
...
packages/flutter/lib/src/scheduler/scheduler.dart
View file @
5494323d
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:developer'
;
import
'dart:ui'
as
ui
;
...
...
@@ -142,7 +143,7 @@ abstract class Scheduler extends BindingBase {
int
_nextFrameCallbackId
=
0
;
// positive
Map
<
int
,
FrameCallback
>
_transientCallbacks
=
<
int
,
FrameCallback
>{};
final
Set
<
int
>
_removedIds
=
new
Set
<
int
>();
final
Set
<
int
>
_removedIds
=
new
Hash
Set
<
int
>();
int
get
transientCallbackCount
=>
_transientCallbacks
.
length
;
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
5494323d
...
...
@@ -81,7 +81,7 @@ abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
static
final
Map
<
GlobalKey
,
Element
>
_registry
=
new
Map
<
GlobalKey
,
Element
>();
static
final
Map
<
GlobalKey
,
int
>
_debugDuplicates
=
new
Map
<
GlobalKey
,
int
>();
static
final
Map
<
GlobalKey
,
Set
<
GlobalKeyRemoveListener
>>
_removeListeners
=
new
Map
<
GlobalKey
,
Set
<
GlobalKeyRemoveListener
>>();
static
final
Set
<
GlobalKey
>
_removedKeys
=
new
Set
<
GlobalKey
>();
static
final
Set
<
GlobalKey
>
_removedKeys
=
new
Hash
Set
<
GlobalKey
>();
void
_register
(
Element
element
)
{
assert
(()
{
...
...
@@ -129,7 +129,7 @@ abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
static
void
registerRemoveListener
(
GlobalKey
key
,
GlobalKeyRemoveListener
listener
)
{
assert
(
key
!=
null
);
Set
<
GlobalKeyRemoveListener
>
listeners
=
_removeListeners
.
putIfAbsent
(
key
,
()
=>
new
Set
<
GlobalKeyRemoveListener
>());
_removeListeners
.
putIfAbsent
(
key
,
()
=>
new
Hash
Set
<
GlobalKeyRemoveListener
>());
bool
added
=
listeners
.
add
(
listener
);
assert
(
added
);
}
...
...
@@ -160,7 +160,7 @@ abstract class GlobalKey<T extends State<StatefulComponent>> extends Key {
try
{
for
(
GlobalKey
key
in
_removedKeys
)
{
if
(!
_registry
.
containsKey
(
key
)
&&
_removeListeners
.
containsKey
(
key
))
{
Set
<
GlobalKeyRemoveListener
>
localListeners
=
new
Set
<
GlobalKeyRemoveListener
>.
from
(
_removeListeners
[
key
]);
Set
<
GlobalKeyRemoveListener
>
localListeners
=
new
Hash
Set
<
GlobalKeyRemoveListener
>.
from
(
_removeListeners
[
key
]);
for
(
GlobalKeyRemoveListener
listener
in
localListeners
)
listener
(
key
);
}
...
...
@@ -524,7 +524,7 @@ enum _ElementLifecycle {
class
_InactiveElements
{
bool
_locked
=
false
;
final
Set
<
Element
>
_elements
=
new
Set
<
Element
>();
final
Set
<
Element
>
_elements
=
new
Hash
Set
<
Element
>();
void
_unmount
(
Element
element
)
{
assert
(
element
.
_debugLifecycleState
==
_ElementLifecycle
.
inactive
);
...
...
@@ -897,7 +897,7 @@ abstract class Element<T extends Widget> implements BuildContext {
ancestor
=
ancestor
.
_parent
;
if
(
ancestor
!=
null
)
{
assert
(
ancestor
is
InheritedElement
);
_dependencies
??=
new
Set
<
InheritedElement
>();
_dependencies
??=
new
Hash
Set
<
InheritedElement
>();
_dependencies
.
add
(
ancestor
);
InheritedElement
typedAncestor
=
ancestor
;
typedAncestor
.
_dependants
.
add
(
this
);
...
...
@@ -1378,7 +1378,7 @@ class ParentDataElement extends _ProxyElement<ParentDataWidget> {
class
InheritedElement
extends
_ProxyElement
<
InheritedWidget
>
{
InheritedElement
(
InheritedWidget
widget
)
:
super
(
widget
);
Set
<
Element
>
_dependants
=
new
Set
<
Element
>();
Set
<
Element
>
_dependants
=
new
Hash
Set
<
Element
>();
void
debugDeactivated
()
{
assert
(()
{
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
5494323d
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/scheduler.dart'
;
...
...
@@ -98,7 +100,7 @@ class Hero extends StatefulComponent {
final
bool
alwaysAnimate
;
static
Map
<
Object
,
HeroHandle
>
of
(
BuildContext
context
,
Set
<
Key
>
mostValuableKeys
)
{
mostValuableKeys
??=
new
Set
<
Key
>();
mostValuableKeys
??=
new
Hash
Set
<
Key
>();
assert
(!
mostValuableKeys
.
contains
(
null
));
// first we collect ALL the heroes, sorted by their tags
Map
<
Object
,
Map
<
Key
,
HeroState
>>
heroes
=
<
Object
,
Map
<
Key
,
HeroState
>>{};
...
...
@@ -177,7 +179,7 @@ class HeroState extends State<Hero> implements HeroHandle {
_HeroManifest
result
=
new
_HeroManifest
(
key:
_key
,
config:
config
,
sourceStates:
new
Set
<
HeroState
>.
from
(<
HeroState
>[
this
]),
sourceStates:
new
Hash
Set
<
HeroState
>.
from
(<
HeroState
>[
this
]),
currentRect:
startRect
,
currentTurns:
config
.
turns
.
toDouble
()
);
...
...
@@ -268,7 +270,7 @@ class _HeroQuestState implements HeroHandle {
_taken
=
true
;
Set
<
HeroState
>
states
=
sourceStates
;
if
(
targetState
!=
null
)
states
=
states
.
union
(
new
Set
<
HeroState
>.
from
(<
HeroState
>[
targetState
]));
states
=
states
.
union
(
new
Hash
Set
<
HeroState
>.
from
(<
HeroState
>[
targetState
]));
return
new
_HeroManifest
(
key:
key
,
config:
child
,
...
...
@@ -351,7 +353,7 @@ class HeroParty {
assert
(
to
==
null
||
to
.
sourceStates
.
length
==
1
);
assert
(
to
==
null
||
to
.
currentTurns
.
floor
()
==
to
.
currentTurns
);
HeroState
targetState
=
to
!=
null
?
to
.
sourceStates
.
elementAt
(
0
)
:
null
;
Set
<
HeroState
>
sourceStates
=
from
!=
null
?
from
.
sourceStates
:
new
Set
<
HeroState
>();
Set
<
HeroState
>
sourceStates
=
from
!=
null
?
from
.
sourceStates
:
new
Hash
Set
<
HeroState
>();
sourceStates
.
remove
(
targetState
);
RelativeRect
sourceRect
=
from
!=
null
?
from
.
currentRect
:
new
RelativeRect
.
fromRect
(
to
.
currentRect
.
toRect
(
animationArea
).
center
&
Size
.
zero
,
animationArea
);
...
...
@@ -489,7 +491,7 @@ class HeroController extends NavigatorObserver {
Set
<
Key
>
_getMostValuableKeys
()
{
assert
(
_from
!=
null
);
assert
(
_to
!=
null
);
Set
<
Key
>
result
=
new
Set
<
Key
>();
Set
<
Key
>
result
=
new
Hash
Set
<
Key
>();
if
(
_from
.
settings
.
mostValuableKeys
!=
null
)
result
.
addAll
(
_from
.
settings
.
mostValuableKeys
);
if
(
_to
.
settings
.
mostValuableKeys
!=
null
)
...
...
packages/flutter/lib/src/widgets/mixed_viewport.dart
View file @
5494323d
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'package:flutter/rendering.dart'
;
import
'framework.dart'
;
...
...
@@ -97,7 +99,7 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
Map
<
_ChildKey
,
Element
>
_childrenByKey
=
new
Map
<
_ChildKey
,
Element
>();
/// The child offsets that we've been told are invalid.
final
Set
<
int
>
_invalidIndices
=
new
Set
<
int
>();
final
Set
<
int
>
_invalidIndices
=
new
Hash
Set
<
int
>();
/// Returns false if any of the previously-cached offsets have been marked as
/// invalid and need to be updated.
...
...
packages/flutter/test/widget/routes_test.dart
View file @
5494323d
...
...
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:collection'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:test/test.dart'
;
final
List
<
String
>
results
=
<
String
>[];
Set
<
TestRoute
>
routes
=
new
Set
<
TestRoute
>();
Set
<
TestRoute
>
routes
=
new
Hash
Set
<
TestRoute
>();
class
TestRoute
extends
Route
<
String
>
{
TestRoute
(
this
.
name
);
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
5494323d
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:convert'
;
import
'dart:io'
;
...
...
@@ -31,7 +32,7 @@ class AnalyzeCommand extends FlutterCommand {
@override
Future
<
int
>
runInProject
()
async
{
Stopwatch
stopwatch
=
new
Stopwatch
()..
start
();
Set
<
String
>
pubSpecDirectories
=
new
Set
<
String
>();
Set
<
String
>
pubSpecDirectories
=
new
Hash
Set
<
String
>();
List
<
String
>
dartFiles
=
argResults
.
rest
.
toList
();
bool
foundAnyInCurrentDirectory
=
false
;
...
...
packages/flutter_tools/lib/src/test/remote_listener.dart
View file @
5494323d
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:convert'
;
import
'dart:io'
;
import
'dart:isolate'
;
...
...
@@ -32,7 +33,7 @@ class RemoteListener {
final
Suite
_suite
;
final
WebSocket
_socket
;
final
Set
<
LiveTest
>
_liveTests
=
new
Set
<
LiveTest
>();
final
Set
<
LiveTest
>
_liveTests
=
new
Hash
Set
<
LiveTest
>();
static
Future
start
(
String
server
,
Metadata
metadata
,
Function
getMain
())
async
{
WebSocket
socket
=
await
WebSocket
.
connect
(
server
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment