summaryrefslogtreecommitdiffstats
path: root/Python/Python-ast.c
blob: 6b1ea3cbabb8b0d5626fb8ea36e47d8d9df55c15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
/* File automatically generated by Parser/asdl_c.py. */


/*
   __version__ 0daa6ba25d9b.

   This module must be committed separately after each AST grammar change;
   The __version__ number is set to the revision number of the commit
   containing the grammar change.
*/

#include "Python.h"
#include "Python-ast.h"

static PyTypeObject AST_type;
static PyTypeObject *mod_type;
static PyObject* ast2obj_mod(void*);
static PyTypeObject *Module_type;
static char *Module_fields[]={
        "body",
};
static PyTypeObject *Interactive_type;
static char *Interactive_fields[]={
        "body",
};
static PyTypeObject *Expression_type;
static char *Expression_fields[]={
        "body",
};
static PyTypeObject *Suite_type;
static char *Suite_fields[]={
        "body",
};
static PyTypeObject *stmt_type;
static char *stmt_attributes[] = {
        "lineno",
        "col_offset",
};
static PyObject* ast2obj_stmt(void*);
static PyTypeObject *FunctionDef_type;
static char *FunctionDef_fields[]={
        "name",
        "args",
        "body",
        "decorator_list",
        "returns",
};
static PyTypeObject *ClassDef_type;
static char *ClassDef_fields[]={
        "name",
        "bases",
        "keywords",
        "starargs",
        "kwargs",
        "body",
        "decorator_list",
};
static PyTypeObject *Return_type;
static char *Return_fields[]={
        "value",
};
static PyTypeObject *Delete_type;
static char *Delete_fields[]={
        "targets",
};
static PyTypeObject *Assign_type;
static char *Assign_fields[]={
        "targets",
        "value",
};
static PyTypeObject *AugAssign_type;
static char *AugAssign_fields[]={
        "target",
        "op",
        "value",
};
static PyTypeObject *For_type;
static char *For_fields[]={
        "target",
        "iter",
        "body",
        "orelse",
};
static PyTypeObject *While_type;
static char *While_fields[]={
        "test",
        "body",
        "orelse",
};
static PyTypeObject *If_type;
static char *If_fields[]={
        "test",
        "body",
        "orelse",
};
static PyTypeObject *With_type;
static char *With_fields[]={
        "context_expr",
        "optional_vars",
        "body",
};
static PyTypeObject *Raise_type;
static char *Raise_fields[]={
        "exc",
        "cause",
};
static PyTypeObject *TryExcept_type;
static char *TryExcept_fields[]={
        "body",
        "handlers",
        "orelse",
};
static PyTypeObject *TryFinally_type;
static char *TryFinally_fields[]={
        "body",
        "finalbody",
};
static PyTypeObject *Assert_type;
static char *Assert_fields[]={
        "test",
        "msg",
};
static PyTypeObject *Import_type;
static char *Import_fields[]={
        "names",
};
static PyTypeObject *ImportFrom_type;
static char *ImportFrom_fields[]={
        "module",
        "names",
        "level",
};
static PyTypeObject *Global_type;
static char *Global_fields[]={
        "names",
};
static PyTypeObject *Nonlocal_type;
static char *Nonlocal_fields[]={
        "names",
};
static PyTypeObject *Expr_type;
static char *Expr_fields[]={
        "value",
};
static PyTypeObject *Pass_type;
static PyTypeObject *Break_type;
static PyTypeObject *Continue_type;
static PyTypeObject *expr_type;
static char *expr_attributes[] = {
        "lineno",
        "col_offset",
};
static PyObject* ast2obj_expr(void*);
static PyTypeObject *BoolOp_type;
static char *BoolOp_fields[]={
        "op",
        "values",
};
static PyTypeObject *BinOp_type;
static char *BinOp_fields[]={
        "left",
        "op",
        "right",
};
static PyTypeObject *UnaryOp_type;
static char *UnaryOp_fields[]={
        "op",
        "operand",
};
static PyTypeObject *Lambda_type;
static char *Lambda_fields[]={
        "args",
        "body",
};
static PyTypeObject *IfExp_type;
static char *IfExp_fields[]={
        "test",
        "body",
        "orelse",
};
static PyTypeObject *Dict_type;
static char *Dict_fields[]={
        "keys",
        "values",
};
static PyTypeObject *Set_type;
static char *Set_fields[]={
        "elts",
};
static PyTypeObject *ListComp_type;
static char *ListComp_fields[]={
        "elt",
        "generators",
};
static PyTypeObject *SetComp_type;
static char *SetComp_fields[]={
        "elt",
        "generators",
};
static PyTypeObject *DictComp_type;
static char *DictComp_fields[]={
        "key",
        "value",
        "generators",
};
static PyTypeObject *GeneratorExp_type;
static char *GeneratorExp_fields[]={
        "elt",
        "generators",
};
static PyTypeObject *Yield_type;
static char *Yield_fields[]={
        "value",
};
static PyTypeObject *Compare_type;
static char *Compare_fields[]={
        "left",
        "ops",
        "comparators",
};
static PyTypeObject *Call_type;
static char *Call_fields[]={
        "func",
        "args",
        "keywords",
        "starargs",
        "kwargs",
};
static PyTypeObject *Num_type;
static char *Num_fields[]={
        "n",
};
static PyTypeObject *Str_type;
static char *Str_fields[]={
        "s",
};
static PyTypeObject *Bytes_type;
static char *Bytes_fields[]={
        "s",
};
static PyTypeObject *Ellipsis_type;
static PyTypeObject *Attribute_type;
static char *Attribute_fields[]={
        "value",
        "attr",
        "ctx",
};
static PyTypeObject *Subscript_type;
static char *Subscript_fields[]={
        "value",
        "slice",
        "ctx",
};
static PyTypeObject *Starred_type;
static char *Starred_fields[]={
        "value",
        "ctx",
};
static PyTypeObject *Name_type;
static char *Name_fields[]={
        "id",
        "ctx",
};
static PyTypeObject *List_type;
static char *List_fields[]={
        "elts",
        "ctx",
};
static PyTypeObject *Tuple_type;
static char *Tuple_fields[]={
        "elts",
        "ctx",
};
static PyTypeObject *expr_context_type;
static PyObject *Load_singleton, *Store_singleton, *Del_singleton,
*AugLoad_singleton, *AugStore_singleton, *Param_singleton;
static PyObject* ast2obj_expr_context(expr_context_ty);
static PyTypeObject *Load_type;
static PyTypeObject *Store_type;
static PyTypeObject *Del_type;
static PyTypeObject *AugLoad_type;
static PyTypeObject *AugStore_type;
static PyTypeObject *Param_type;
static PyTypeObject *slice_type;
static PyObject* ast2obj_slice(void*);
static PyTypeObject *Slice_type;
static char *Slice_fields[]={
        "lower",
        "upper",
        "step",
};
static PyTypeObject *ExtSlice_type;
static char *ExtSlice_fields[]={
        "dims",
};
static PyTypeObject *Index_type;
static char *Index_fields[]={
        "value",
};
static PyTypeObject *boolop_type;
static PyObject *And_singleton, *Or_singleton;
static PyObject* ast2obj_boolop(boolop_ty);
static PyTypeObject *And_type;
static PyTypeObject *Or_type;
static PyTypeObject *operator_type;
static PyObject *Add_singleton, *Sub_singleton, *Mult_singleton,
*Div_singleton, *Mod_singleton, *Pow_singleton, *LShift_singleton,
*RShift_singleton, *BitOr_singleton, *BitXor_singleton, *BitAnd_singleton,
*FloorDiv_singleton;
static PyObject* ast2obj_operator(operator_ty);
static PyTypeObject *Add_type;
static PyTypeObject *Sub_type;
static PyTypeObject *Mult_type;
static PyTypeObject *Div_type;
static PyTypeObject *Mod_type;
static PyTypeObject *Pow_type;
static PyTypeObject *LShift_type;
static PyTypeObject *RShift_type;
static PyTypeObject *BitOr_type;
static PyTypeObject *BitXor_type;
static PyTypeObject *BitAnd_type;
static PyTypeObject *FloorDiv_type;
static PyTypeObject *unaryop_type;
static PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton,
*USub_singleton;
static PyObject* ast2obj_unaryop(unaryop_ty);
static PyTypeObject *Invert_type;
static PyTypeObject *Not_type;
static PyTypeObject *UAdd_type;
static PyTypeObject *USub_type;
static PyTypeObject *cmpop_type;
static PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton,
*Gt_singleton, *GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton,
*NotIn_singleton;
static PyObject* ast2obj_cmpop(cmpop_ty);
static PyTypeObject *Eq_type;
static PyTypeObject *NotEq_type;
static PyTypeObject *Lt_type;
static PyTypeObject *LtE_type;
static PyTypeObject *Gt_type;
static PyTypeObject *GtE_type;
static PyTypeObject *Is_type;
static PyTypeObject *IsNot_type;
static PyTypeObject *In_type;
static PyTypeObject *NotIn_type;
static PyTypeObject *comprehension_type;
static PyObject* ast2obj_comprehension(void*);
static char *comprehension_fields[]={
        "target",
        "iter",
        "ifs",
};
static PyTypeObject *excepthandler_type;
static char *excepthandler_attributes[] = {
        "lineno",
        "col_offset",
};
static PyObject* ast2obj_excepthandler(void*);
static PyTypeObject *ExceptHandler_type;
static char *ExceptHandler_fields[]={
        "type",
        "name",
        "body",
};
static PyTypeObject *arguments_type;
static PyObject* ast2obj_arguments(void*);
static char *arguments_fields[]={
        "args",
        "vararg",
        "varargannotation",
        "kwonlyargs",
        "kwarg",
        "kwargannotation",
        "defaults",
        "kw_defaults",
};
static PyTypeObject *arg_type;
static PyObject* ast2obj_arg(void*);
static char *arg_fields[]={
        "arg",
        "annotation",
};
static PyTypeObject *keyword_type;
static PyObject* ast2obj_keyword(void*);
static char *keyword_fields[]={
        "arg",
        "value",
};
static PyTypeObject *alias_type;
static PyObject* ast2obj_alias(void*);
static char *alias_fields[]={
        "name",
        "asname",
};


static int
ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
{
    Py_ssize_t i, numfields = 0;
    int res = -1;
    PyObject *key, *value, *fields;
    fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "_fields");
    if (!fields)
        PyErr_Clear();
    if (fields) {
        numfields = PySequence_Size(fields);
        if (numfields == -1)
            goto cleanup;
    }
    res = 0; /* if no error occurs, this stays 0 to the end */
    if (PyTuple_GET_SIZE(args) > 0) {
        if (numfields != PyTuple_GET_SIZE(args)) {
            PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
                         "%zd positional argument%s",
                         Py_TYPE(self)->tp_name,
                         numfields == 0 ? "" : "either 0 or ",
                         numfields, numfields == 1 ? "" : "s");
            res = -1;
            goto cleanup;
        }
        for (i = 0; i < PyTuple_GET_SIZE(args); i++) {
            /* cannot be reached when fields is NULL */
            PyObject *name = PySequence_GetItem(fields, i);
            if (!name) {
                res = -1;
                goto cleanup;
            }
            res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i));
            Py_DECREF(name);
            if (res < 0)
                goto cleanup;
        }
    }
    if (kw) {
        i = 0;  /* needed by PyDict_Next */
        while (PyDict_Next(kw, &i, &key, &value)) {
            res = PyObject_SetAttr(self, key, value);
            if (res < 0)
                goto cleanup;
        }
    }
  cleanup:
    Py_XDECREF(fields);
    return res;
}

/* Pickling support */
static PyObject *
ast_type_reduce(PyObject *self, PyObject *unused)
{
    PyObject *res;
    PyObject *dict = PyObject_GetAttrString(self, "__dict__");
    if (dict == NULL) {
        if (PyErr_ExceptionMatches(PyExc_AttributeError))
            PyErr_Clear();
        else
            return NULL;
    }
    if (dict) {
        res = Py_BuildValue("O()O", Py_TYPE(self), dict);
        Py_DECREF(dict);
        return res;
    }
    return Py_BuildValue("O()", Py_TYPE(self));
}

static PyMethodDef ast_type_methods[] = {
    {"__reduce__", ast_type_reduce, METH_NOARGS, NULL},
    {NULL}
};

static PyTypeObject AST_type = {
    PyVarObject_HEAD_INIT(&PyType_Type, 0)
    "_ast.AST",
    sizeof(PyObject),
    0,
    0,                       /* tp_dealloc */
    0,                       /* tp_print */
    0,                       /* tp_getattr */
    0,                       /* tp_setattr */
    0,                       /* tp_reserved */
    0,                       /* tp_repr */
    0,                       /* tp_as_number */
    0,                       /* tp_as_sequence */
    0,                       /* tp_as_mapping */
    0,                       /* tp_hash */
    0,                       /* tp_call */
    0,                       /* tp_str */
    PyObject_GenericGetAttr, /* tp_getattro */
    PyObject_GenericSetAttr, /* tp_setattro */
    0,                       /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
    0,                       /* tp_doc */
    0,                       /* tp_traverse */
    0,                       /* tp_clear */
    0,                       /* tp_richcompare */
    0,                       /* tp_weaklistoffset */
    0,                       /* tp_iter */
    0,                       /* tp_iternext */
    ast_type_methods,        /* tp_methods */
    0,                       /* tp_members */
    0,                       /* tp_getset */
    0,                       /* tp_base */
    0,                       /* tp_dict */
    0,                       /* tp_descr_get */
    0,                       /* tp_descr_set */
    0,                       /* tp_dictoffset */
    (initproc)ast_type_init, /* tp_init */
    PyType_GenericAlloc,     /* tp_alloc */
    PyType_GenericNew,       /* tp_new */
    PyObject_Del,            /* tp_free */
};


static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)
{
    PyObject *fnames, *result;
    int i;
    fnames = PyTuple_New(num_fields);
    if (!fnames) return NULL;
    for (i = 0; i < num_fields; i++) {
        PyObject *field = PyUnicode_FromString(fields[i]);
        if (!field) {
            Py_DECREF(fnames);
            return NULL;
        }
        PyTuple_SET_ITEM(fnames, i, field);
    }
    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
                    type, base, "_fields", fnames, "__module__", "_ast");
    Py_DECREF(fnames);
    return (PyTypeObject*)result;
}

static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
{
    int i, result;
    PyObject *s, *l = PyTuple_New(num_fields);
    if (!l)
        return 0;
    for (i = 0; i < num_fields; i++) {
        s = PyUnicode_FromString(attrs[i]);
        if (!s) {
            Py_DECREF(l);
            return 0;
        }
        PyTuple_SET_ITEM(l, i, s);
    }
    result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0;
    Py_DECREF(l);
    return result;
}

/* Conversion AST -> Python */

static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
{
    int i, n = asdl_seq_LEN(seq);
    PyObject *result = PyList_New(n);
    PyObject *value;
    if (!result)
        return NULL;
    for (i = 0; i < n; i++) {
        value = func(asdl_seq_GET(seq, i));
        if (!value) {
            Py_DECREF(result);
            return NULL;
        }
        PyList_SET_ITEM(result, i, value);
    }
    return result;
}

static PyObject* ast2obj_object(void *o)
{
    if (!o)
        o = Py_None;
    Py_INCREF((PyObject*)o);
    return (PyObject*)o;
}
#define ast2obj_identifier ast2obj_object
#define ast2obj_string ast2obj_object

static PyObject* ast2obj_int(long b)
{
    return PyLong_FromLong(b);
}

/* Conversion Python -> AST */

static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
{
    if (obj == Py_None)
        obj = NULL;
    if (obj)
        PyArena_AddPyObject(arena, obj);
    Py_XINCREF(obj);
    *out = obj;
    return 0;
}

#define obj2ast_identifier obj2ast_object
#define obj2ast_string obj2ast_object

static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
{
    int i;
    if (!PyLong_Check(obj)) {
        PyObject *s = PyObject_Repr(obj);
        if (s == NULL) return 1;
        PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
                     PyBytes_AS_STRING(s));
        Py_DECREF(s);
        return 1;
    }

    i = (int)PyLong_AsLong(obj);
    if (i == -1 && PyErr_Occurred())
        return 1;
    *out = i;
    return 0;
}

static int add_ast_fields(void)
{
    PyObject *empty_tuple, *d;
    if (PyType_Ready(&AST_type) < 0)
        return -1;
    d = AST_type.tp_dict;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple ||
        PyDict_SetItemString(d, "_fields", empty_tuple) < 0 ||
        PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) {
        Py_XDECREF(empty_tuple);
        return -1;
    }
    Py_DECREF(empty_tuple);
    return 0;
}


static int init_types(void)
{
        static int initialized;
        if (initialized) return 1;
        if (add_ast_fields() < 0) return 0;
        mod_type = make_type("mod", &AST_type, NULL, 0);
        if (!mod_type) return 0;
        if (!add_attributes(mod_type, NULL, 0)) return 0;
        Module_type = make_type("Module", mod_type, Module_fields, 1);
        if (!Module_type) return 0;
        Interactive_type = make_type("Interactive", mod_type,
                                     Interactive_fields, 1);
        if (!Interactive_type) return 0;
        Expression_type = make_type("Expression", mod_type, Expression_fields,
                                    1);
        if (!Expression_type) return 0;
        Suite_type = make_type("Suite", mod_type, Suite_fields, 1);
        if (!Suite_type) return 0;
        stmt_type = make_type("stmt", &AST_type, NULL, 0);
        if (!stmt_type) return 0;
        if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0;
        FunctionDef_type = make_type("FunctionDef", stmt_type,
                                     FunctionDef_fields, 5);
        if (!FunctionDef_type) return 0;
        ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 7);
        if (!ClassDef_type) return 0;
        Return_type = make_type("Return", stmt_type, Return_fields, 1);
        if (!Return_type) return 0;
        Delete_type = make_type("Delete", stmt_type, Delete_fields, 1);
        if (!Delete_type) return 0;
        Assign_type = make_type("Assign", stmt_type, Assign_fields, 2);
        if (!Assign_type) return 0;
        AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3);
        if (!AugAssign_type) return 0;
        For_type = make_type("For", stmt_type, For_fields, 4);
        if (!For_type) return 0;
        While_type = make_type("While", stmt_type, While_fields, 3);
        if (!While_type) return 0;
        If_type = make_type("If", stmt_type, If_fields, 3);
        if (!If_type) return 0;
        With_type = make_type("With", stmt_type, With_fields, 3);
        if (!With_type) return 0;
        Raise_type = make_type("Raise", stmt_type, Raise_fields, 2);
        if (!Raise_type) return 0;
        TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3);
        if (!TryExcept_type) return 0;
        TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields,
                                    2);
        if (!TryFinally_type) return 0;
        Assert_type = make_type("Assert", stmt_type, Assert_fields, 2);
        if (!Assert_type) return 0;
        Import_type = make_type("Import", stmt_type, Import_fields, 1);
        if (!Import_type) return 0;
        ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields,
                                    3);
        if (!ImportFrom_type) return 0;
        Global_type = make_type("Global", stmt_type, Global_fields, 1);
        if (!Global_type) return 0;
        Nonlocal_type = make_type("Nonlocal", stmt_type, Nonlocal_fields, 1);
        if (!Nonlocal_type) return 0;
        Expr_type = make_type("Expr", stmt_type, Expr_fields, 1);
        if (!Expr_type) return 0;
        Pass_type = make_type("Pass", stmt_type, NULL, 0);
        if (!Pass_type) return 0;
        Break_type = make_type("Break", stmt_type, NULL, 0);
        if (!Break_type) return 0;
        Continue_type = make_type("Continue", stmt_type, NULL, 0);
        if (!Continue_type) return 0;
        expr_type = make_type("expr", &AST_type, NULL, 0);
        if (!expr_type) return 0;
        if (!add_attributes(expr_type, expr_attributes, 2)) return 0;
        BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2);
        if (!BoolOp_type) return 0;
        BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3);
        if (!BinOp_type) return 0;
        UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2);
        if (!UnaryOp_type) return 0;
        Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2);
        if (!Lambda_type) return 0;
        IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3);
        if (!IfExp_type) return 0;
        Dict_type = make_type("Dict", expr_type, Dict_fields, 2);
        if (!Dict_type) return 0;
        Set_type = make_type("Set", expr_type, Set_fields, 1);
        if (!Set_type) return 0;
        ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2);
        if (!ListComp_type) return 0;
        SetComp_type = make_type("SetComp", expr_type, SetComp_fields, 2);
        if (!SetComp_type) return 0;
        DictComp_type = make_type("DictComp", expr_type, DictComp_fields, 3);
        if (!DictComp_type) return 0;
        GeneratorExp_type = make_type("GeneratorExp", expr_type,
                                      GeneratorExp_fields, 2);
        if (!GeneratorExp_type) return 0;
        Yield_type = make_type("Yield", expr_type, Yield_fields, 1);
        if (!Yield_type) return 0;
        Compare_type = make_type("Compare", expr_type, Compare_fields, 3);
        if (!Compare_type) return 0;
        Call_type = make_type("Call", expr_type, Call_fields, 5);
        if (!Call_type) return 0;
        Num_type = make_type("Num", expr_type, Num_fields, 1);
        if (!Num_type) return 0;
        Str_type = make_type("Str", expr_type, Str_fields, 1);
        if (!Str_type) return 0;
        Bytes_type = make_type("Bytes", expr_type, Bytes_fields, 1);
        if (!Bytes_type) return 0;
        Ellipsis_type = make_type("Ellipsis", expr_type, NULL, 0);
        if (!Ellipsis_type) return 0;
        Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3);
        if (!Attribute_type) return 0;
        Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3);
        if (!Subscript_type) return 0;
        Starred_type = make_type("Starred", expr_type, Starred_fields, 2);
        if (!Starred_type) return 0;
        Name_type = make_type("Name", expr_type, Name_fields, 2);
        if (!Name_type) return 0;
        List_type = make_type("List", expr_type, List_fields, 2);
        if (!List_type) return 0;
        Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2);
        if (!Tuple_type) return 0;
        expr_context_type = make_type("expr_context", &AST_type, NULL, 0);
        if (!expr_context_type) return 0;
        if (!add_attributes(expr_context_type, NULL, 0)) return 0;
        Load_type = make_type("Load", expr_context_type, NULL, 0);
        if (!Load_type) return 0;
        Load_singleton = PyType_GenericNew(Load_type, NULL, NULL);
        if (!Load_singleton) return 0;
        Store_type = make_type("Store", expr_context_type, NULL, 0);
        if (!Store_type) return 0;
        Store_singleton = PyType_GenericNew(Store_type, NULL, NULL);
        if (!Store_singleton) return 0;
        Del_type = make_type("Del", expr_context_type, NULL, 0);
        if (!Del_type) return 0;
        Del_singleton = PyType_GenericNew(Del_type, NULL, NULL);
        if (!Del_singleton) return 0;
        AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0);
        if (!AugLoad_type) return 0;
        AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL);
        if (!AugLoad_singleton) return 0;
        AugStore_type = make_type("AugStore", expr_context_type, NULL, 0);
        if (!AugStore_type) return 0;
        AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL);
        if (!AugStore_singleton) return 0;
        Param_type = make_type("Param", expr_context_type, NULL, 0);
        if (!Param_type) return 0;
        Param_singleton = PyType_GenericNew(Param_type, NULL, NULL);
        if (!Param_singleton) return 0;
        slice_type = make_type("slice", &AST_type, NULL, 0);
        if (!slice_type) return 0;
        if (!add_attributes(slice_type, NULL, 0)) return 0;
        Slice_type = make_type("Slice", slice_type, Slice_fields, 3);
        if (!Slice_type) return 0;
        ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1);
        if (!ExtSlice_type) return 0;
        Index_type = make_type("Index", slice_type, Index_fields, 1);
        if (!Index_type) return 0;
        boolop_type = make_type("boolop", &AST_type, NULL, 0);
        if (!boolop_type) return 0;
        if (!add_attributes(boolop_type, NULL, 0)) return 0;
        And_type = make_type("And", boolop_type, NULL, 0);
        if (!And_type) return 0;
        And_singleton = PyType_GenericNew(And_type, NULL, NULL);
        if (!And_singleton) return 0;
        Or_type = make_type("Or", boolop_type, NULL, 0);
        if (!Or_type) return 0;
        Or_singleton = PyType_GenericNew(Or_type, NULL, NULL);
        if (!Or_singleton) return 0;
        operator_type = make_type("operator", &AST_type, NULL, 0);
        if (!operator_type) return 0;
        if (!add_attributes(operator_type, NULL, 0)) return 0;
        Add_type = make_type("Add", operator_type, NULL, 0);
        if (!Add_type) return 0;
        Add_singleton = PyType_GenericNew(Add_type, NULL, NULL);
        if (!Add_singleton) return 0;
        Sub_type = make_type("Sub", operator_type, NULL, 0);
        if (!Sub_type) return 0;
        Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL);
        if (!Sub_singleton) return 0;
        Mult_type = make_type("Mult", operator_type, NULL, 0);
        if (!Mult_type) return 0;
        Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL);
        if (!Mult_singleton) return 0;
        Div_type = make_type("Div", operator_type, NULL, 0);
        if (!Div_type) return 0;
        Div_singleton = PyType_GenericNew(Div_type, NULL, NULL);
        if (!Div_singleton) return 0;
        Mod_type = make_type("Mod", operator_type, NULL, 0);
        if (!Mod_type) return 0;
        Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL);
        if (!Mod_singleton) return 0;
        Pow_type = make_type("Pow", operator_type, NULL, 0);
        if (!Pow_type) return 0;
        Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL);
        if (!Pow_singleton) return 0;
        LShift_type = make_type("LShift", operator_type, NULL, 0);
        if (!LShift_type) return 0;
        LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL);
        if (!LShift_singleton) return 0;
        RShift_type = make_type("RShift", operator_type, NULL, 0);
        if (!RShift_type) return 0;
        RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL);
        if (!RShift_singleton) return 0;
        BitOr_type = make_type("BitOr", operator_type, NULL, 0);
        if (!BitOr_type) return 0;
        BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL);
        if (!BitOr_singleton) return 0;
        BitXor_type = make_type("BitXor", operator_type, NULL, 0);
        if (!BitXor_type) return 0;
        BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL);
        if (!BitXor_singleton) return 0;
        BitAnd_type = make_type("BitAnd", operator_type, NULL, 0);
        if (!BitAnd_type) return 0;
        BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL);
        if (!BitAnd_singleton) return 0;
        FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0);
        if (!FloorDiv_type) return 0;
        FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL);
        if (!FloorDiv_singleton) return 0;
        unaryop_type = make_type("unaryop", &AST_type, NULL, 0);
        if (!unaryop_type) return 0;
        if (!add_attributes(unaryop_type, NULL, 0)) return 0;
        Invert_type = make_type("Invert", unaryop_type, NULL, 0);
        if (!Invert_type) return 0;
        Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL);
        if (!Invert_singleton) return 0;
        Not_type = make_type("Not", unaryop_type, NULL, 0);
        if (!Not_type) return 0;
        Not_singleton = PyType_GenericNew(Not_type, NULL, NULL);
        if (!Not_singleton) return 0;
        UAdd_type = make_type("UAdd", unaryop_type, NULL, 0);
        if (!UAdd_type) return 0;
        UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL);
        if (!UAdd_singleton) return 0;
        USub_type = make_type("USub", unaryop_type, NULL, 0);
        if (!USub_type) return 0;
        USub_singleton = PyType_GenericNew(USub_type, NULL, NULL);
        if (!USub_singleton) return 0;
        cmpop_type = make_type("cmpop", &AST_type, NULL, 0);
        if (!cmpop_type) return 0;
        if (!add_attributes(cmpop_type, NULL, 0)) return 0;
        Eq_type = make_type("Eq", cmpop_type, NULL, 0);
        if (!Eq_type) return 0;
        Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL);
        if (!Eq_singleton) return 0;
        NotEq_type = make_type("NotEq", cmpop_type, NULL, 0);
        if (!NotEq_type) return 0;
        NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL);
        if (!NotEq_singleton) return 0;
        Lt_type = make_type("Lt", cmpop_type, NULL, 0);
        if (!Lt_type) return 0;
        Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL);
        if (!Lt_singleton) return 0;
        LtE_type = make_type("LtE", cmpop_type, NULL, 0);
        if (!LtE_type) return 0;
        LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL);
        if (!LtE_singleton) return 0;
        Gt_type = make_type("Gt", cmpop_type, NULL, 0);
        if (!Gt_type) return 0;
        Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL);
        if (!Gt_singleton) return 0;
        GtE_type = make_type("GtE", cmpop_type, NULL, 0);
        if (!GtE_type) return 0;
        GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL);
        if (!GtE_singleton) return 0;
        Is_type = make_type("Is", cmpop_type, NULL, 0);
        if (!Is_type) return 0;
        Is_singleton = PyType_GenericNew(Is_type, NULL, NULL);
        if (!Is_singleton) return 0;
        IsNot_type = make_type("IsNot", cmpop_type, NULL, 0);
        if (!IsNot_type) return 0;
        IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL);
        if (!IsNot_singleton) return 0;
        In_type = make_type("In", cmpop_type, NULL, 0);
        if (!In_type) return 0;
        In_singleton = PyType_GenericNew(In_type, NULL, NULL);
        if (!In_singleton) return 0;
        NotIn_type = make_type("NotIn", cmpop_type, NULL, 0);
        if (!NotIn_type) return 0;
        NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL);
        if (!NotIn_singleton) return 0;
        comprehension_type = make_type("comprehension", &AST_type,
                                       comprehension_fields, 3);
        if (!comprehension_type) return 0;
        excepthandler_type = make_type("excepthandler", &AST_type, NULL, 0);
        if (!excepthandler_type) return 0;
        if (!add_attributes(excepthandler_type, excepthandler_attributes, 2))
            return 0;
        ExceptHandler_type = make_type("ExceptHandler", excepthandler_type,
                                       ExceptHandler_fields, 3);
        if (!ExceptHandler_type) return 0;
        arguments_type = make_type("arguments", &AST_type, arguments_fields, 8);
        if (!arguments_type) return 0;
        arg_type = make_type("arg", &AST_type, arg_fields, 2);
        if (!arg_type) return 0;
        keyword_type = make_type("keyword", &AST_type, keyword_fields, 2);
        if (!keyword_type) return 0;
        alias_type = make_type("alias", &AST_type, alias_fields, 2);
        if (!alias_type) return 0;
        initialized = 1;
        return 1;
}

static int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena);
static int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena);
static int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena);
static int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena*
                                arena);
static int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena);
static int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena);
static int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena);
static int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena);
static int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena);
static int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena*
                                 arena);
static int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena*
                                 arena);
static int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena);
static int obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena);
static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena);
static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena);

mod_ty
Module(asdl_seq * body, PyArena *arena)
{
        mod_ty p;
        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Module_kind;
        p->v.Module.body = body;
        return p;
}

mod_ty
Interactive(asdl_seq * body, PyArena *arena)
{
        mod_ty p;
        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Interactive_kind;
        p->v.Interactive.body = body;
        return p;
}

mod_ty
Expression(expr_ty body, PyArena *arena)
{
        mod_ty p;
        if (!body) {
                PyErr_SetString(PyExc_ValueError,
                                "field body is required for Expression");
                return NULL;
        }
        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Expression_kind;
        p->v.Expression.body = body;
        return p;
}

mod_ty
Suite(asdl_seq * body, PyArena *arena)
{
        mod_ty p;
        p = (mod_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Suite_kind;
        p->v.Suite.body = body;
        return p;
}

stmt_ty
FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq *
            decorator_list, expr_ty returns, int lineno, int col_offset,
            PyArena *arena)
{
        stmt_ty p;
        if (!name) {
                PyErr_SetString(PyExc_ValueError,
                                "field name is required for FunctionDef");
                return NULL;
        }
        if (!args) {
                PyErr_SetString(PyExc_ValueError,
                                "field args is required for FunctionDef");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = FunctionDef_kind;
        p->v.FunctionDef.name = name;
        p->v.FunctionDef.args = args;
        p->v.FunctionDef.body = body;
        p->v.FunctionDef.decorator_list = decorator_list;
        p->v.FunctionDef.returns = returns;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
ClassDef(identifier name, asdl_seq * bases, asdl_seq * keywords, expr_ty
         starargs, expr_ty kwargs, asdl_seq * body, asdl_seq * decorator_list,
         int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!name) {
                PyErr_SetString(PyExc_ValueError,
                                "field name is required for ClassDef");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = ClassDef_kind;
        p->v.ClassDef.name = name;
        p->v.ClassDef.bases = bases;
        p->v.ClassDef.keywords = keywords;
        p->v.ClassDef.starargs = starargs;
        p->v.ClassDef.kwargs = kwargs;
        p->v.ClassDef.body = body;
        p->v.ClassDef.decorator_list = decorator_list;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Return(expr_ty value, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Return_kind;
        p->v.Return.value = value;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Delete_kind;
        p->v.Delete.targets = targets;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena
       *arena)
{
        stmt_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Assign");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Assign_kind;
        p->v.Assign.targets = targets;
        p->v.Assign.value = value;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int
          col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!target) {
                PyErr_SetString(PyExc_ValueError,
                                "field target is required for AugAssign");
                return NULL;
        }
        if (!op) {
                PyErr_SetString(PyExc_ValueError,
                                "field op is required for AugAssign");
                return NULL;
        }
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for AugAssign");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = AugAssign_kind;
        p->v.AugAssign.target = target;
        p->v.AugAssign.op = op;
        p->v.AugAssign.value = value;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int
    lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!target) {
                PyErr_SetString(PyExc_ValueError,
                                "field target is required for For");
                return NULL;
        }
        if (!iter) {
                PyErr_SetString(PyExc_ValueError,
                                "field iter is required for For");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = For_kind;
        p->v.For.target = target;
        p->v.For.iter = iter;
        p->v.For.body = body;
        p->v.For.orelse = orelse;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
      col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!test) {
                PyErr_SetString(PyExc_ValueError,
                                "field test is required for While");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = While_kind;
        p->v.While.test = test;
        p->v.While.body = body;
        p->v.While.orelse = orelse;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
   col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!test) {
                PyErr_SetString(PyExc_ValueError,
                                "field test is required for If");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = If_kind;
        p->v.If.test = test;
        p->v.If.body = body;
        p->v.If.orelse = orelse;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno,
     int col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!context_expr) {
                PyErr_SetString(PyExc_ValueError,
                                "field context_expr is required for With");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = With_kind;
        p->v.With.context_expr = context_expr;
        p->v.With.optional_vars = optional_vars;
        p->v.With.body = body;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Raise_kind;
        p->v.Raise.exc = exc;
        p->v.Raise.cause = cause;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno,
          int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = TryExcept_kind;
        p->v.TryExcept.body = body;
        p->v.TryExcept.handlers = handlers;
        p->v.TryExcept.orelse = orelse;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset,
           PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = TryFinally_kind;
        p->v.TryFinally.body = body;
        p->v.TryFinally.finalbody = finalbody;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!test) {
                PyErr_SetString(PyExc_ValueError,
                                "field test is required for Assert");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Assert_kind;
        p->v.Assert.test = test;
        p->v.Assert.msg = msg;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Import_kind;
        p->v.Import.names = names;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
           col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = ImportFrom_kind;
        p->v.ImportFrom.module = module;
        p->v.ImportFrom.names = names;
        p->v.ImportFrom.level = level;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Global_kind;
        p->v.Global.names = names;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Nonlocal(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Nonlocal_kind;
        p->v.Nonlocal.names = names;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Expr(expr_ty value, int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Expr");
                return NULL;
        }
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Expr_kind;
        p->v.Expr.value = value;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Pass(int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Pass_kind;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Break(int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Break_kind;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

stmt_ty
Continue(int lineno, int col_offset, PyArena *arena)
{
        stmt_ty p;
        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Continue_kind;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena
       *arena)
{
        expr_ty p;
        if (!op) {
                PyErr_SetString(PyExc_ValueError,
                                "field op is required for BoolOp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = BoolOp_kind;
        p->v.BoolOp.op = op;
        p->v.BoolOp.values = values;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset,
      PyArena *arena)
{
        expr_ty p;
        if (!left) {
                PyErr_SetString(PyExc_ValueError,
                                "field left is required for BinOp");
                return NULL;
        }
        if (!op) {
                PyErr_SetString(PyExc_ValueError,
                                "field op is required for BinOp");
                return NULL;
        }
        if (!right) {
                PyErr_SetString(PyExc_ValueError,
                                "field right is required for BinOp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = BinOp_kind;
        p->v.BinOp.left = left;
        p->v.BinOp.op = op;
        p->v.BinOp.right = right;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena
        *arena)
{
        expr_ty p;
        if (!op) {
                PyErr_SetString(PyExc_ValueError,
                                "field op is required for UnaryOp");
                return NULL;
        }
        if (!operand) {
                PyErr_SetString(PyExc_ValueError,
                                "field operand is required for UnaryOp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = UnaryOp_kind;
        p->v.UnaryOp.op = op;
        p->v.UnaryOp.operand = operand;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena
       *arena)
{
        expr_ty p;
        if (!args) {
                PyErr_SetString(PyExc_ValueError,
                                "field args is required for Lambda");
                return NULL;
        }
        if (!body) {
                PyErr_SetString(PyExc_ValueError,
                                "field body is required for Lambda");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Lambda_kind;
        p->v.Lambda.args = args;
        p->v.Lambda.body = body;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset,
      PyArena *arena)
{
        expr_ty p;
        if (!test) {
                PyErr_SetString(PyExc_ValueError,
                                "field test is required for IfExp");
                return NULL;
        }
        if (!body) {
                PyErr_SetString(PyExc_ValueError,
                                "field body is required for IfExp");
                return NULL;
        }
        if (!orelse) {
                PyErr_SetString(PyExc_ValueError,
                                "field orelse is required for IfExp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = IfExp_kind;
        p->v.IfExp.test = test;
        p->v.IfExp.body = body;
        p->v.IfExp.orelse = orelse;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena
     *arena)
{
        expr_ty p;
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Dict_kind;
        p->v.Dict.keys = keys;
        p->v.Dict.values = values;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Set_kind;
        p->v.Set.elts = elts;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
         PyArena *arena)
{
        expr_ty p;
        if (!elt) {
                PyErr_SetString(PyExc_ValueError,
                                "field elt is required for ListComp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = ListComp_kind;
        p->v.ListComp.elt = elt;
        p->v.ListComp.generators = generators;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena
        *arena)
{
        expr_ty p;
        if (!elt) {
                PyErr_SetString(PyExc_ValueError,
                                "field elt is required for SetComp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = SetComp_kind;
        p->v.SetComp.elt = elt;
        p->v.SetComp.generators = generators;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int
         col_offset, PyArena *arena)
{
        expr_ty p;
        if (!key) {
                PyErr_SetString(PyExc_ValueError,
                                "field key is required for DictComp");
                return NULL;
        }
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for DictComp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = DictComp_kind;
        p->v.DictComp.key = key;
        p->v.DictComp.value = value;
        p->v.DictComp.generators = generators;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset,
             PyArena *arena)
{
        expr_ty p;
        if (!elt) {
                PyErr_SetString(PyExc_ValueError,
                                "field elt is required for GeneratorExp");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = GeneratorExp_kind;
        p->v.GeneratorExp.elt = elt;
        p->v.GeneratorExp.generators = generators;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Yield(expr_ty value, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Yield_kind;
        p->v.Yield.value = value;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno,
        int col_offset, PyArena *arena)
{
        expr_ty p;
        if (!left) {
                PyErr_SetString(PyExc_ValueError,
                                "field left is required for Compare");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Compare_kind;
        p->v.Compare.left = left;
        p->v.Compare.ops = ops;
        p->v.Compare.comparators = comparators;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs,
     expr_ty kwargs, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        if (!func) {
                PyErr_SetString(PyExc_ValueError,
                                "field func is required for Call");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Call_kind;
        p->v.Call.func = func;
        p->v.Call.args = args;
        p->v.Call.keywords = keywords;
        p->v.Call.starargs = starargs;
        p->v.Call.kwargs = kwargs;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Num(object n, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        if (!n) {
                PyErr_SetString(PyExc_ValueError,
                                "field n is required for Num");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Num_kind;
        p->v.Num.n = n;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Str(string s, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        if (!s) {
                PyErr_SetString(PyExc_ValueError,
                                "field s is required for Str");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Str_kind;
        p->v.Str.s = s;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Bytes(string s, int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        if (!s) {
                PyErr_SetString(PyExc_ValueError,
                                "field s is required for Bytes");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Bytes_kind;
        p->v.Bytes.s = s;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Ellipsis(int lineno, int col_offset, PyArena *arena)
{
        expr_ty p;
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Ellipsis_kind;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int
          col_offset, PyArena *arena)
{
        expr_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Attribute");
                return NULL;
        }
        if (!attr) {
                PyErr_SetString(PyExc_ValueError,
                                "field attr is required for Attribute");
                return NULL;
        }
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for Attribute");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Attribute_kind;
        p->v.Attribute.value = value;
        p->v.Attribute.attr = attr;
        p->v.Attribute.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int
          col_offset, PyArena *arena)
{
        expr_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Subscript");
                return NULL;
        }
        if (!slice) {
                PyErr_SetString(PyExc_ValueError,
                                "field slice is required for Subscript");
                return NULL;
        }
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for Subscript");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Subscript_kind;
        p->v.Subscript.value = value;
        p->v.Subscript.slice = slice;
        p->v.Subscript.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Starred(expr_ty value, expr_context_ty ctx, int lineno, int col_offset, PyArena
        *arena)
{
        expr_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Starred");
                return NULL;
        }
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for Starred");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Starred_kind;
        p->v.Starred.value = value;
        p->v.Starred.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena
     *arena)
{
        expr_ty p;
        if (!id) {
                PyErr_SetString(PyExc_ValueError,
                                "field id is required for Name");
                return NULL;
        }
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for Name");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Name_kind;
        p->v.Name.id = id;
        p->v.Name.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
     *arena)
{
        expr_ty p;
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for List");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = List_kind;
        p->v.List.elts = elts;
        p->v.List.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

expr_ty
Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena
      *arena)
{
        expr_ty p;
        if (!ctx) {
                PyErr_SetString(PyExc_ValueError,
                                "field ctx is required for Tuple");
                return NULL;
        }
        p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Tuple_kind;
        p->v.Tuple.elts = elts;
        p->v.Tuple.ctx = ctx;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

slice_ty
Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena)
{
        slice_ty p;
        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Slice_kind;
        p->v.Slice.lower = lower;
        p->v.Slice.upper = upper;
        p->v.Slice.step = step;
        return p;
}

slice_ty
ExtSlice(asdl_seq * dims, PyArena *arena)
{
        slice_ty p;
        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = ExtSlice_kind;
        p->v.ExtSlice.dims = dims;
        return p;
}

slice_ty
Index(expr_ty value, PyArena *arena)
{
        slice_ty p;
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for Index");
                return NULL;
        }
        p = (slice_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = Index_kind;
        p->v.Index.value = value;
        return p;
}

comprehension_ty
comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena)
{
        comprehension_ty p;
        if (!target) {
                PyErr_SetString(PyExc_ValueError,
                                "field target is required for comprehension");
                return NULL;
        }
        if (!iter) {
                PyErr_SetString(PyExc_ValueError,
                                "field iter is required for comprehension");
                return NULL;
        }
        p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->target = target;
        p->iter = iter;
        p->ifs = ifs;
        return p;
}

excepthandler_ty
ExceptHandler(expr_ty type, identifier name, asdl_seq * body, int lineno, int
              col_offset, PyArena *arena)
{
        excepthandler_ty p;
        p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->kind = ExceptHandler_kind;
        p->v.ExceptHandler.type = type;
        p->v.ExceptHandler.name = name;
        p->v.ExceptHandler.body = body;
        p->lineno = lineno;
        p->col_offset = col_offset;
        return p;
}

arguments_ty
arguments(asdl_seq * args, identifier vararg, expr_ty varargannotation,
          asdl_seq * kwonlyargs, identifier kwarg, expr_ty kwargannotation,
          asdl_seq * defaults, asdl_seq * kw_defaults, PyArena *arena)
{
        arguments_ty p;
        p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->args = args;
        p->vararg = vararg;
        p->varargannotation = varargannotation;
        p->kwonlyargs = kwonlyargs;
        p->kwarg = kwarg;
        p->kwargannotation = kwargannotation;
        p->defaults = defaults;
        p->kw_defaults = kw_defaults;
        return p;
}

arg_ty
arg(identifier arg, expr_ty annotation, PyArena *arena)
{
        arg_ty p;
        if (!arg) {
                PyErr_SetString(PyExc_ValueError,
                                "field arg is required for arg");
                return NULL;
        }
        p = (arg_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->arg = arg;
        p->annotation = annotation;
        return p;
}

keyword_ty
keyword(identifier arg, expr_ty value, PyArena *arena)
{
        keyword_ty p;
        if (!arg) {
                PyErr_SetString(PyExc_ValueError,
                                "field arg is required for keyword");
                return NULL;
        }
        if (!value) {
                PyErr_SetString(PyExc_ValueError,
                                "field value is required for keyword");
                return NULL;
        }
        p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->arg = arg;
        p->value = value;
        return p;
}

alias_ty
alias(identifier name, identifier asname, PyArena *arena)
{
        alias_ty p;
        if (!name) {
                PyErr_SetString(PyExc_ValueError,
                                "field name is required for alias");
                return NULL;
        }
        p = (alias_ty)PyArena_Malloc(arena, sizeof(*p));
        if (!p)
                return NULL;
        p->name = name;
        p->asname = asname;
        return p;
}


PyObject*
ast2obj_mod(void* _o)
{
        mod_ty o = (mod_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        switch (o->kind) {
        case Module_kind:
                result = PyType_GenericNew(Module_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Module.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Interactive_kind:
                result = PyType_GenericNew(Interactive_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Expression_kind:
                result = PyType_GenericNew(Expression_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Expression.body);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Suite_kind:
                result = PyType_GenericNew(Suite_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Suite.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        }
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_stmt(void* _o)
{
        stmt_ty o = (stmt_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        switch (o->kind) {
        case FunctionDef_kind:
                result = PyType_GenericNew(FunctionDef_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_identifier(o->v.FunctionDef.name);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "name", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_arguments(o->v.FunctionDef.args);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "args", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.FunctionDef.decorator_list,
                                     ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "decorator_list", value) ==
                    -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.FunctionDef.returns);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "returns", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case ClassDef_kind:
                result = PyType_GenericNew(ClassDef_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_identifier(o->v.ClassDef.name);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "name", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "bases", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "keywords", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.ClassDef.starargs);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "starargs", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.ClassDef.kwargs);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "kwargs", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ClassDef.decorator_list,
                                     ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "decorator_list", value) ==
                    -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Return_kind:
                result = PyType_GenericNew(Return_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Return.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Delete_kind:
                result = PyType_GenericNew(Delete_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "targets", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Assign_kind:
                result = PyType_GenericNew(Assign_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "targets", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Assign.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case AugAssign_kind:
                result = PyType_GenericNew(AugAssign_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.AugAssign.target);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "target", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_operator(o->v.AugAssign.op);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "op", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.AugAssign.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case For_kind:
                result = PyType_GenericNew(For_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.For.target);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "target", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.For.iter);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "iter", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.For.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "orelse", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case While_kind:
                result = PyType_GenericNew(While_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.While.test);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "test", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.While.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "orelse", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case If_kind:
                result = PyType_GenericNew(If_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.If.test);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "test", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.If.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "orelse", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case With_kind:
                result = PyType_GenericNew(With_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.With.context_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "context_expr", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.With.optional_vars);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "optional_vars", value) ==
                    -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.With.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Raise_kind:
                result = PyType_GenericNew(Raise_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Raise.exc);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "exc", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Raise.cause);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "cause", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case TryExcept_kind:
                result = PyType_GenericNew(TryExcept_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.TryExcept.handlers,
                                     ast2obj_excepthandler);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "handlers", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "orelse", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case TryFinally_kind:
                result = PyType_GenericNew(TryFinally_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "finalbody", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Assert_kind:
                result = PyType_GenericNew(Assert_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Assert.test);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "test", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Assert.msg);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "msg", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Import_kind:
                result = PyType_GenericNew(Import_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Import.names, ast2obj_alias);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "names", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case ImportFrom_kind:
                result = PyType_GenericNew(ImportFrom_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_identifier(o->v.ImportFrom.module);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "module", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "names", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_int(o->v.ImportFrom.level);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "level", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Global_kind:
                result = PyType_GenericNew(Global_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Global.names, ast2obj_identifier);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "names", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Nonlocal_kind:
                result = PyType_GenericNew(Nonlocal_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "names", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Expr_kind:
                result = PyType_GenericNew(Expr_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Expr.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Pass_kind:
                result = PyType_GenericNew(Pass_type, NULL, NULL);
                if (!result) goto failed;
                break;
        case Break_kind:
                result = PyType_GenericNew(Break_type, NULL, NULL);
                if (!result) goto failed;
                break;
        case Continue_kind:
                result = PyType_GenericNew(Continue_type, NULL, NULL);
                if (!result) goto failed;
                break;
        }
        value = ast2obj_int(o->lineno);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "lineno", value) < 0)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_int(o->col_offset);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "col_offset", value) < 0)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_expr(void* _o)
{
        expr_ty o = (expr_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        switch (o->kind) {
        case BoolOp_kind:
                result = PyType_GenericNew(BoolOp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_boolop(o->v.BoolOp.op);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "op", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "values", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case BinOp_kind:
                result = PyType_GenericNew(BinOp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.BinOp.left);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "left", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_operator(o->v.BinOp.op);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "op", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.BinOp.right);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "right", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case UnaryOp_kind:
                result = PyType_GenericNew(UnaryOp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_unaryop(o->v.UnaryOp.op);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "op", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.UnaryOp.operand);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "operand", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Lambda_kind:
                result = PyType_GenericNew(Lambda_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_arguments(o->v.Lambda.args);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "args", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Lambda.body);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case IfExp_kind:
                result = PyType_GenericNew(IfExp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.IfExp.test);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "test", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.IfExp.body);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.IfExp.orelse);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "orelse", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Dict_kind:
                result = PyType_GenericNew(Dict_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "keys", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.Dict.values, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "values", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Set_kind:
                result = PyType_GenericNew(Set_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Set.elts, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elts", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case ListComp_kind:
                result = PyType_GenericNew(ListComp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.ListComp.elt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elt", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ListComp.generators,
                                     ast2obj_comprehension);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "generators", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case SetComp_kind:
                result = PyType_GenericNew(SetComp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.SetComp.elt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elt", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.SetComp.generators,
                                     ast2obj_comprehension);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "generators", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case DictComp_kind:
                result = PyType_GenericNew(DictComp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.DictComp.key);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "key", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.DictComp.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.DictComp.generators,
                                     ast2obj_comprehension);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "generators", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case GeneratorExp_kind:
                result = PyType_GenericNew(GeneratorExp_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.GeneratorExp.elt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elt", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.GeneratorExp.generators,
                                     ast2obj_comprehension);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "generators", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Yield_kind:
                result = PyType_GenericNew(Yield_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Yield.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Compare_kind:
                result = PyType_GenericNew(Compare_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Compare.left);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "left", value) == -1)
                        goto failed;
                Py_DECREF(value);
                {
                        int i, n = asdl_seq_LEN(o->v.Compare.ops);
                        value = PyList_New(n);
                        if (!value) goto failed;
                        for(i = 0; i < n; i++)
                                PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
                }
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ops", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "comparators", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Call_kind:
                result = PyType_GenericNew(Call_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Call.func);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "func", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.Call.args, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "args", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "keywords", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Call.starargs);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "starargs", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Call.kwargs);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "kwargs", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Num_kind:
                result = PyType_GenericNew(Num_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_object(o->v.Num.n);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "n", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Str_kind:
                result = PyType_GenericNew(Str_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_string(o->v.Str.s);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "s", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Bytes_kind:
                result = PyType_GenericNew(Bytes_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_string(o->v.Bytes.s);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "s", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Ellipsis_kind:
                result = PyType_GenericNew(Ellipsis_type, NULL, NULL);
                if (!result) goto failed;
                break;
        case Attribute_kind:
                result = PyType_GenericNew(Attribute_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Attribute.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_identifier(o->v.Attribute.attr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "attr", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.Attribute.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Subscript_kind:
                result = PyType_GenericNew(Subscript_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Subscript.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_slice(o->v.Subscript.slice);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "slice", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.Subscript.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Starred_kind:
                result = PyType_GenericNew(Starred_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Starred.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.Starred.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Name_kind:
                result = PyType_GenericNew(Name_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_identifier(o->v.Name.id);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "id", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.Name.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case List_kind:
                result = PyType_GenericNew(List_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.List.elts, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elts", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.List.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Tuple_kind:
                result = PyType_GenericNew(Tuple_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "elts", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr_context(o->v.Tuple.ctx);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "ctx", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        }
        value = ast2obj_int(o->lineno);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "lineno", value) < 0)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_int(o->col_offset);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "col_offset", value) < 0)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject* ast2obj_expr_context(expr_context_ty o)
{
        switch(o) {
                case Load:
                        Py_INCREF(Load_singleton);
                        return Load_singleton;
                case Store:
                        Py_INCREF(Store_singleton);
                        return Store_singleton;
                case Del:
                        Py_INCREF(Del_singleton);
                        return Del_singleton;
                case AugLoad:
                        Py_INCREF(AugLoad_singleton);
                        return AugLoad_singleton;
                case AugStore:
                        Py_INCREF(AugStore_singleton);
                        return AugStore_singleton;
                case Param:
                        Py_INCREF(Param_singleton);
                        return Param_singleton;
                default:
                        /* should never happen, but just in case ... */
                        PyErr_Format(PyExc_SystemError, "unknown expr_context found");
                        return NULL;
        }
}
PyObject*
ast2obj_slice(void* _o)
{
        slice_ty o = (slice_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        switch (o->kind) {
        case Slice_kind:
                result = PyType_GenericNew(Slice_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Slice.lower);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "lower", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Slice.upper);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "upper", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_expr(o->v.Slice.step);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "step", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case ExtSlice_kind:
                result = PyType_GenericNew(ExtSlice_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "dims", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        case Index_kind:
                result = PyType_GenericNew(Index_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.Index.value);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "value", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        }
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject* ast2obj_boolop(boolop_ty o)
{
        switch(o) {
                case And:
                        Py_INCREF(And_singleton);
                        return And_singleton;
                case Or:
                        Py_INCREF(Or_singleton);
                        return Or_singleton;
                default:
                        /* should never happen, but just in case ... */
                        PyErr_Format(PyExc_SystemError, "unknown boolop found");
                        return NULL;
        }
}
PyObject* ast2obj_operator(operator_ty o)
{
        switch(o) {
                case Add:
                        Py_INCREF(Add_singleton);
                        return Add_singleton;
                case Sub:
                        Py_INCREF(Sub_singleton);
                        return Sub_singleton;
                case Mult:
                        Py_INCREF(Mult_singleton);
                        return Mult_singleton;
                case Div:
                        Py_INCREF(Div_singleton);
                        return Div_singleton;
                case Mod:
                        Py_INCREF(Mod_singleton);
                        return Mod_singleton;
                case Pow:
                        Py_INCREF(Pow_singleton);
                        return Pow_singleton;
                case LShift:
                        Py_INCREF(LShift_singleton);
                        return LShift_singleton;
                case RShift:
                        Py_INCREF(RShift_singleton);
                        return RShift_singleton;
                case BitOr:
                        Py_INCREF(BitOr_singleton);
                        return BitOr_singleton;
                case BitXor:
                        Py_INCREF(BitXor_singleton);
                        return BitXor_singleton;
                case BitAnd:
                        Py_INCREF(BitAnd_singleton);
                        return BitAnd_singleton;
                case FloorDiv:
                        Py_INCREF(FloorDiv_singleton);
                        return FloorDiv_singleton;
                default:
                        /* should never happen, but just in case ... */
                        PyErr_Format(PyExc_SystemError, "unknown operator found");
                        return NULL;
        }
}
PyObject* ast2obj_unaryop(unaryop_ty o)
{
        switch(o) {
                case Invert:
                        Py_INCREF(Invert_singleton);
                        return Invert_singleton;
                case Not:
                        Py_INCREF(Not_singleton);
                        return Not_singleton;
                case UAdd:
                        Py_INCREF(UAdd_singleton);
                        return UAdd_singleton;
                case USub:
                        Py_INCREF(USub_singleton);
                        return USub_singleton;
                default:
                        /* should never happen, but just in case ... */
                        PyErr_Format(PyExc_SystemError, "unknown unaryop found");
                        return NULL;
        }
}
PyObject* ast2obj_cmpop(cmpop_ty o)
{
        switch(o) {
                case Eq:
                        Py_INCREF(Eq_singleton);
                        return Eq_singleton;
                case NotEq:
                        Py_INCREF(NotEq_singleton);
                        return NotEq_singleton;
                case Lt:
                        Py_INCREF(Lt_singleton);
                        return Lt_singleton;
                case LtE:
                        Py_INCREF(LtE_singleton);
                        return LtE_singleton;
                case Gt:
                        Py_INCREF(Gt_singleton);
                        return Gt_singleton;
                case GtE:
                        Py_INCREF(GtE_singleton);
                        return GtE_singleton;
                case Is:
                        Py_INCREF(Is_singleton);
                        return Is_singleton;
                case IsNot:
                        Py_INCREF(IsNot_singleton);
                        return IsNot_singleton;
                case In:
                        Py_INCREF(In_singleton);
                        return In_singleton;
                case NotIn:
                        Py_INCREF(NotIn_singleton);
                        return NotIn_singleton;
                default:
                        /* should never happen, but just in case ... */
                        PyErr_Format(PyExc_SystemError, "unknown cmpop found");
                        return NULL;
        }
}
PyObject*
ast2obj_comprehension(void* _o)
{
        comprehension_ty o = (comprehension_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        result = PyType_GenericNew(comprehension_type, NULL, NULL);
        if (!result) return NULL;
        value = ast2obj_expr(o->target);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "target", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->iter);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "iter", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_list(o->ifs, ast2obj_expr);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "ifs", value) == -1)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_excepthandler(void* _o)
{
        excepthandler_ty o = (excepthandler_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        switch (o->kind) {
        case ExceptHandler_kind:
                result = PyType_GenericNew(ExceptHandler_type, NULL, NULL);
                if (!result) goto failed;
                value = ast2obj_expr(o->v.ExceptHandler.type);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "type", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_identifier(o->v.ExceptHandler.name);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "name", value) == -1)
                        goto failed;
                Py_DECREF(value);
                value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);
                if (!value) goto failed;
                if (PyObject_SetAttrString(result, "body", value) == -1)
                        goto failed;
                Py_DECREF(value);
                break;
        }
        value = ast2obj_int(o->lineno);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "lineno", value) < 0)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_int(o->col_offset);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "col_offset", value) < 0)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_arguments(void* _o)
{
        arguments_ty o = (arguments_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        result = PyType_GenericNew(arguments_type, NULL, NULL);
        if (!result) return NULL;
        value = ast2obj_list(o->args, ast2obj_arg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "args", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_identifier(o->vararg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "vararg", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->varargannotation);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "varargannotation", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_list(o->kwonlyargs, ast2obj_arg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "kwonlyargs", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_identifier(o->kwarg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "kwarg", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->kwargannotation);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "kwargannotation", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_list(o->defaults, ast2obj_expr);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "defaults", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_list(o->kw_defaults, ast2obj_expr);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "kw_defaults", value) == -1)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_arg(void* _o)
{
        arg_ty o = (arg_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        result = PyType_GenericNew(arg_type, NULL, NULL);
        if (!result) return NULL;
        value = ast2obj_identifier(o->arg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "arg", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->annotation);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "annotation", value) == -1)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_keyword(void* _o)
{
        keyword_ty o = (keyword_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        result = PyType_GenericNew(keyword_type, NULL, NULL);
        if (!result) return NULL;
        value = ast2obj_identifier(o->arg);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "arg", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_expr(o->value);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "value", value) == -1)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}

PyObject*
ast2obj_alias(void* _o)
{
        alias_ty o = (alias_ty)_o;
        PyObject *result = NULL, *value = NULL;
        if (!o) {
                Py_INCREF(Py_None);
                return Py_None;
        }

        result = PyType_GenericNew(alias_type, NULL, NULL);
        if (!result) return NULL;
        value = ast2obj_identifier(o->name);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "name", value) == -1)
                goto failed;
        Py_DECREF(value);
        value = ast2obj_identifier(o->asname);
        if (!value) goto failed;
        if (PyObject_SetAttrString(result, "asname", value) == -1)
                goto failed;
        Py_DECREF(value);
        return result;
failed:
        Py_XDECREF(value);
        Py_XDECREF(result);
        return NULL;
}


int
obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
{
        int isinstance;

        PyObject *tmp = NULL;

        if (obj == Py_None) {
                *out = NULL;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* body;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Module");
                        return 1;
                }
                *out = Module(body, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* body;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Interactive");
                        return 1;
                }
                *out = Interactive(body, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty body;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &body, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression");
                        return 1;
                }
                *out = Expression(body, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* body;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Suite field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Suite");
                        return 1;
                }
                *out = Suite(body, arena);
                if (*out == NULL) goto failed;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %R", obj);
        failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
{
        int isinstance;

        PyObject *tmp = NULL;
        int lineno;
        int col_offset;

        if (obj == Py_None) {
                *out = NULL;
                return 0;
        }
        if (PyObject_HasAttrString(obj, "lineno")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "lineno");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &lineno, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "col_offset")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "col_offset");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &col_offset, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
                return 1;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                identifier name;
                arguments_ty args;
                asdl_seq* body;
                asdl_seq* decorator_list;
                expr_ty returns;

                if (PyObject_HasAttrString(obj, "name")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "name");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &name, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "args")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "args");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_arguments(tmp, &args, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "decorator_list")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "decorator_list");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        decorator_list = asdl_seq_new(len, arena);
                        if (decorator_list == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(decorator_list, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "returns")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "returns");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &returns, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        returns = NULL;
                }
                *out = FunctionDef(name, args, body, decorator_list, returns,
                                   lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                identifier name;
                asdl_seq* bases;
                asdl_seq* keywords;
                expr_ty starargs;
                expr_ty kwargs;
                asdl_seq* body;
                asdl_seq* decorator_list;

                if (PyObject_HasAttrString(obj, "name")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "name");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &name, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "bases")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "bases");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        bases = asdl_seq_new(len, arena);
                        if (bases == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(bases, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "keywords")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "keywords");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ClassDef field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        keywords = asdl_seq_new(len, arena);
                        if (keywords == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                keyword_ty value;
                                res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(keywords, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from ClassDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "starargs")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "starargs");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &starargs, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        starargs = NULL;
                }
                if (PyObject_HasAttrString(obj, "kwargs")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "kwargs");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &kwargs, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        kwargs = NULL;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "decorator_list")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "decorator_list");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        decorator_list = asdl_seq_new(len, arena);
                        if (decorator_list == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(decorator_list, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from ClassDef");
                        return 1;
                }
                *out = ClassDef(name, bases, keywords, starargs, kwargs, body,
                                decorator_list, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        value = NULL;
                }
                *out = Return(value, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* targets;

                if (PyObject_HasAttrString(obj, "targets")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "targets");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        targets = asdl_seq_new(len, arena);
                        if (targets == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(targets, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Delete");
                        return 1;
                }
                *out = Delete(targets, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* targets;
                expr_ty value;

                if (PyObject_HasAttrString(obj, "targets")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "targets");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        targets = asdl_seq_new(len, arena);
                        if (targets == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(targets, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign");
                        return 1;
                }
                *out = Assign(targets, value, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty target;
                operator_ty op;
                expr_ty value;

                if (PyObject_HasAttrString(obj, "target")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "target");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &target, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "op")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "op");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_operator(tmp, &op, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign");
                        return 1;
                }
                *out = AugAssign(target, op, value, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)For_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty target;
                expr_ty iter;
                asdl_seq* body;
                asdl_seq* orelse;

                if (PyObject_HasAttrString(obj, "target")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "target");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &target, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "iter")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "iter");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &iter, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "orelse")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "orelse");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        orelse = asdl_seq_new(len, arena);
                        if (orelse == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(orelse, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from For");
                        return 1;
                }
                *out = For(target, iter, body, orelse, lineno, col_offset,
                           arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)While_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty test;
                asdl_seq* body;
                asdl_seq* orelse;

                if (PyObject_HasAttrString(obj, "test")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "test");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &test, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "orelse")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "orelse");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        orelse = asdl_seq_new(len, arena);
                        if (orelse == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(orelse, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from While");
                        return 1;
                }
                *out = While(test, body, orelse, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)If_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty test;
                asdl_seq* body;
                asdl_seq* orelse;

                if (PyObject_HasAttrString(obj, "test")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "test");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &test, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "orelse")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "orelse");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        orelse = asdl_seq_new(len, arena);
                        if (orelse == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(orelse, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from If");
                        return 1;
                }
                *out = If(test, body, orelse, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)With_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty context_expr;
                expr_ty optional_vars;
                asdl_seq* body;

                if (PyObject_HasAttrString(obj, "context_expr")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "context_expr");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &context_expr, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from With");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "optional_vars")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "optional_vars");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &optional_vars, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        optional_vars = NULL;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from With");
                        return 1;
                }
                *out = With(context_expr, optional_vars, body, lineno,
                            col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty exc;
                expr_ty cause;

                if (PyObject_HasAttrString(obj, "exc")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "exc");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &exc, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        exc = NULL;
                }
                if (PyObject_HasAttrString(obj, "cause")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "cause");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &cause, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        cause = NULL;
                }
                *out = Raise(exc, cause, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)TryExcept_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* body;
                asdl_seq* handlers;
                asdl_seq* orelse;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "TryExcept field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryExcept");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "handlers")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "handlers");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "TryExcept field \"handlers\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        handlers = asdl_seq_new(len, arena);
                        if (handlers == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                excepthandler_ty value;
                                res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(handlers, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from TryExcept");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "orelse")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "orelse");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "TryExcept field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        orelse = asdl_seq_new(len, arena);
                        if (orelse == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(orelse, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from TryExcept");
                        return 1;
                }
                *out = TryExcept(body, handlers, orelse, lineno, col_offset,
                                 arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)TryFinally_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* body;
                asdl_seq* finalbody;

                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "TryFinally field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryFinally");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "finalbody")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "finalbody");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "TryFinally field \"finalbody\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        finalbody = asdl_seq_new(len, arena);
                        if (finalbody == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(finalbody, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from TryFinally");
                        return 1;
                }
                *out = TryFinally(body, finalbody, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty test;
                expr_ty msg;

                if (PyObject_HasAttrString(obj, "test")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "test");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &test, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "msg")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "msg");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &msg, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        msg = NULL;
                }
                *out = Assert(test, msg, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* names;

                if (PyObject_HasAttrString(obj, "names")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "names");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        names = asdl_seq_new(len, arena);
                        if (names == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                alias_ty value;
                                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(names, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Import");
                        return 1;
                }
                *out = Import(names, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                identifier module;
                asdl_seq* names;
                int level;

                if (PyObject_HasAttrString(obj, "module")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "module");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &module, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        module = NULL;
                }
                if (PyObject_HasAttrString(obj, "names")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "names");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        names = asdl_seq_new(len, arena);
                        if (names == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                alias_ty value;
                                res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(names, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "level")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "level");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_int(tmp, &level, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        level = 0;
                }
                *out = ImportFrom(module, names, level, lineno, col_offset,
                                  arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* names;

                if (PyObject_HasAttrString(obj, "names")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "names");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        names = asdl_seq_new(len, arena);
                        if (names == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                identifier value;
                                res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(names, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Global");
                        return 1;
                }
                *out = Global(names, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Nonlocal_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* names;

                if (PyObject_HasAttrString(obj, "names")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "names");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Nonlocal field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        names = asdl_seq_new(len, arena);
                        if (names == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                identifier value;
                                res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(names, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Nonlocal");
                        return 1;
                }
                *out = Nonlocal(names, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr");
                        return 1;
                }
                *out = Expr(value, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {

                *out = Pass(lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {

                *out = Break(lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {

                *out = Continue(lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %R", obj);
        failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
{
        int isinstance;

        PyObject *tmp = NULL;
        int lineno;
        int col_offset;

        if (obj == Py_None) {
                *out = NULL;
                return 0;
        }
        if (PyObject_HasAttrString(obj, "lineno")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "lineno");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &lineno, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "col_offset")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "col_offset");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &col_offset, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
                return 1;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                boolop_ty op;
                asdl_seq* values;

                if (PyObject_HasAttrString(obj, "op")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "op");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_boolop(tmp, &op, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "values")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "values");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        values = asdl_seq_new(len, arena);
                        if (values == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(values, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from BoolOp");
                        return 1;
                }
                *out = BoolOp(op, values, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty left;
                operator_ty op;
                expr_ty right;

                if (PyObject_HasAttrString(obj, "left")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "left");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &left, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "op")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "op");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_operator(tmp, &op, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "right")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "right");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &right, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp");
                        return 1;
                }
                *out = BinOp(left, op, right, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                unaryop_ty op;
                expr_ty operand;

                if (PyObject_HasAttrString(obj, "op")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "op");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_unaryop(tmp, &op, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "operand")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "operand");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &operand, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp");
                        return 1;
                }
                *out = UnaryOp(op, operand, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                arguments_ty args;
                expr_ty body;

                if (PyObject_HasAttrString(obj, "args")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "args");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_arguments(tmp, &args, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &body, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda");
                        return 1;
                }
                *out = Lambda(args, body, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty test;
                expr_ty body;
                expr_ty orelse;

                if (PyObject_HasAttrString(obj, "test")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "test");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &test, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &body, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "orelse")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "orelse");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &orelse, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp");
                        return 1;
                }
                *out = IfExp(test, body, orelse, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* keys;
                asdl_seq* values;

                if (PyObject_HasAttrString(obj, "keys")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "keys");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        keys = asdl_seq_new(len, arena);
                        if (keys == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(keys, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "values")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "values");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        values = asdl_seq_new(len, arena);
                        if (values == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(values, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Dict");
                        return 1;
                }
                *out = Dict(keys, values, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* elts;

                if (PyObject_HasAttrString(obj, "elts")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "elts");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        elts = asdl_seq_new(len, arena);
                        if (elts == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(elts, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Set");
                        return 1;
                }
                *out = Set(elts, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty elt;
                asdl_seq* generators;

                if (PyObject_HasAttrString(obj, "elt")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "elt");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &elt, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "generators")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "generators");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        generators = asdl_seq_new(len, arena);
                        if (generators == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                comprehension_ty value;
                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(generators, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from ListComp");
                        return 1;
                }
                *out = ListComp(elt, generators, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty elt;
                asdl_seq* generators;

                if (PyObject_HasAttrString(obj, "elt")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "elt");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &elt, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "generators")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "generators");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        generators = asdl_seq_new(len, arena);
                        if (generators == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                comprehension_ty value;
                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(generators, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from SetComp");
                        return 1;
                }
                *out = SetComp(elt, generators, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty key;
                expr_ty value;
                asdl_seq* generators;

                if (PyObject_HasAttrString(obj, "key")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "key");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &key, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "generators")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "generators");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        generators = asdl_seq_new(len, arena);
                        if (generators == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                comprehension_ty value;
                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(generators, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from DictComp");
                        return 1;
                }
                *out = DictComp(key, value, generators, lineno, col_offset,
                                arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty elt;
                asdl_seq* generators;

                if (PyObject_HasAttrString(obj, "elt")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "elt");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &elt, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "generators")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "generators");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        generators = asdl_seq_new(len, arena);
                        if (generators == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                comprehension_ty value;
                                res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(generators, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from GeneratorExp");
                        return 1;
                }
                *out = GeneratorExp(elt, generators, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        value = NULL;
                }
                *out = Yield(value, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty left;
                asdl_int_seq* ops;
                asdl_seq* comparators;

                if (PyObject_HasAttrString(obj, "left")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "left");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &left, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ops")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "ops");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        ops = asdl_int_seq_new(len, arena);
                        if (ops == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                cmpop_ty value;
                                res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(ops, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "comparators")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "comparators");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        comparators = asdl_seq_new(len, arena);
                        if (comparators == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(comparators, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"comparators\" missing from Compare");
                        return 1;
                }
                *out = Compare(left, ops, comparators, lineno, col_offset,
                               arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty func;
                asdl_seq* args;
                asdl_seq* keywords;
                expr_ty starargs;
                expr_ty kwargs;

                if (PyObject_HasAttrString(obj, "func")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "func");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &func, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "args")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "args");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        args = asdl_seq_new(len, arena);
                        if (args == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(args, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "keywords")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "keywords");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        keywords = asdl_seq_new(len, arena);
                        if (keywords == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                keyword_ty value;
                                res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(keywords, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "starargs")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "starargs");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &starargs, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        starargs = NULL;
                }
                if (PyObject_HasAttrString(obj, "kwargs")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "kwargs");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &kwargs, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        kwargs = NULL;
                }
                *out = Call(func, args, keywords, starargs, kwargs, lineno,
                            col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                object n;

                if (PyObject_HasAttrString(obj, "n")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "n");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_object(tmp, &n, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"n\" missing from Num");
                        return 1;
                }
                *out = Num(n, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                string s;

                if (PyObject_HasAttrString(obj, "s")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "s");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_string(tmp, &s, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"s\" missing from Str");
                        return 1;
                }
                *out = Str(s, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Bytes_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                string s;

                if (PyObject_HasAttrString(obj, "s")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "s");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_string(tmp, &s, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"s\" missing from Bytes");
                        return 1;
                }
                *out = Bytes(s, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {

                *out = Ellipsis(lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;
                identifier attr;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "attr")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "attr");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &attr, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute");
                        return 1;
                }
                *out = Attribute(value, attr, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;
                slice_ty slice;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "slice")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "slice");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_slice(tmp, &slice, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript");
                        return 1;
                }
                *out = Subscript(value, slice, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Starred_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Starred");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Starred");
                        return 1;
                }
                *out = Starred(value, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                identifier id;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "id")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "id");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &id, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name");
                        return 1;
                }
                *out = Name(id, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)List_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* elts;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "elts")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "elts");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        elts = asdl_seq_new(len, arena);
                        if (elts == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(elts, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List");
                        return 1;
                }
                *out = List(elts, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* elts;
                expr_context_ty ctx;

                if (PyObject_HasAttrString(obj, "elts")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "elts");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        elts = asdl_seq_new(len, arena);
                        if (elts == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                expr_ty value;
                                res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(elts, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple");
                        return 1;
                }
                if (PyObject_HasAttrString(obj, "ctx")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "ctx");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr_context(tmp, &ctx, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple");
                        return 1;
                }
                *out = Tuple(elts, ctx, lineno, col_offset, arena);
                if (*out == NULL) goto failed;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj);
        failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
{
        int isinstance;

        isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Load;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Store;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Del;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = AugLoad;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = AugStore;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Param;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %R", obj);
        return 1;
}

int
obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
{
        int isinstance;

        PyObject *tmp = NULL;

        if (obj == Py_None) {
                *out = NULL;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty lower;
                expr_ty upper;
                expr_ty step;

                if (PyObject_HasAttrString(obj, "lower")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "lower");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &lower, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        lower = NULL;
                }
                if (PyObject_HasAttrString(obj, "upper")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "upper");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &upper, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        upper = NULL;
                }
                if (PyObject_HasAttrString(obj, "step")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "step");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &step, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        step = NULL;
                }
                *out = Slice(lower, upper, step, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                asdl_seq* dims;

                if (PyObject_HasAttrString(obj, "dims")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "dims");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ExtSlice field \"dims\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        dims = asdl_seq_new(len, arena);
                        if (dims == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                slice_ty value;
                                res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(dims, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"dims\" missing from ExtSlice");
                        return 1;
                }
                *out = ExtSlice(dims, arena);
                if (*out == NULL) goto failed;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty value;

                if (PyObject_HasAttrString(obj, "value")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "value");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &value, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Index");
                        return 1;
                }
                *out = Index(value, arena);
                if (*out == NULL) goto failed;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %R", obj);
        failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
{
        int isinstance;

        isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = And;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Or;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %R", obj);
        return 1;
}

int
obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
{
        int isinstance;

        isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Add;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Sub;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Mult;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Div;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Mod;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Pow;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = LShift;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = RShift;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = BitOr;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = BitXor;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = BitAnd;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = FloorDiv;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %R", obj);
        return 1;
}

int
obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
{
        int isinstance;

        isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Invert;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Not;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = UAdd;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = USub;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %R", obj);
        return 1;
}

int
obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
{
        int isinstance;

        isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Eq;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = NotEq;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Lt;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = LtE;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Gt;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = GtE;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = Is;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = IsNot;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = In;
                return 0;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                *out = NotIn;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %R", obj);
        return 1;
}

int
obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
{
        PyObject* tmp = NULL;
        expr_ty target;
        expr_ty iter;
        asdl_seq* ifs;

        if (PyObject_HasAttrString(obj, "target")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "target");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &target, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "iter")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "iter");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &iter, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "ifs")) {
                int res;
                Py_ssize_t len;
                Py_ssize_t i;
                tmp = PyObject_GetAttrString(obj, "ifs");
                if (tmp == NULL) goto failed;
                if (!PyList_Check(tmp)) {
                        PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                        goto failed;
                }
                len = PyList_GET_SIZE(tmp);
                ifs = asdl_seq_new(len, arena);
                if (ifs == NULL) goto failed;
                for (i = 0; i < len; i++) {
                        expr_ty value;
                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                        if (res != 0) goto failed;
                        asdl_seq_SET(ifs, i, value);
                }
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"ifs\" missing from comprehension");
                return 1;
        }
        *out = comprehension(target, iter, ifs, arena);
        return 0;
failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
{
        int isinstance;

        PyObject *tmp = NULL;
        int lineno;
        int col_offset;

        if (obj == Py_None) {
                *out = NULL;
                return 0;
        }
        if (PyObject_HasAttrString(obj, "lineno")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "lineno");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &lineno, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "col_offset")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "col_offset");
                if (tmp == NULL) goto failed;
                res = obj2ast_int(tmp, &col_offset, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
                return 1;
        }
        isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);
        if (isinstance == -1) {
                return 1;
        }
        if (isinstance) {
                expr_ty type;
                identifier name;
                asdl_seq* body;

                if (PyObject_HasAttrString(obj, "type")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "type");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_expr(tmp, &type, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        type = NULL;
                }
                if (PyObject_HasAttrString(obj, "name")) {
                        int res;
                        tmp = PyObject_GetAttrString(obj, "name");
                        if (tmp == NULL) goto failed;
                        res = obj2ast_identifier(tmp, &name, arena);
                        if (res != 0) goto failed;
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        name = NULL;
                }
                if (PyObject_HasAttrString(obj, "body")) {
                        int res;
                        Py_ssize_t len;
                        Py_ssize_t i;
                        tmp = PyObject_GetAttrString(obj, "body");
                        if (tmp == NULL) goto failed;
                        if (!PyList_Check(tmp)) {
                                PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                                goto failed;
                        }
                        len = PyList_GET_SIZE(tmp);
                        body = asdl_seq_new(len, arena);
                        if (body == NULL) goto failed;
                        for (i = 0; i < len; i++) {
                                stmt_ty value;
                                res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
                                if (res != 0) goto failed;
                                asdl_seq_SET(body, i, value);
                        }
                        Py_XDECREF(tmp);
                        tmp = NULL;
                } else {
                        PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ExceptHandler");
                        return 1;
                }
                *out = ExceptHandler(type, name, body, lineno, col_offset,
                                     arena);
                if (*out == NULL) goto failed;
                return 0;
        }

        PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %R", obj);
        failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
{
        PyObject* tmp = NULL;
        asdl_seq* args;
        identifier vararg;
        expr_ty varargannotation;
        asdl_seq* kwonlyargs;
        identifier kwarg;
        expr_ty kwargannotation;
        asdl_seq* defaults;
        asdl_seq* kw_defaults;

        if (PyObject_HasAttrString(obj, "args")) {
                int res;
                Py_ssize_t len;
                Py_ssize_t i;
                tmp = PyObject_GetAttrString(obj, "args");
                if (tmp == NULL) goto failed;
                if (!PyList_Check(tmp)) {
                        PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                        goto failed;
                }
                len = PyList_GET_SIZE(tmp);
                args = asdl_seq_new(len, arena);
                if (args == NULL) goto failed;
                for (i = 0; i < len; i++) {
                        arg_ty value;
                        res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena);
                        if (res != 0) goto failed;
                        asdl_seq_SET(args, i, value);
                }
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "vararg")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "vararg");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &vararg, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                vararg = NULL;
        }
        if (PyObject_HasAttrString(obj, "varargannotation")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "varargannotation");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &varargannotation, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                varargannotation = NULL;
        }
        if (PyObject_HasAttrString(obj, "kwonlyargs")) {
                int res;
                Py_ssize_t len;
                Py_ssize_t i;
                tmp = PyObject_GetAttrString(obj, "kwonlyargs");
                if (tmp == NULL) goto failed;
                if (!PyList_Check(tmp)) {
                        PyErr_Format(PyExc_TypeError, "arguments field \"kwonlyargs\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                        goto failed;
                }
                len = PyList_GET_SIZE(tmp);
                kwonlyargs = asdl_seq_new(len, arena);
                if (kwonlyargs == NULL) goto failed;
                for (i = 0; i < len; i++) {
                        arg_ty value;
                        res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena);
                        if (res != 0) goto failed;
                        asdl_seq_SET(kwonlyargs, i, value);
                }
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"kwonlyargs\" missing from arguments");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "kwarg")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "kwarg");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &kwarg, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                kwarg = NULL;
        }
        if (PyObject_HasAttrString(obj, "kwargannotation")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "kwargannotation");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &kwargannotation, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                kwargannotation = NULL;
        }
        if (PyObject_HasAttrString(obj, "defaults")) {
                int res;
                Py_ssize_t len;
                Py_ssize_t i;
                tmp = PyObject_GetAttrString(obj, "defaults");
                if (tmp == NULL) goto failed;
                if (!PyList_Check(tmp)) {
                        PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                        goto failed;
                }
                len = PyList_GET_SIZE(tmp);
                defaults = asdl_seq_new(len, arena);
                if (defaults == NULL) goto failed;
                for (i = 0; i < len; i++) {
                        expr_ty value;
                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                        if (res != 0) goto failed;
                        asdl_seq_SET(defaults, i, value);
                }
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "kw_defaults")) {
                int res;
                Py_ssize_t len;
                Py_ssize_t i;
                tmp = PyObject_GetAttrString(obj, "kw_defaults");
                if (tmp == NULL) goto failed;
                if (!PyList_Check(tmp)) {
                        PyErr_Format(PyExc_TypeError, "arguments field \"kw_defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name);
                        goto failed;
                }
                len = PyList_GET_SIZE(tmp);
                kw_defaults = asdl_seq_new(len, arena);
                if (kw_defaults == NULL) goto failed;
                for (i = 0; i < len; i++) {
                        expr_ty value;
                        res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
                        if (res != 0) goto failed;
                        asdl_seq_SET(kw_defaults, i, value);
                }
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"kw_defaults\" missing from arguments");
                return 1;
        }
        *out = arguments(args, vararg, varargannotation, kwonlyargs, kwarg,
                         kwargannotation, defaults, kw_defaults, arena);
        return 0;
failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
{
        PyObject* tmp = NULL;
        identifier arg;
        expr_ty annotation;

        if (PyObject_HasAttrString(obj, "arg")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "arg");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &arg, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from arg");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "annotation")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "annotation");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &annotation, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                annotation = NULL;
        }
        *out = arg(arg, annotation, arena);
        return 0;
failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
{
        PyObject* tmp = NULL;
        identifier arg;
        expr_ty value;

        if (PyObject_HasAttrString(obj, "arg")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "arg");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &arg, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from keyword");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "value")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "value");
                if (tmp == NULL) goto failed;
                res = obj2ast_expr(tmp, &value, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword");
                return 1;
        }
        *out = keyword(arg, value, arena);
        return 0;
failed:
        Py_XDECREF(tmp);
        return 1;
}

int
obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
{
        PyObject* tmp = NULL;
        identifier name;
        identifier asname;

        if (PyObject_HasAttrString(obj, "name")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "name");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &name, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias");
                return 1;
        }
        if (PyObject_HasAttrString(obj, "asname")) {
                int res;
                tmp = PyObject_GetAttrString(obj, "asname");
                if (tmp == NULL) goto failed;
                res = obj2ast_identifier(tmp, &asname, arena);
                if (res != 0) goto failed;
                Py_XDECREF(tmp);
                tmp = NULL;
        } else {
                asname = NULL;
        }
        *out = alias(name, asname, arena);
        return 0;
failed:
        Py_XDECREF(tmp);
        return 1;
}


static struct PyModuleDef _astmodule = {
  PyModuleDef_HEAD_INIT, "_ast"
};
PyMODINIT_FUNC
PyInit__ast(void)
{
        PyObject *m, *d;
        if (!init_types()) return NULL;
        m = PyModule_Create(&_astmodule);
        if (!m) return NULL;
        d = PyModule_GetDict(m);
        if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return
            NULL;
        if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
                return NULL;
        if (PyModule_AddStringConstant(m, "__version__", "0daa6ba25d9b") < 0)
                return NULL;
        if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type)
            < 0) return NULL;
        if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type)
            < 0) return NULL;
        if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Nonlocal", (PyObject*)Nonlocal_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Set", (PyObject*)Set_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "SetComp", (PyObject*)SetComp_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "DictComp", (PyObject*)DictComp_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "GeneratorExp",
            (PyObject*)GeneratorExp_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Bytes", (PyObject*)Bytes_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "Starred", (PyObject*)Starred_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "expr_context",
            (PyObject*)expr_context_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "comprehension",
            (PyObject*)comprehension_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "excepthandler",
            (PyObject*)excepthandler_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "ExceptHandler",
            (PyObject*)ExceptHandler_type) < 0) return NULL;
        if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) <
            0) return NULL;
        if (PyDict_SetItemString(d, "arg", (PyObject*)arg_type) < 0) return
            NULL;
        if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0)
            return NULL;
        if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return
            NULL;
        return m;
}


PyObject* PyAST_mod2obj(mod_ty t)
{
    init_types();
    return ast2obj_mod(t);
}

/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{
    mod_ty res;
    PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
                            (PyObject*)Interactive_type};
    char *req_name[] = {"Module", "Expression", "Interactive"};
    int isinstance;
    assert(0 <= mode && mode <= 2);

    init_types();

    isinstance = PyObject_IsInstance(ast, req_type[mode]);
    if (isinstance == -1)
        return NULL;
    if (!isinstance) {
        PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
                     req_name[mode], Py_TYPE(ast)->tp_name);
        return NULL;
    }
    if (obj2ast_mod(ast, &res, arena) != 0)
        return NULL;
    else
        return res;
}

int PyAST_Check(PyObject* obj)
{
    init_types();
    return PyObject_IsInstance(obj, (PyObject*)&AST_type);
}


tUpdate(); + + static QCoreWlanEngine *instance(); + static bool getAllScInterfaces(); + +private: + bool isWifiReady(const QString &dev); + QMap configurationInterface; + QTimer pollTimer; + QList scanForSsids(const QString &interfaceName); + + QList getWlanProfiles(const QString &interfaceName); + + QList getWifiConfigurations(); + bool isKnownSsid(const QString &interfaceName, const QString &ssid); +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm new file mode 100644 index 0000000..9dea217 --- /dev/null +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -0,0 +1,459 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcorewlanengine.h" + +#include + +#include +#include +#include +#include + +#include + +#if defined(MAC_SDK_10_6) //not much functionality without this +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include +QMap networkInterfaces; + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) + +inline QString cfstringRefToQstring(CFStringRef cfStringRef) { +// return QString([cfStringRef UTF8String]); + QString retVal; + CFIndex maxLength = 2 * CFStringGetLength(cfStringRef) + 1/*zero term*/; // max UTF8 + char *cstring = new char[maxLength]; + if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { + retVal = QString::fromUtf8(cstring); + } + delete cstring; + return retVal; +} + +inline CFStringRef qstringToCFStringRef(const QString &string) +{ + return CFStringCreateWithCharacters(0, reinterpret_cast(string.unicode()), + string.length()); +} + +inline NSString *qstringToNSString(const QString &qstr) +{ return [reinterpret_cast(qstringToCFStringRef(qstr)) autorelease]; } + +inline QString nsstringToQString(const NSString *nsstr) +{ return cfstringRefToQstring(reinterpret_cast(nsstr)); } + +inline QStringList nsarrayToQStringList(void *nsarray) +{ + QStringList result; + NSArray *array = static_cast(nsarray); + for (NSUInteger i=0; i<[array count]; ++i) + result << nsstringToQString([array objectAtIndex:i]); + return result; +} + +static QString qGetInterfaceType(const QString &interfaceString) +{ + return networkInterfaces.value(interfaceString); +} + +QCoreWlanEngine::QCoreWlanEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + getAllScInterfaces(); + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QCoreWlanEngine::~QCoreWlanEngine() +{ +} + +QList QCoreWlanEngine::getWifiConfigurations() +{ + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + QString interfaceName = i.key(); + if (i.value() == "WLAN") { + if(!isWifiReady(interfaceName)) { + qWarning() << "wifi not powered on"; + return QList(); + } else { + // QList profs = getWlanProfiles(interfaceName); + scanForSsids(interfaceName); + } + } else { + + } + } + return QList (); +} + +QList QCoreWlanEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + QList foundConfigurations; + QList wificonfigs = getWifiConfigurations(); + + uint identifier; + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + if (i.value() == "WLAN") { + QList fetchedConfigurations = scanForSsids(i.key()); + for (int i = 0; i < fetchedConfigurations.count(); ++i) { + + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + config->name = fetchedConfigurations.at(i)->name; + config->isValid = fetchedConfigurations.at(i)->isValid; + config->id = fetchedConfigurations.at(i)->id; + + config->state = fetchedConfigurations.at(i)->state; + config->type = fetchedConfigurations.at(i)->type; + config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; + config->purpose = fetchedConfigurations.at(i)->purpose; + config->internet = fetchedConfigurations.at(i)->internet; + config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; + + identifier = config->name.toUInt(); + configurationInterface[identifier] = config->serviceInterface.name(); + foundConfigurations.append(config); + } + } + + QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString humanReadableName = interface.humanReadableName(); + cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; + cpPriv->isValid = true; + + if (interface.index()) + identifier = interface.index(); + else + identifier = qHash(interface.hardwareAddress()); + + cpPriv->id = QString::number(identifier); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + + if (interface.flags() & QNetworkInterface::IsRunning) { + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->internet = true; + } + if ( !interface.addressEntries().isEmpty()) { + cpPriv->state |= QNetworkConfiguration::Active; + cpPriv->internet = true; + } + configurationInterface[identifier] = interface.name(); + foundConfigurations.append(cpPriv); + } + [autoreleasepool release]; + pollTimer.start(); + return foundConfigurations; +} + +QString QCoreWlanEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QCoreWlanEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QCoreWlanEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QCoreWlanEngine::connectToId(const QString &id) +{ + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QString interfaceString = getInterfaceFromId(id); + + if(networkInterfaces.value(interfaceString) == "WLAN") { +#if defined(MAC_SDK_10_6) + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + CWConfiguration *userConfig = [ wifiInterface configuration]; + + NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile + + NSEnumerator *enumerator = [remNets objectEnumerator]; + CWWirelessProfile *wProfile; + NSUInteger index=0; + while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile + + if(id == nsstringToQString([wProfile ssid])) { + CW8021XProfile *user8021XProfile = nil; + user8021XProfile = [ wProfile user8021XProfile]; + + NSError *err = nil; + NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; + + if(user8021XProfile) { + [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; + } else { + [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; + } + + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { + bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; + if(!result) { + qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); + emit connectionError(id, ConnectError); + } else { + [autoreleasepool release]; + return; + } + } + } + } + } + index++; + } + emit connectionError(id, InterfaceLookupError); +#endif + } else { + // not wifi + } + emit connectionError(id, OperationNotSupported); + [autoreleasepool release]; +} + +void QCoreWlanEngine::disconnectFromId(const QString &id) +{ + QString interfaceString = getInterfaceFromId(id); + if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + [wifiInterface disassociate]; + if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { + emit connectionError(id, DisconnectionError); + } + [autoreleasepool release]; + return; +#endif + } else { + + } + emit connectionError(id, OperationNotSupported); +} + +void QCoreWlanEngine::requestUpdate() +{ + getAllScInterfaces(); + emit configurationsChanged(); +} + +QCoreWlanEngine *QCoreWlanEngine::instance() +{ + return coreWlanEngine(); +} + +QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) +{ + QList foundConfigs; +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; + NSError *err = nil; + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QString networkSsid = nsstringToQString([apNetwork ssid]); + cpPriv->name = networkSsid; + cpPriv->isValid = true; + cpPriv->id = networkSsid; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); + + CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; + CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; + if(!userNetworkProfile) { + } else { + qWarning() <<"Has profile!" ; + } + + if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); + if( cpPriv->name == interfaceSsidString) { + cpPriv->state |= QNetworkConfiguration::Active; + } + } else { + if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { + cpPriv->state = QNetworkConfiguration::Discovered; + } else { + cpPriv->state = QNetworkConfiguration::Defined; + } + } + if(!cpPriv->state) { + cpPriv->state = QNetworkConfiguration::Undefined; + } + if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + else + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + foundConfigs.append(cpPriv); + } + } else { + qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) + < QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) +{ + Q_UNUSED(interfaceName) +#if defined(MAC_SDK_10_6) +// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { +// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); +// } + +#endif + return QList (); +} + +bool QCoreWlanEngine::getAllScInterfaces() +{ + networkInterfaces.clear(); + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CFArrayRef interfaces = SCNetworkInterfaceCopyAll(); + if (interfaces != NULL) { + CFIndex interfaceCount; + CFIndex interfaceIndex; + interfaceCount = CFArrayGetCount(interfaces); + for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) { + + CFStringRef bsdName; + CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex); + bsdName = SCNetworkInterfaceGetBSDName((SCNetworkInterfaceRef)thisInterface); + QString interfaceName = cfstringRefToQstring(bsdName); + QString typeStr; + CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface); + if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) { + typeStr = "WLAN"; +// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) { +// typeStr = "Bluetooth"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) { + typeStr = "Ethernet"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) { + typeStr = "Ethernet"; //ok a bit fudged + } + if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) { + networkInterfaces.insert(interfaceName,typeStr); + } + } + } + CFRelease(interfaces); + + [autoreleasepool release]; + return true; +} + +QT_END_NAMESPACE -- cgit v0.12 From 19e64169b8f3b0b0c12d99327e8c68c5c8a26498 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 7 Dec 2009 16:03:38 +1000 Subject: Remove debug. --- src/network/bearer/qbearerplugin.cpp | 1 - src/plugins/bearer/corewlan/main.cpp | 4 ---- src/plugins/bearer/generic/main.cpp | 4 ---- src/plugins/bearer/nativewifi/main.cpp | 4 ---- src/plugins/bearer/networkmanager/main.cpp | 4 ---- src/plugins/bearer/nla/main.cpp | 4 ---- 6 files changed, 21 deletions(-) diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 252ee71..7b81b13 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -48,7 +48,6 @@ QT_BEGIN_NAMESPACE QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) : QObject(parent) { - qDebug() << Q_FUNC_INFO; } QBearerEnginePlugin::~QBearerEnginePlugin() diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index c0d1efe..ce0611e 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -67,15 +67,11 @@ QCoreWlanEnginePlugin::~QCoreWlanEnginePlugin() QStringList QCoreWlanEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("corewlan"); } QBearerEngine *QCoreWlanEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("corewlan")) return new QCoreWlanEngine; else diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index c877fce..a7df023 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -67,15 +67,11 @@ QGenericEnginePlugin::~QGenericEnginePlugin() QStringList QGenericEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("generic"); } QBearerEngine *QGenericEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("generic")) return new QGenericEngine; else diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 2aced02..64ed73d 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -108,15 +108,11 @@ QNativeWifiEnginePlugin::~QNativeWifiEnginePlugin() QStringList QNativeWifiEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("nativewifi"); } QBearerEngine *QNativeWifiEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key != QLatin1String("nativewifi")) return 0; diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index c79fe91..d4b74a1 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -67,15 +67,11 @@ QNetworkManagerEnginePlugin::~QNetworkManagerEnginePlugin() QStringList QNetworkManagerEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("networkmanager"); } QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("networkmanager")) return new QNmWifiEngine; else diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index f0d36c4..541d2c5 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -67,15 +67,11 @@ QNlaEnginePlugin::~QNlaEnginePlugin() QStringList QNlaEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("nla"); } QBearerEngine *QNlaEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("nla")) return new QNlaEngine; else -- cgit v0.12 From 63d59200884a68e569cce9d0ee470447b8239f6b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 7 Dec 2009 16:11:11 +1000 Subject: Convert generic engine plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager.cpp | 66 +++-- src/network/bearer/qnetworkconfigmanager_p.cpp | 318 +++++---------------- src/network/bearer/qnetworkconfigmanager_p.h | 70 +---- src/network/bearer/qnetworkconfiguration_p.h | 3 +- src/network/bearer/qnetworksessionengine.cpp | 11 + src/network/bearer/qnetworksessionengine_p.h | 23 +- src/plugins/bearer/generic/qgenericengine.cpp | 149 ++++++---- src/plugins/bearer/generic/qgenericengine.h | 4 +- .../bearer/networkmanager/qnmwifiengine.cpp | 8 +- src/plugins/bearer/networkmanager/qnmwifiengine.h | 4 +- 10 files changed, 266 insertions(+), 390 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 02cc652..6c0b17d 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -45,6 +45,7 @@ #include "qnetworkconfigmanager_s60_p.h" #else #include "qnetworkconfigmanager_p.h" +#include "qnetworksessionengine_p.h" #endif QT_BEGIN_NAMESPACE @@ -234,28 +235,31 @@ QList QNetworkConfigurationManager::allConfigurations(QNe { QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - - //find all InternetAccessPoints - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - result << pt; + + foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + QStringList cpsIdents = engine->accessPointConfigurations.keys(); + + //find all InternetAccessPoints + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + engine->accessPointConfigurations.value(ii); + if ((p->state & filter) == filter) { + QNetworkConfiguration pt; + pt.d = engine->accessPointConfigurations.value(ii); + result << pt; + } } - } - //find all service networks - cpsIdents = conPriv->snapConfigurations.keys(); - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->snapConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->snapConfigurations.value(ii); - result << pt; + //find all service networks + cpsIdents = engine->snapConfigurations.keys(); + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + engine->snapConfigurations.value(ii); + if ((p->state & filter) == filter) { + QNetworkConfiguration pt; + pt.d = engine->snapConfigurations.value(ii); + result << pt; + } } } @@ -271,15 +275,23 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString& identifier) const { QNetworkConfigurationManagerPrivate* conPriv = connManager(); + QNetworkConfiguration item; - if (conPriv->accessPointConfigurations.contains(identifier)) - item.d = conPriv->accessPointConfigurations.value(identifier); - else if (conPriv->snapConfigurations.contains(identifier)) - item.d = conPriv->snapConfigurations.value(identifier); - else if (conPriv->userChoiceConfigurations.contains(identifier)) - item.d = conPriv->userChoiceConfigurations.value(identifier); - return item; + foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + if (engine->accessPointConfigurations.contains(identifier)) + item.d = engine->accessPointConfigurations.value(identifier); + else if (engine->snapConfigurations.contains(identifier)) + item.d = engine->snapConfigurations.value(identifier); + else if (engine->userChoiceConfigurations.contains(identifier)) + item.d = engine->userChoiceConfigurations.value(identifier); + else + continue; + + return item; + } + + return item; } /*! diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index f8e0d7b..09714e5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -53,50 +53,34 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) +QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() +{ + while (!sessionEngines.isEmpty()) + delete sessionEngines.takeFirst(); +} + void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() { capFlags = QNetworkConfigurationManager::ForcedRoaming; } -void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine) +void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { - QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); - - ptr.data()->isValid = cpPriv->isValid; - ptr.data()->name = cpPriv->name; - ptr.data()->id = cpPriv->id; - ptr.data()->state = cpPriv->state; - ptr.data()->type = cpPriv->type; - ptr.data()->roamingSupported = cpPriv->roamingSupported; - ptr.data()->purpose = cpPriv->purpose; - ptr.data()->internet = cpPriv->internet; - - accessPointConfigurations.insert(cpPriv->id, ptr); - configurationEngine.insert(cpPriv->id, engine); - if (!firstUpdate) { QNetworkConfiguration item; item.d = ptr; emit configurationAdded(item); } - if (ptr.data()->state == QNetworkConfiguration::Active) { + if (ptr->state == QNetworkConfiguration::Active) { ++onlineConfigurations; if (!firstUpdate && onlineConfigurations == 1) emit onlineStateChanged(true); } } -void QNetworkConfigurationManagerPrivate::configurationRemoved(const QString &id) +void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr) { - if (!accessPointConfigurations.contains(id)) - return; - - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.take(id); - - configurationEngine.remove(id); - ptr.data()->isValid = false; if (!firstUpdate) { @@ -112,57 +96,34 @@ void QNetworkConfigurationManagerPrivate::configurationRemoved(const QString &id } } -void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *cpPriv) +void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr) { - if (!accessPointConfigurations.contains(cpPriv->id)) - return; - - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.value(cpPriv->id); - - if (ptr.data()->isValid != cpPriv->isValid || - ptr.data()->name != cpPriv->name || - ptr.data()->id != cpPriv->id || - ptr.data()->state != cpPriv->state || - ptr.data()->type != cpPriv->type || - ptr.data()->roamingSupported != cpPriv->roamingSupported || - ptr.data()->purpose != cpPriv->purpose || - ptr.data()->internet != cpPriv->internet) { - - const QNetworkConfiguration::StateFlags oldState = ptr.data()->state; - - ptr.data()->isValid = cpPriv->isValid; - ptr.data()->name = cpPriv->name; - ptr.data()->id = cpPriv->id; - ptr.data()->state = cpPriv->state; - ptr.data()->type = cpPriv->type; - ptr.data()->roamingSupported = cpPriv->roamingSupported; - ptr.data()->purpose = cpPriv->purpose; - ptr.data()->internet = cpPriv->internet; + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationChanged(item); + } - if (!firstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationChanged(item); - } + qDebug() << "Need to recalculate online state."; + QNetworkConfiguration::StateFlags oldState = ptr->state; - if (ptr.data()->state == QNetworkConfiguration::Active && oldState != ptr.data()->state) { - // configuration went online - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } else if (ptr.data()->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { - // configuration went offline - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + if (ptr->state == QNetworkConfiguration::Active && oldState != ptr->state) { + // configuration went online + ++onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 1) + emit onlineStateChanged(true); + } else if (ptr->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { + // configuration went offline + --onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 0) + emit onlineStateChanged(false); } } void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() { - if (!snapConfigurations.contains(QLatin1String("Internet Service Network"))) { +#if 0 + if (!generic->snapConfigurations.contains(QLatin1String("Internet Service Network"))) { QNetworkConfigurationPrivate *serviceNetwork = new QNetworkConfigurationPrivate; serviceNetwork->name = tr("Internet"); serviceNetwork->isValid = true; @@ -172,7 +133,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() QExplicitlySharedDataPointer ptr(serviceNetwork); - snapConfigurations.insert(serviceNetwork->id, ptr); + generic->snapConfigurations.insert(serviceNetwork->id, ptr); if (!firstUpdate) { QNetworkConfiguration item; @@ -182,15 +143,15 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() } QExplicitlySharedDataPointer ptr = - snapConfigurations.value(QLatin1String("Internet Service Network")); + generic->snapConfigurations.value(QLatin1String("Internet Service Network")); QList > serviceNetworkMembers; QHash >::const_iterator i = - accessPointConfigurations.constBegin(); + generic->accessPointConfigurations.constBegin(); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; - while (i != accessPointConfigurations.constEnd()) { + while (i != generic->accessPointConfigurations.constEnd()) { QExplicitlySharedDataPointer child = i.value(); if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) @@ -212,186 +173,92 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() item.d = ptr; emit configurationChanged(item); } +#endif } void QNetworkConfigurationManagerPrivate::updateConfigurations() { if (firstUpdate) { - updateState = NotUpdating; onlineConfigurations = 0; QFactoryLoader *l = loader(); QStringList keys = l->keys(); -#if defined (Q_OS_DARWIN) - coreWifi = 0; if (keys.contains(QLatin1String("corewlan"))) { QBearerEnginePlugin *coreWlanPlugin = qobject_cast(l->instance(QLatin1String("corewlan"))); if (coreWlanPlugin) { - coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); + QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); if (coreWifi) { - connect(coreWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(coreWifi); } } } -#else -#ifdef BACKEND_NM - nmWifi = 0; + if (keys.contains(QLatin1String("networkmanager"))) { QBearerEnginePlugin *nmPlugin = qobject_cast(l->instance(QLatin1String("networkmanager"))); if (nmPlugin) { - nmWifi = nmPlugin->create(QLatin1String("networkmanager")); + QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); if (nmWifi) { - connect(nmWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nmWifi); } } } -#endif - generic = 0; if (keys.contains(QLatin1String("generic"))) { QBearerEnginePlugin *genericPlugin = qobject_cast(l->instance(QLatin1String("generic"))); if (genericPlugin) { - generic = genericPlugin->create(QLatin1String("generic")); + QNetworkSessionEngine *generic = genericPlugin->create(QLatin1String("generic")); if (generic) { - connect(generic, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(generic); + connect(generic, SIGNAL(updateCompleted()), + this, SIGNAL(configurationUpdateComplete())); + connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(generic, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } -#endif -#ifdef Q_OS_WIN - nla = 0; if (keys.contains(QLatin1String("nla"))) { QBearerEnginePlugin *nlaPlugin = qobject_cast(l->instance(QLatin1String("nla"))); if (nlaPlugin) { - qDebug() << "creating nla backend"; - nla = nlaPlugin->create(QLatin1String("nla")); + QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); if (nla) { - connect(nla, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nla); } } } -#endif -#ifdef Q_OS_WIN32 - nativeWifi = 0; if (keys.contains(QLatin1String("nativewifi"))) { QBearerEnginePlugin *nativeWifiPlugin = qobject_cast(l->instance(QLatin1String("nativewifi"))); if (nativeWifiPlugin) { - qDebug() << "Creating native wifi backend"; - nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); + QNetworkSessionEngine *nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); if (nativeWifi) { - connect(nativeWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nativeWifi); capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; } } } -#endif } QNetworkSessionEngine *engine = qobject_cast(sender()); - if (updateState & Updating && engine) { -#if defined (Q_OS_DARWIN) - if (engine == coreWifi) - updateState &= ~CoreWifiUpdating; -#else -#if defined(BACKEND_NM) - if (engine == nmWifi) - updateState &= ~NmUpdating; - if (engine == generic) - updateState &= ~GenericUpdating; -#else - if (engine == generic) - updateState &= ~GenericUpdating; -#endif -#endif - -#ifdef Q_OS_WIN - else if (engine == nla) - updateState &= ~NlaUpdating; -#ifdef Q_OS_WIN32 - else if (engine == nativeWifi) - updateState &= ~NativeWifiUpdating; -#endif -#endif - } - QList engines; - if (firstUpdate) { -#if defined (Q_OS_DARWIN) - if (coreWifi) - engines << coreWifi; -#else -#if defined(BACKEND_NM) - if (nmWifi) - engines << nmWifi; - if (generic) - engines << generic; -#else - if (generic) - engines << generic; -#endif -#endif - -#ifdef Q_OS_WIN - if (nla) - engines << nla; -#ifdef Q_OS_WIN32 - if (nativeWifi) - engines << nativeWifi; -#endif -#endif - } else if (engine) { - engines << engine; - } - - while (!engines.isEmpty()) { - engine = engines.takeFirst(); - - bool ok; - QList foundConfigurations = engine->getConfigurations(&ok); - - // Find removed configurations. - QList removedIdentifiers = configurationEngine.keys(); - for (int i = 0; i < foundConfigurations.count(); ++i) - removedIdentifiers.removeOne(foundConfigurations.at(i)->id); - - // Update or add configurations. - while (!foundConfigurations.isEmpty()) { - QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst(); - - if (accessPointConfigurations.contains(cpPriv->id)) - configurationChanged(cpPriv); - else - configurationAdded(cpPriv, engine); - - delete cpPriv; - } - - // Remove configurations. - while (!removedIdentifiers.isEmpty()) { - const QString id = removedIdentifiers.takeFirst(); - - if (configurationEngine.value(id) == engine) - configurationRemoved(id); - } + if (!updatingEngines.isEmpty() && engine) { + int index = sessionEngines.indexOf(engine); + if (index >= 0) + updatingEngines.remove(index); } - updateInternetServiceConfiguration(); - - if (updateState == Updating) { - updateState = NotUpdating; + if (updating && updatingEngines.isEmpty()) { + updating = false; emit configurationUpdateComplete(); } @@ -407,22 +274,25 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - QExplicitlySharedDataPointer firstActive; - QExplicitlySharedDataPointer firstDiscovered; + QNetworkConfigurationPrivatePointer firstActive; + QNetworkConfigurationPrivatePointer firstDiscovered; - QHash >::const_iterator i = - accessPointConfigurations.constBegin(); - while (i != accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivate *priv = i.value().data(); + foreach (QNetworkSessionEngine *engine, sessionEngines) { + QHash::const_iterator i = + engine->accessPointConfigurations.constBegin(); - if (!firstActive && priv->isValid && - (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) - firstActive = i.value(); - if (!firstDiscovered && priv->isValid && - (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) - firstDiscovered = i.value(); + while (i != engine->accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer priv = i.value(); - ++i; + if (!firstActive && priv->isValid && + (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) + firstActive = priv; + if (!firstDiscovered && priv->isValid && + (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) + firstDiscovered = priv; + + ++i; + } } QNetworkConfiguration item; @@ -437,42 +307,12 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() { - updateState = Updating; -#if defined (Q_OS_DARWIN) - if (coreWifi) { - updateState |= CoreWifiUpdating; - coreWifi->requestUpdate(); - } -#else -#if defined(BACKEND_NM) - if (nmWifi) { - updateState |= NmUpdating; - nmWifi->requestUpdate(); - } - if (generic) { - updateState |= GenericUpdating; - generic->requestUpdate(); - } -#else - if (generic) { - updateState |= GenericUpdating; - generic->requestUpdate(); - } -#endif -#endif -#ifdef Q_OS_WIN - if (nla) { - updateState |= NlaUpdating; - nla->requestUpdate(); - } -#endif + updating = true; -#ifdef Q_OS_WIN32 - if (nativeWifi) { - updateState |= NativeWifiUpdating; - nativeWifi->requestUpdate(); + for (int i = 0; i < sessionEngines.count(); ++i) { + updatingEngines.insert(i); + sessionEngines.at(i)->requestUpdate(); } -#endif } QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 95358bc..27a0252 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -56,20 +56,9 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfiguration_p.h" -#include -#include - QT_BEGIN_NAMESPACE -#ifdef BEARER_ENGINE class QNetworkSessionEngine; -class QGenericEngine; -class QNlaEngine; -class QNativeWifiEngine; -class QNmWifiEngine; -class QCoreWlanEngine; -#endif - class QNetworkConfigurationManagerPrivate : public QObject { @@ -82,22 +71,7 @@ public: updateConfigurations(); } - virtual ~QNetworkConfigurationManagerPrivate() - { - QList configIdents = snapConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - } + virtual ~QNetworkConfigurationManagerPrivate(); QNetworkConfiguration defaultConfiguration(); @@ -106,12 +80,6 @@ public: void performAsyncConfigurationUpdate(); - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; #ifdef BEARER_ENGINE QHash configurationEngine; #endif @@ -135,41 +103,21 @@ private: #endif #ifdef BEARER_ENGINE - QNetworkSessionEngine *generic; -#ifdef Q_OS_WIN - QNetworkSessionEngine *nla; -#ifndef Q_OS_WINCE - QNetworkSessionEngine *nativeWifi; -#endif -#endif -#ifdef BACKEND_NM - QNetworkSessionEngine *nmWifi; -#endif -#ifdef Q_OS_DARWIN - QNetworkSessionEngine *coreWifi; -#endif +public: + QList sessionEngines; +private: uint onlineConfigurations; - enum EngineUpdate { - NotUpdating = 0x00, - Updating = 0x01, - GenericUpdating = 0x02, - NlaUpdating = 0x04, - NativeWifiUpdating = 0x08, - NmUpdating = 0x20, - CoreWifiUpdating = 0x40, - }; - Q_DECLARE_FLAGS(EngineUpdateState, EngineUpdate) - - EngineUpdateState updateState; + bool updating; + QSet updatingEngines; #endif private Q_SLOTS: #ifdef BEARER_ENGINE - void configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine); - void configurationRemoved(const QString &id); - void configurationChanged(QNetworkConfigurationPrivate *cpPriv); + void configurationAdded(QNetworkConfigurationPrivatePointer ptr); + void configurationRemoved(QNetworkConfigurationPrivatePointer ptr); + void configurationChanged(QNetworkConfigurationPrivatePointer ptr); #endif }; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index f00bcfa..8e69248 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE +typedef QExplicitlySharedDataPointer QNetworkConfigurationPrivatePointer; class QNetworkConfigurationPrivate : public QSharedData { public: @@ -89,7 +90,7 @@ public: bool internet; #endif - QList > serviceNetworkMembers; + QList serviceNetworkMembers; QNetworkInterface serviceInterface; private: diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 9e6839e..0aa9d19 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -50,6 +50,17 @@ QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) QNetworkSessionEngine::~QNetworkSessionEngine() { + foreach (const QString &oldIface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } } #include "moc_qnetworksessionengine_p.cpp" diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 9fbd4ac..0145976 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -53,14 +53,19 @@ // We mean it. // +#include "qnetworkconfiguration_p.h" + #include #include #include #include +#include +#include QT_BEGIN_NAMESPACE -class QNetworkConfigurationPrivate; +class QNetworkConfiguration; + class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject { Q_OBJECT @@ -76,7 +81,6 @@ public: QNetworkSessionEngine(QObject *parent = 0); virtual ~QNetworkSessionEngine(); - virtual QList getConfigurations(bool *ok = 0) = 0; virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; @@ -87,8 +91,21 @@ public: virtual void requestUpdate() = 0; +public: + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash accessPointConfigurations; + QHash snapConfigurations; + QHash userChoiceConfigurations; + Q_SIGNALS: - void configurationsChanged(); + void configurationAdded(QNetworkConfigurationPrivatePointer config); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); + void configurationChanged(QNetworkConfigurationPrivatePointer config); + + void updateCompleted(); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 4be27ba..11dfb3e 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -125,21 +125,58 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); + doRequestUpdate(); } QGenericEngine::~QGenericEngine() { } -QList QGenericEngine::getConfigurations(bool *ok) +QString QGenericEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QGenericEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QGenericEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QGenericEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::requestUpdate() { - if (ok) - *ok = true; + pollTimer.stop(); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} - QList foundConfigurations; +QGenericEngine *QGenericEngine::instance() +{ + return genericEngine(); +} +void QGenericEngine::doRequestUpdate() +{ // Immediately after connecting with a wireless access point // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a // second time results in a non-empty list. If we loose interfaces we will end up removing @@ -148,6 +185,8 @@ QList QGenericEngine::getConfigurations(bool *ok if (interfaces.isEmpty()) interfaces = QNetworkInterface::allInterfaces(); + QStringList previous = accessPointConfigurations.keys(); + // create configuration for each interface while (!interfaces.isEmpty()) { QNetworkInterface interface = interfaces.takeFirst(); @@ -163,71 +202,77 @@ QList QGenericEngine::getConfigurations(bool *ok if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) continue; - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - uint identifier; if (interface.index()) - identifier = qHash(QLatin1String("NLA:") + QString::number(interface.index())); + identifier = qHash(QLatin1String("generic:") + QString::number(interface.index())); else - identifier = qHash(QLatin1String("NLA:") + interface.hardwareAddress()); + identifier = qHash(QLatin1String("generic:") + interface.hardwareAddress()); + + const QString id = QString::number(identifier); - cpPriv->id = QString::number(identifier); - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + previous.removeAll(id); + + QString name = interface.humanReadableName(); + if (name.isEmpty()) + name = interface.name(); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Discovered; if (interface.flags() & QNetworkInterface::IsUp) - cpPriv->state |= QNetworkConfiguration::Active; + state |= QNetworkConfiguration::Active; - configurationInterface[identifier] = interface.name(); + if (accessPointConfigurations.contains(id)) { + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.value(id); - foundConfigurations.append(cpPriv); - } + bool changed = false; - pollTimer.start(); + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } - return foundConfigurations; -} + if (ptr->name != name) { + ptr->name = name; + changed = true; + } -QString QGenericEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id.toUInt()); -} + if (ptr->id != id) { + ptr->id = id; + changed = true; + } -bool QGenericEngine::hasIdentifier(const QString &id) -{ - return configurationInterface.contains(id.toUInt()); -} + if (ptr->state != state) { + ptr->state = state; + changed = true; + } -QString QGenericEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); + if (changed) + emit configurationChanged(ptr); + } else { + QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); - if (interface.isEmpty()) - return QString(); + ptr->name = name; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; - return qGetInterfaceType(interface); -} + accessPointConfigurations.insert(id, ptr); -void QGenericEngine::connectToId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} + emit configurationAdded(ptr); + } + } -void QGenericEngine::disconnectFromId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} + while (!previous.isEmpty()) { + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.take(previous.takeFirst()); -void QGenericEngine::requestUpdate() -{ - emit configurationsChanged(); -} + emit configurationRemoved(ptr); + } -QGenericEngine *QGenericEngine::instance() -{ - return genericEngine(); + pollTimer.start(); + + emit updateCompleted(); } QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 9923a9b..62f964a 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -59,7 +59,6 @@ public: QGenericEngine(QObject *parent = 0); ~QGenericEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -72,6 +71,9 @@ public: static QGenericEngine *instance(); +private Q_SLOTS: + void doRequestUpdate(); + private: QMap configurationInterface; QTimer pollTimer; diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp index 4a814ec..b215023 100644 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp @@ -112,7 +112,7 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d } -QList QNmWifiEngine::getConfigurations(bool *ok) +QList QNmWifiEngine::getConfigurations(bool *ok) { // qWarning() << Q_FUNC_INFO << updated; if (ok) @@ -133,7 +133,7 @@ QList QNmWifiEngine::getConfigurations(bool *ok) //add access points updated = true; } - return foundConfigurations; + return QList(); //foundConfigurations; } void QNmWifiEngine::findConnections() @@ -411,7 +411,7 @@ bool QNmWifiEngine::hasIdentifier(const QString &id) { if (configurationInterface.contains(id)) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { + foreach (QNetworkConfigurationPrivatePointer cpPriv, getConfigurations()) { if (cpPriv->id == id) return true; } @@ -506,7 +506,7 @@ void QNmWifiEngine::requestUpdate() updated = false; knownSsids.clear(); availableAccessPoints.clear(); - emitConfigurationsChanged(); + //emitConfigurationsChanged(); } QNmWifiEngine *QNmWifiEngine::instance() diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.h b/src/plugins/bearer/networkmanager/qnmwifiengine.h index 4d514e7..d651ef4 100644 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.h +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.h @@ -80,7 +80,7 @@ public: QNmWifiEngine(QObject *parent = 0); ~QNmWifiEngine(); - QList getConfigurations(bool *ok = 0); + QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -94,7 +94,7 @@ public: static QNmWifiEngine *instance(); QStringList knownSsids; - inline void emitConfigurationsChanged() { emit configurationsChanged(); } + //inline void emitConfigurationsChanged() { emit configurationsChanged(); } QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); QStringList getConnectionPathForId(const QString &uuid); -- cgit v0.12 From ee8b1156400791a077280138863336ea93a774a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 9 Dec 2009 16:49:06 +1000 Subject: Keep track of which QNetworkInterface is for each QNetworkConfiguration. --- src/plugins/bearer/generic/qgenericengine.cpp | 6 ++++-- src/plugins/bearer/generic/qgenericengine.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 11dfb3e..e70d23d 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -136,12 +136,12 @@ QGenericEngine::~QGenericEngine() QString QGenericEngine::getInterfaceFromId(const QString &id) { - return configurationInterface.value(id.toUInt()); + return configurationInterface.value(id); } bool QGenericEngine::hasIdentifier(const QString &id) { - return configurationInterface.contains(id.toUInt()); + return configurationInterface.contains(id); } QString QGenericEngine::bearerName(const QString &id) @@ -258,6 +258,7 @@ void QGenericEngine::doRequestUpdate() ptr->type = QNetworkConfiguration::InternetAccessPoint; accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interface.name()); emit configurationAdded(ptr); } @@ -267,6 +268,7 @@ void QGenericEngine::doRequestUpdate() QExplicitlySharedDataPointer ptr = accessPointConfigurations.take(previous.takeFirst()); + configurationInterface.remove(ptr->id); emit configurationRemoved(ptr); } diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 62f964a..32d762d 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -75,7 +75,7 @@ private Q_SLOTS: void doRequestUpdate(); private: - QMap configurationInterface; + QMap configurationInterface; QTimer pollTimer; }; -- cgit v0.12 From 7858758772ad01e6a772cb048e4f1eda7f4ec9c3 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 9 Dec 2009 15:44:52 +1000 Subject: Rework NetworkManager backend. --- src/network/bearer/qnetworkconfigmanager.cpp | 2 + src/network/bearer/qnetworkconfigmanager_p.cpp | 47 +- src/network/bearer/qnetworkconfigmanager_p.h | 5 +- src/network/bearer/qnetworksession_p.cpp | 30 +- src/network/bearer/qnetworksessionengine_p.h | 3 + src/plugins/bearer/generic/qgenericengine.cpp | 26 +- src/plugins/bearer/generic/qgenericengine.h | 2 + src/plugins/bearer/networkmanager/main.cpp | 4 +- .../bearer/networkmanager/networkmanager.pro | 4 +- .../networkmanager/qnetworkmanagerengine.cpp | 654 ++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 125 +++ .../networkmanager/qnetworkmanagerservice.cpp | 6 +- .../bearer/networkmanager/qnetworkmanagerservice.h | 4 +- .../bearer/networkmanager/qnmdbushelper.cpp | 3 + src/plugins/bearer/networkmanager/qnmdbushelper.h | 14 - .../bearer/networkmanager/qnmwifiengine.cpp | 1128 -------------------- src/plugins/bearer/networkmanager/qnmwifiengine.h | 165 --- 17 files changed, 863 insertions(+), 1359 deletions(-) create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerengine.h delete mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.cpp delete mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.h diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 6c0b17d..6b73e3c 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -48,6 +48,8 @@ #include "qnetworksessionengine_p.h" #endif +#include + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 09714e5..6f833f3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -73,15 +73,15 @@ void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurati } if (ptr->state == QNetworkConfiguration::Active) { - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) + onlineConfigurations.insert(ptr); + if (!firstUpdate && onlineConfigurations.count() == 1) emit onlineStateChanged(true); } } void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr) { - ptr.data()->isValid = false; + ptr->isValid = false; if (!firstUpdate) { QNetworkConfiguration item; @@ -89,11 +89,9 @@ void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigura emit configurationRemoved(item); } - if (ptr.data()->state == QNetworkConfiguration::Active) { - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + onlineConfigurations.remove(ptr); + if (!firstUpdate && onlineConfigurations.isEmpty()) + emit onlineStateChanged(false); } void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr) @@ -104,20 +102,17 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura emit configurationChanged(item); } - qDebug() << "Need to recalculate online state."; - QNetworkConfiguration::StateFlags oldState = ptr->state; + bool previous = !onlineConfigurations.isEmpty(); - if (ptr->state == QNetworkConfiguration::Active && oldState != ptr->state) { - // configuration went online - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } else if (ptr->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { - // configuration went offline - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + if (ptr->state == QNetworkConfiguration::Active) + onlineConfigurations.insert(ptr); + else + onlineConfigurations.remove(ptr); + + bool online = !onlineConfigurations.isEmpty(); + + if (!firstUpdate && online != previous) + emit onlineStateChanged(online); } void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() @@ -179,7 +174,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() void QNetworkConfigurationManagerPrivate::updateConfigurations() { if (firstUpdate) { - onlineConfigurations = 0; + updating = false; QFactoryLoader *l = loader(); QStringList keys = l->keys(); @@ -202,6 +197,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); if (nmWifi) { sessionEngines.append(nmWifi); + connect(nmWifi, SIGNAL(updateCompleted()), + this, SIGNAL(configurationUpdateComplete())); + connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nmWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 27a0252..37e88d3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -80,9 +80,6 @@ public: void performAsyncConfigurationUpdate(); -#ifdef BEARER_ENGINE - QHash configurationEngine; -#endif bool firstUpdate; public slots: @@ -107,7 +104,7 @@ public: QList sessionEngines; private: - uint onlineConfigurations; + QSet onlineConfigurations; bool updating; QSet updatingEngines; diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index df0ad3e..8421fbc 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -56,9 +56,10 @@ static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - QNetworkSessionEngine *engine = priv->configurationEngine.value(id); - if (engine && engine->hasIdentifier(id)) - return engine; + foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { + if (engine->hasIdentifier(id)) + return engine; + } return 0; } @@ -104,6 +105,7 @@ void QNetworkSessionPrivate::syncStateWithInterface() this, SLOT(forcedSessionClose(QNetworkConfiguration))); opened = false; + isActive = false; state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; @@ -341,6 +343,7 @@ void QNetworkSessionPrivate::updateStateFromServiceNetwork() } state = QNetworkSession::Connected; + qDebug() << oldState << "->" << state; if (state != oldState) emit q->stateChanged(state); @@ -352,31 +355,22 @@ void QNetworkSessionPrivate::updateStateFromServiceNetwork() else state = QNetworkSession::Disconnected; + qDebug() << oldState << "->" << state; if (state != oldState) emit q->stateChanged(state); } void QNetworkSessionPrivate::updateStateFromActiveConfig() { - QNetworkSession::State oldState = state; + if (!engine) + return; - bool newActive = false; + QNetworkSession::State oldState = state; - if (!activeConfig.isValid()) { - state = QNetworkSession::Invalid; - } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Connected; - newActive = opened; - } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Disconnected; - } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { - state = QNetworkSession::NotAvailable; - } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { - state = QNetworkSession::NotAvailable; - } + state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isActive; - isActive = newActive; + isActive = (state == QNetworkSession::Connected) ? opened : false; if (!oldActive && isActive) emit quitPendingWaitsForOpened(); diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 0145976..a698c40 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -54,6 +54,7 @@ // #include "qnetworkconfiguration_p.h" +#include "qnetworksession.h" #include #include @@ -91,6 +92,8 @@ public: virtual void requestUpdate() = 0; + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index e70d23d..339ef9c 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -249,7 +249,7 @@ void QGenericEngine::doRequestUpdate() if (changed) emit configurationChanged(ptr); } else { - QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); ptr->name = name; ptr->isValid = true; @@ -277,5 +277,29 @@ void QGenericEngine::doRequestUpdate() emit updateCompleted(); } +QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 32d762d..9359d7f 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -69,6 +69,8 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + static QGenericEngine *instance(); private Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index d4b74a1..b561415 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qnmwifiengine.h" +#include "qnetworkmanagerengine.h" #include @@ -73,7 +73,7 @@ QStringList QNetworkManagerEnginePlugin::keys() const QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const { if (key == QLatin1String("networkmanager")) - return new QNmWifiEngine; + return new QNetworkManagerEngine; else return 0; } diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 36d150a..79c68ea 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -7,12 +7,12 @@ DEFINES += BEARER_ENGINE BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ - qnmwifiengine.h + qnetworkmanagerengine.h SOURCES += main.cpp \ qnmdbushelper.cpp \ qnetworkmanagerservice.cpp \ - qnmwifiengine.cpp + qnetworkmanagerengine.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp new file mode 100644 index 0000000..3de20a3 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -0,0 +1,654 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworkmanagerengine.h" +#include "qnetworkmanagerservice.h" + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) +: QNetworkSessionEngine(parent), + interface(new QNetworkManagerInterface(this)), + systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), + userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) +{ + interface->setConnections(); + connect(interface, SIGNAL(deviceAdded(QDBusObjectPath)), + this, SLOT(deviceAdded(QDBusObjectPath))); + connect(interface, SIGNAL(deviceRemoved(QDBusObjectPath)), + this, SLOT(deviceRemoved(QDBusObjectPath))); +#if 0 + connect(interface, SIGNAL(stateChanged(const QString,quint32)), + this, SIGNAL(configurationsChanged())); +#endif + connect(interface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(activationFinished(QDBusPendingCallWatcher*))); + connect(interface, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(interfacePropertiesChanged(QString,QMap))); + + qDBusRegisterMetaType(); + + systemSettings->setConnections(); + connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)), + this, SLOT(newConnection(QDBusObjectPath))); + + userSettings->setConnections(); + connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)), + this, SLOT(newConnection(QDBusObjectPath))); + + // Get current list of access points. + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) + deviceAdded(devicePath); + + // Get connections. + foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) + newConnection(settingsPath, systemSettings); + foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) + newConnection(settingsPath, userSettings); + + // Get active connections. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive *activeConnection = + new QNetworkManagerConnectionActive(acPath.path()); + activeConnections.insert(acPath.path(), activeConnection); + + activeConnection->setConnections(); + connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(activeConnectionPropertiesChanged(QString,QMap))); + } +} + +QNetworkManagerEngine::~QNetworkManagerEngine() +{ +} + +void QNetworkManagerEngine::doRequestUpdate() +{ +} + +QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) +{ + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + if (id == identifier) { + QList devices = activeConnection.devices(); + + if (devices.isEmpty()) + continue; + + if (devices.count() > 1) + qDebug() << "multiple network interfaces for" << id; + + QNetworkManagerInterfaceDevice device(devices.at(0).path()); + return device.interface().name(); + } + } + + return QString(); +} + +bool QNetworkManagerEngine::hasIdentifier(const QString &id) +{ + if (connectionFromId(id)) + return true; + + for (int i = 0; i < accessPoints.count(); ++i) { + QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); + + const QString identifier = + QString::number(qHash(accessPoint->connectionInterface()->path())); + + if (id == identifier) + return true; + } + + return false; +} + +QString QNetworkManagerEngine::bearerName(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + + if (!connection) + return QString(); + + QNmSettingsMap map = connection->getSettings(); + const QString connectionType = map.value("connection").value("type").toString(); + + if (connectionType == "802-3-ethernet") + return QLatin1String("Ethernet"); + else if (connectionType == "802-11-wireless") + return QLatin1String("WLAN"); + else if (connectionType == "gsm") + return QLatin1String("2G"); + else if (connectionType == "cdma") + return QLatin1String("CDMA2000"); + else + return QString(); +} + +void QNetworkManagerEngine::connectToId(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + + if (!connection) + return; + + QNmSettingsMap map = connection->getSettings(); + const QString connectionType = map.value("connection").value("type").toString(); + + QString dbusDevicePath; + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + QNetworkManagerInterfaceDevice device(devicePath.path()); + if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET && + connectionType == QLatin1String("802-3-ethernet")) { + dbusDevicePath = devicePath.path(); + break; + } else if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS && + connectionType == QLatin1String("802-11-wireless")) { + dbusDevicePath = devicePath.path(); + break; + } + } + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + interface->activateConnection(service, QDBusObjectPath(settingsPath), + QDBusObjectPath(dbusDevicePath), QDBusObjectPath("/")); +} + +void QNetworkManagerEngine::disconnectFromId(const QString &id) +{ + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + if (id == identifier && accessPointConfigurations.contains(id)) { + interface->deactivateConnection(acPath); + break; + } + } +} + +void QNetworkManagerEngine::requestUpdate() +{ + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, + const QMap &properties) +{ + QMapIterator i(properties); + while (i.hasNext()) { + i.next(); + + if (i.key() == QLatin1String("ActiveConnections")) { + // Active connections changed, update configurations. + + QList activeConnections = + qdbus_cast >(i.value().value()); + + QStringList identifiers = accessPointConfigurations.keys(); + foreach (const QString &id, identifiers) + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + QStringList priorActiveConnections = this->activeConnections.keys(); + + foreach (const QDBusObjectPath &acPath, activeConnections) { + priorActiveConnections.removeOne(acPath.path()); + QNetworkManagerConnectionActive *activeConnection = + this->activeConnections.value(acPath.path()); + if (!activeConnection) { + activeConnection = new QNetworkManagerConnectionActive(acPath.path()); + this->activeConnections.insert(acPath.path(), activeConnection); + + activeConnection->setConnections(); + connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(activeConnectionPropertiesChanged(QString,QMap))); + } + + const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + identifiers.removeOne(id); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection->state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } + } + + while (!priorActiveConnections.isEmpty()) + delete this->activeConnections.take(priorActiveConnections.takeFirst()); + + while (!identifiers.isEmpty()) { + // These configurations are not active + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(identifiers.takeFirst()); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + } + } + } + } +} + +void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, + const QMap &properties) +{ + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); + + if (!activeConnection) + return; + + const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection->state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } +} + +void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) +{ + QNetworkManagerInterfaceDevice device(path.path()); + if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + QNetworkManagerInterfaceDeviceWireless *wirelessDevice = + new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path()); + wirelessDevices.insert(path.path(), wirelessDevice); + + wirelessDevice->setConnections(); + connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)), + this, SLOT(newAccessPoint(QString,QDBusObjectPath))); + connect(wirelessDevice, SIGNAL(accessPointRemoved(QString,QDBusObjectPath)), + this, SLOT(removeAccessPoint(QString,QDBusObjectPath))); + connect(wirelessDevice, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(devicePropertiesChanged(QString,QMap))); + + foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints()) + newAccessPoint(QString(), apPath); + } +} + +void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path) +{ + delete wirelessDevices.value(path.path()); +} + +void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, + QNetworkManagerSettings *settings) +{ + if (!settings) + settings = qobject_cast(sender()); + + if (!settings) + return; + + QNetworkManagerSettingsConnection *connection = + new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(), + path.path()); + connections.append(connection); + + connect(connection, SIGNAL(removed(QString)), this, SLOT(removeConnection(QString))); + connect(connection, SIGNAL(updated(const QNmSettingsMap&)), + this, SLOT(updateConnection(const QNmSettingsMap&))); + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + QNetworkConfigurationPrivate *cpPriv = + parseConnection(service, settingsPath, connection->getSettings()); + + // Check if connection is active. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + if (activeConnection.serviceName() == service && + activeConnection.connection().path() == settingsPath && + activeConnection.state() == 2) { + cpPriv->state |= QNetworkConfiguration::Active; + break; + } + } + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); +} + +void QNetworkManagerEngine::removeConnection(const QString &path) +{ + QNetworkManagerSettingsConnection *connection = + qobject_cast(sender()); + if (!connection) + return; + + connections.removeAll(connection); + + const QString id = QString::number(qHash(connection->connectionInterface()->service() + ' ' + + connection->connectionInterface()->path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); + ptr->isValid = false; + emit configurationRemoved(ptr); +} + +void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) +{ + QNetworkManagerSettingsConnection *connection = + qobject_cast(sender()); + if (!connection) + return; + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + qDebug() << "Should parse connection directly into existing configuration"; + QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings); + + // Check if connection is active. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + if (activeConnection.serviceName() == service && + activeConnection.connection().path() == settingsPath && + activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + cpPriv->state |= QNetworkConfiguration::Active; + break; + } + } + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id); + + ptr->isValid = cpPriv->isValid; + ptr->name = cpPriv->name; + ptr->id = cpPriv->id; + ptr->state = cpPriv->state; + + emit configurationChanged(ptr); + delete cpPriv; +} + +void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) +{ + QDBusPendingReply reply = *watcher; + if (reply.isError()) { + qDebug() << "error connecting NM connection"; + } else { + QDBusObjectPath result = reply.value(); + + QNetworkManagerConnectionActive activeConnection(result.path()); + + const QString id = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection.state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } + } +} + +void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) +{ + QNetworkManagerInterfaceAccessPoint *accessPoint = + new QNetworkManagerInterfaceAccessPoint(objectPath.path()); + accessPoints.append(accessPoint); + + accessPoint->setConnections(); + connect(accessPoint, SIGNAL(propertiesChanged(QMap)), + this, SLOT(updateAccessPoint(QMap))); + + // Check if configuration for this SSID already exists. + for (int i = 0; i < accessPoints.count(); ++i) { + if (accessPoint != accessPoints.at(i) && + accessPoint->ssid() == accessPoints.at(i)->ssid()) { + return; + } + } + + // Check if configuration exists for connection. + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } + } + + // New access point. + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = accessPoint->ssid(); + ptr->isValid = true; + ptr->id = QString::number(qHash(objectPath.path())); + ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->purpose = QNetworkConfiguration::PublicPurpose; + ptr->state = QNetworkConfiguration::Undefined; + + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); +} + +void QNetworkManagerEngine::removeAccessPoint(const QString &path, + const QDBusObjectPath &objectPath) +{ + for (int i = 0; i < accessPoints.count(); ++i) { + QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); + + if (accessPoint->connectionInterface()->path() == objectPath.path()) { + accessPoints.removeOne(accessPoint); + + if (configuredAccessPoints.contains(accessPoint)) { + // find connection and change state to Defined + configuredAccessPoints.removeOne(accessPoint); + qDebug() << "At least one connection is no longer discovered."; + } else { + // emit configurationRemoved(cpPriv); + qDebug() << "An unconfigured wifi access point was removed."; + } + + break; + } + } +} + +void QNetworkManagerEngine::updateAccessPoint(const QMap &map) +{ + QNetworkManagerInterfaceAccessPoint *accessPoint = + qobject_cast(sender()); + if (!accessPoint) + return; + + qDebug() << "update access point" << accessPoint; +} + +QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &service, + const QString &settingsPath, + const QNmSettingsMap &map) +{ + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + cpPriv->name = map.value("connection").value("id").toString(); + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(service + ' ' + settingsPath)); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + + cpPriv->state = QNetworkConfiguration::Defined; + + const QString connectionType = map.value("connection").value("type").toString(); + + if (connectionType == QLatin1String("802-3-ethernet")) { + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + QNetworkManagerInterfaceDevice device(devicePath.path()); + if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET) { + QNetworkManagerInterfaceDeviceWired wiredDevice(device.connectionInterface()->path()); + if (wiredDevice.carrier()) { + cpPriv->state |= QNetworkConfiguration::Discovered; + break; + } + + } + } + } else if (connectionType == QLatin1String("802-11-wireless")) { + const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString(); + + for (int i = 0; i < accessPoints.count(); ++i) { + if (connectionSsid == accessPoints.at(i)->ssid()) { + cpPriv->state |= QNetworkConfiguration::Discovered; + if (!configuredAccessPoints.contains(accessPoints.at(i))) { + configuredAccessPoints.append(accessPoints.at(i)); + + const QString accessPointId = + QString::number(qHash(accessPoints.at(i)->connectionInterface()->path())); + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(accessPointId); + emit configurationRemoved(ptr); + } + break; + } + } + } + + return cpPriv; +} + +QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const +{ + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + const QString identifier = QString::number(qHash(service + ' ' + settingsPath)); + + if (id == identifier) + return connection; + } + + return 0; +} + +QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) + return QNetworkSession::Invalid; + + foreach (const QString &acPath, activeConnections.keys()) { + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(acPath); + + const QString identifier = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + if (id == identifier) { + switch (activeConnection->state()) { + case 0: + return QNetworkSession::Disconnected; + case 1: + return QNetworkSession::Connecting; + case 2: + return QNetworkSession::Connected; + } + } + } + + if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) + return QNetworkSession::Disconnected; + else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) + return QNetworkSession::NotAvailable; + else if ((ptr->state & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) + return QNetworkSession::NotAvailable; + + return QNetworkSession::Invalid; +} + +QT_END_NAMESPACE + diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h new file mode 100644 index 0000000..9e8af3b --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKMANAGERENGINE_P_H +#define QNETWORKMANAGERENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include "qnetworkmanagerservice.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkManagerEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNetworkManagerEngine(QObject *parent = 0); + ~QNetworkManagerEngine(); + + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + QNetworkSession::State sessionStateForId(const QString &id); + +private Q_SLOTS: + void interfacePropertiesChanged(const QString &path, + const QMap &properties); + void activeConnectionPropertiesChanged(const QString &path, + const QMap &properties); + + void deviceAdded(const QDBusObjectPath &path); + void deviceRemoved(const QDBusObjectPath &path); + + void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings = 0); + void removeConnection(const QString &path); + void updateConnection(const QNmSettingsMap &settings); + void activationFinished(QDBusPendingCallWatcher *watcher); + + void newAccessPoint(const QString &path, const QDBusObjectPath &objectPath); + void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath); + void updateAccessPoint(const QMap &map); + + void doRequestUpdate(); + +private: + QNetworkConfigurationPrivate *parseConnection(const QString &service, + const QString &settingsPath, + const QNmSettingsMap &map); + QNetworkManagerSettingsConnection *connectionFromId(const QString &id) const; + +private: + QNetworkManagerInterface *interface; + QNetworkManagerSettings *systemSettings; + QNetworkManagerSettings *userSettings; + QHash wirelessDevices; + QHash activeConnections; + QList connections; + QList accessPoints; + QList configuredAccessPoints; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index e95c2e6..9376324 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -95,6 +95,7 @@ QNetworkManagerInterface::~QNetworkManagerInterface() { delete d->connectionInterface; delete d; + delete nmDBusHelper; } bool QNetworkManagerInterface::isValid() @@ -692,9 +693,12 @@ bool QNetworkManagerSettingsConnection::setConnections() bool allOk = false; if(!dbusConnection.connect(d->service, d->path, - NM_DBUS_IFACE_SETTINGS_CONNECTION, "NewConnection", + NM_DBUS_IFACE_SETTINGS_CONNECTION, "Updated", this, SIGNAL(updated(QNmSettingsMap)))) { allOk = true; + } else { + QDBusError error = dbusConnection.lastError(); + qDebug() << error.name() << error.message() << error.type(); } nmDBusHelper = new QNmDBusHelper; diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index 8bed45b..dbed01e 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -329,8 +329,8 @@ public: Q_SIGNALS: - void updated(QMap< QString, QMap > s); - void removed(const QString &); + void updated(const QNmSettingsMap &settings); + void removed(const QString &path); private: QNmDBusHelper *nmDBusHelper; diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp index 1d16e55..f93a63d 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -96,11 +96,14 @@ void QNmDBusHelper::slotPropertiesChanged(QMap map) emit pathForPropertiesChanged( msg.path(), map); } } else if( i.key() == "ActiveAccessPoint") { + emit pathForPropertiesChanged(msg.path(), map); // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value().path(); // } else if( i.key() == "Strength") // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); // else // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); + } else if (i.key() == "ActiveConnections") { + emit pathForPropertiesChanged(msg.path(), map); } } } diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h index 9794f98..410b69f 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.h +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h @@ -42,25 +42,12 @@ #ifndef QNMDBUSHELPERPRIVATE_H #define QNMDBUSHELPERPRIVATE_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - #include #include #include QT_BEGIN_NAMESPACE -#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) - class QNmDBusHelper: public QObject, protected QDBusContext { Q_OBJECT @@ -80,7 +67,6 @@ Q_SIGNALS: void pathForPropertiesChanged(const QString &, QMap); void pathForSettingsRemoved(const QString &); }; -#endif QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp deleted file mode 100644 index b215023..0000000 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp +++ /dev/null @@ -1,1128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnmwifiengine.h" - -#include -#include - -#include - -#include -#include -#include "qnetworkmanagerservice.h" - -#include - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) -typedef QList > QNmSettingsAddressMap; - -Q_DECLARE_METATYPE(QNmSettingsAddressMap) - -QNmWifiEngine::QNmWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent) -{ - iface = new QNetworkManagerInterface(); - if(!iface->isValid()) { - return; - } - iface->setConnections(); - connect(iface,SIGNAL(deviceAdded(QDBusObjectPath)), - this,SLOT(addDevice(QDBusObjectPath))); - connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), - this,SLOT(removeDevice(QDBusObjectPath))); - - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - addDevice(path); - } - - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - settingsiface->setConnections(); - connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), - this,(SLOT(newConnection(QDBusObjectPath)))); - } - - updated = false; -} - -QNmWifiEngine::~QNmWifiEngine() -{ -} - -QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface) -{ - QString newname; - if (devIface->state() == NM_DEVICE_STATE_ACTIVATED) { - QString path = devIface->ip4config().path(); - QNetworkManagerIp4Config * ipIface; - ipIface = new QNetworkManagerIp4Config(path); - newname = ipIface->domains().join(" "); - } - //fallback to interface name - if(newname.isEmpty()) - newname = devIface->interface().name(); - return newname; -} - - -QList QNmWifiEngine::getConfigurations(bool *ok) -{ -// qWarning() << Q_FUNC_INFO << updated; - if (ok) - *ok = false; - - if(!updated) { - foundConfigurations.clear(); - if(knownSsids.isEmpty()) - getKnownSsids(); // list of ssids that have user configurations. - - scanForAccessPoints(); - getActiveConnectionsPaths(); - knownConnections(); - - accessPointConnections(); - -// findConnections(); - //add access points - updated = true; - } - return QList(); //foundConfigurations; -} - -void QNmWifiEngine::findConnections() -{ - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - - //// eth - switch (devIface->deviceType()) { -// qWarning() << devIface->connectionInterface()->path(); - - case DEVICE_TYPE_802_3_ETHERNET: - { - QString ident; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - - ident = devWiredIface->hwAddress(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = getNameForConfiguration(devIface); - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = devWiredIface->carrier(); - - cpPriv->serviceInterface = devIface->interface(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - switch (devIface->state()) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_FAILED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_UNAVAILABLE: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_DISCONNECTED: - { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Defined); - } - break; - case NM_DEVICE_STATE_ACTIVATED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); - break; - default: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - }; - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { -// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; -// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// -// //// connections -// QStringList connectionServices; -// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; -// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -// -// QString connPath; -// -// foreach (QString service, connectionServices) { -// QString ident; -// QNetworkManagerSettings *settingsiface; -// settingsiface = new QNetworkManagerSettings(service); -// QList list = settingsiface->listConnections(); -// -// foreach(QDBusObjectPath path, list) { //for each connection path -//qWarning() << path.path(); -// ident = path.path(); -// bool addIt = false; -// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -// cpPriv->isValid = true; -// cpPriv->id = ident; -// cpPriv->internet = true; -// -// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered -// | QNetworkConfiguration::Defined); -// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; -// -// QNetworkManagerSettingsConnection *sysIface; -// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// cpPriv->name = sysIface->getId();//ii.value().toString(); -//qWarning() << cpPriv->name; -// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// // get the wifi interface state first.. do we need this? -// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); -// } -// -// //#if 0 -// foreach(QString conpath, activeConnectionPaths) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// if( aConn->connection().path() == ident) { -// -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// QNetworkManagerInterfaceDevice *ifaceDevice; -// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); -// cpPriv->serviceInterface = ifaceDevice->interface(); -// cpPriv->state = getStateFlag(ifaceDevice->state()); -// //cpPriv->accessPoint = aConn->specificObject().path(); -// -// break; -// } -// } -// } -// //#endif -// // } //end while connection -// if(addIt) { -// foundConfigurations.append(cpPriv); -// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); -// } -// } -// } //end each connection service -// -// // ////////////// AccessPoints -//// QList apList = devWirelessIface->getAccessPoints(); -////// qWarning() << apList.count(); -//// foreach(QDBusObjectPath path, apList) { -//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); -//// if(cpPriv->isValid) { -//// foundConfigurations.append(cpPriv); -//// } -//// } - } // end DEVICE_TYPE_802_11_WIRELESS - break; - }; - } //end foreach device -} - -void QNmWifiEngine::knownConnections() -{ -// qWarning() << Q_FUNC_INFO; - //// connections - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - - QString connPath; - - foreach (QString service, connectionServices) { - QString ident; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - -// qWarning() <setConnections(); - connect(sysIface, SIGNAL(removed(QString)), - this,SLOT(settingsConnectionRemoved(QString))); - - cpPriv->name = sysIface->getId(); - cpPriv->isValid = true; - cpPriv->id = sysIface->getUuid(); -// cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -//qWarning() << cpPriv->name; - cpPriv->state = getStateForId(cpPriv->id); - - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - - if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { - QString mac = sysIface->getMacAddress(); - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; - QString devPath; - devPath = deviceConnectionPath(mac); - - // qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - cpPriv->internet = devWiredIface->carrier(); - - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_3_ETHERNET, cpPriv->id); - } - - cpPriv->internet = true;//sysIface->isAutoConnect(); - - addIt = true; - } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString mac = sysIface->getMacAddress();; - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; - QString devPath; - devPath = deviceConnectionPath(mac); -// qWarning() << Q_FUNC_INFO << devPath; - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); - } - // cpPriv->serviceInterface = devIface->interface(); - addIt = true; - // get the wifi interface state first.. do we need this? - // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - } - if(addIt) { - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } //end each connection service - } -} - -void QNmWifiEngine::accessPointConnections() -{ - //qWarning() << Q_FUNC_INFO; - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - QList apList = availableAccessPoints.uniqueKeys(); - - QList::const_iterator i; - for (i = apList.constBegin(); i != apList.constEnd(); ++i) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); - if(cpPriv->isValid) { - foundConfigurations.append(cpPriv); - // qWarning() << "adding" << cpPriv->name << "to things"; - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } - } - } -} - -QString QNmWifiEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id); -} - -bool QNmWifiEngine::hasIdentifier(const QString &id) -{ - if (configurationInterface.contains(id)) - return true; - foreach (QNetworkConfigurationPrivatePointer cpPriv, getConfigurations()) { - if (cpPriv->id == id) - return true; - } - return false; -} - -QString QNmWifiEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(interface == devIface->interface().name()) { - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: - return QLatin1String("Ethernet"); - break; - case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: - return QLatin1String("WLAN"); - break; - case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: - return QLatin1String("2G"); - break; - case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: - return QLatin1String("CDMA2000"); - break; - default: - break; - }; - } - } - return QString(); -} - -void QNmWifiEngine::connectToId(const QString &id) -{ -// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; - activatingConnectionPath = id; - QStringList connectionSettings = getConnectionPathForId(id); - if(connectionSettings.isEmpty()) { - emit connectionError(id, OperationNotSupported); - return; - } - - QDBusObjectPath connectionPath(connectionSettings.at(1)); - QString interface = getInterfaceFromId(id); - - interface = QNetworkInterface::interfaceFromName(interface).hardwareAddress().toLower(); - QString devPath; - devPath = deviceConnectionPath(interface); - QDBusObjectPath devicePath(devPath); - - iface = new QNetworkManagerInterface(); - iface->activateConnection( - connectionSettings.at(0), - connectionPath, - devicePath, - connectionPath); - - connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), - this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); -} - -void QNmWifiEngine::disconnectFromId(const QString &id) -{ - QString activeConnectionPath = getActiveConnectionPath(id); - //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; - - if (!activeConnectionPath.isEmpty()) { - QNetworkManagerConnectionActive *activeCon; - activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); - QNetworkManagerSettingsConnection *settingsCon; - settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); - - if(settingsCon->isAutoConnect()) { -// qWarning() << id << "is autoconnect"; - emit connectionError(id, OperationNotSupported); - //unsupported - } else { -// qWarning() <deactivateConnection(dbpath); - activatingConnectionPath = ""; - } - } -} - -void QNmWifiEngine::requestUpdate() -{ - updated = false; - knownSsids.clear(); - availableAccessPoints.clear(); - //emitConfigurationsChanged(); -} - -QNmWifiEngine *QNmWifiEngine::instance() -{ - QDBusConnection dbusConnection = QDBusConnection::systemBus(); - if (dbusConnection.isConnected()) { - QDBusConnectionInterface *dbiface = dbusConnection.interface(); - QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); - if (reply.isValid() && reply.value()) - return nmWifiEngine(); - } - - return 0; -} - -void QNmWifiEngine::getKnownSsids() -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << sysIface->getSsid(); - knownSsids << sysIface->getSsid(); - } - } -} - -void QNmWifiEngine::getActiveConnectionsPaths() -{ -// qWarning() << Q_FUNC_INFO; - QNetworkManagerInterface *dbIface; - activeConnectionPaths.clear(); - dbIface = new QNetworkManagerInterface; - QList connections = dbIface->activeConnections(); - - foreach(QDBusObjectPath conpath, connections) { - activeConnectionPaths << conpath.path(); -// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); - - QNetworkManagerConnectionActive *activeConn; - activeConn = new QNetworkManagerConnectionActive(conpath.path()); - -// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); - - } -} - -QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) -{ //foreach accessPoint - //qWarning() << Q_FUNC_INFO << iPath << path.path(); - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(iPath); - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); - - QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - - QString ident = accessPointIface->connectionInterface()->path(); - quint32 nmState = devIface->state(); - - QString ssid = accessPointIface->ssid(); - QString hwAddy = accessPointIface->hwAddress(); - QString sInterface = devIface->interface().name(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - bool addIt = true; - //qWarning() << availableAccessPoints.count() << ssid; - -// if(availableAccessPoints.contains(ssid)) { -// addIt = false; -// -// } -// foreach (QNetworkConfigurationPrivate *cpPriv, foundConfigurations) { -// if (cpPriv->name == ssid) { //weed out duplicate ssid's ?? -// addIt = false; -// break; -// } -// } - - if(addIt) { - - cpPriv->name = ssid; - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = devIface->interface(); - - //qWarning() <<__FUNCTION__ << ssid; - - cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); - - if(activeAPPath == accessPointIface->connectionInterface()->path()) { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Active); - } - if(accessPointIface->flags() == NM_802_11_AP_FLAGS_PRIVACY) - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - else - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - return cpPriv; - } else { - cpPriv->isValid = false; - } - return cpPriv; -} - - - QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) -{ - QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; -//qWarning() << nmState << knownSsids; - // this is the state of the wifi device interface - if(isKnown) - state = ( QNetworkConfiguration::Defined); - - switch(nmState) { //device interface state, not AP state - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - }; - return state; -} - -QString QNmWifiEngine::getActiveConnectionPath(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - QStringList connectionSettings = getConnectionPathForId(id); - //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath path, connections) { - QNetworkManagerConnectionActive *conDetailsD; - conDetailsD = new QNetworkManagerConnectionActive( path.path()); - if(conDetailsD->connection().path() == connectionSettings.at(1) - && conDetailsD->serviceName() == connectionSettings.at(0)) - return path.path(); - } - return QString(); -} - - QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) - { -// qWarning() << Q_FUNC_INFO << nmstate; - QNetworkConfiguration::StateFlags flag; - switch (nmstate) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - case NM_DEVICE_STATE_UNMANAGED: - flag = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_UNAVAILABLE: - flag = (QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - flag = ( flag | QNetworkConfiguration::Discovered ); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - flag = ( flag | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - } - break; - default: - flag = ( QNetworkConfiguration::Defined); - break; - }; - return flag; - } - -void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) -{ -// qWarning() << Q_FUNC_INFO << path << nmState; - - if(nmState == NM_DEVICE_STATE_ACTIVATED - || nmState == NM_DEVICE_STATE_DISCONNECTED - || nmState == NM_DEVICE_STATE_UNAVAILABLE - || nmState == NM_DEVICE_STATE_FAILED) { - -/* InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, -*/ -// qWarning() << Q_FUNC_INFO << ident; - QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); - switch (nmState) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - state = (QNetworkConfiguration::Undefined); - emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); -// qWarning() << Q_FUNC_INFO; - break; - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Defined); -// emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); - break; - case NM_DEVICE_STATE_DISCONNECTED: - state = ( state | QNetworkConfiguration::Discovered ); - requestUpdate(); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - state = ( state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - requestUpdate(); - } - break; - default: - state = ( QNetworkConfiguration::Defined); - break; - }; - } -} - -void QNmWifiEngine::addDevice(QDBusObjectPath path) -{ - //qWarning() << Q_FUNC_INFO << path.path(); - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - devIface->setConnections(); - connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), - this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); - - if(!devicePaths.contains(path.path())) - devicePaths << path.path(); - - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET: - { - QNetworkManagerInterfaceDeviceWired * devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - devWiredIface->setConnections(); - connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - requestUpdate(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - devWirelessIface->setConnections(); - - connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - - connect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), - this,SLOT(accessPointAdded(const QString &,QDBusObjectPath))); - - connect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), - this,SLOT(accessPointRemoved(const QString &,QDBusObjectPath))); - requestUpdate(); - - } - break; - default: - break; - }; -} - -void QNmWifiEngine::removeDevice(QDBusObjectPath /*path*/) -{ -// qWarning() << Q_FUNC_INFO << path.path(); -// disconnect(devIface,SIGNAL(stateChanged(const QString &, quint32)), -// this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); -// -// if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// // devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// // devWirelessIface->setConnections(); -// -// disconnect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), -// this,SIGNAL(cmpPropertiesChanged( const QString &, QMap))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); -// -// } -} -void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap map) -{ - QMapIterator i(map); - while (i.hasNext()) { - i.next(); -// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); - if( i.key() == "State") { //only applies to device interfaces - updateDeviceInterfaceState(path, i.value().toUInt()); - } - if( i.key() == "ActiveAccessPoint") { - } - if( i.key() == "Carrier") { //someone got plugged in - // requestUpdate(); - } - } -} - -void QNmWifiEngine::accessPointRemoved( const QString &aPath, QDBusObjectPath /*oPath*/) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - if(aPath.contains("devices")) { - requestUpdate(); - } -} - -void QNmWifiEngine::accessPointAdded( const QString &aPath, QDBusObjectPath oPath) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( aPath, oPath); - requestUpdate(); -} - -QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - bool isAvailable = false; - QStringList conPath = getConnectionPathForId(id); - QString aconpath = getActiveConnectionPath(id); - - //qWarning() << Q_FUNC_INFO << id << aconpath; - - if(!aconpath.isEmpty()) { - //active connection - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(aconpath); - - QList devs = aConn->devices(); - - foreach(QDBusObjectPath dev, devs) { - //qWarning() << "foreach" << dev.path(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); - - if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { - - if(isAddressOfConnection(id, ifaceDevice->ip4Address())) { - // this is it! - return getStateFlag(ifaceDevice->state()); - } else { - continue; - } - - if(ifaceDevice->state() == NM_DEVICE_STATE_UNAVAILABLE || - ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { - isAvailable = true; - - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); - if(!devWiredIface->carrier()) - return QNetworkConfiguration::Defined; - } //end eth - } else if(ifaceDevice->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - qWarning() << "FIXME!!!!!!!!!!!!!!!!!"; - } - - return getStateFlag(ifaceDevice->state()); - } - } else { - // not active - //qWarning() << Q_FUNC_INFO << "Not active"; - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); - if(sysIface->isValid()) { - if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString ssid = sysIface->getSsid(); - bool ok = false; - - if(knownSsids.contains(ssid, Qt::CaseSensitive)) { - foreach(QString onessid, knownSsids) { - // qWarning() << ssid << onessid; - if(onessid == ssid && availableAccessPoints.contains(ssid)) { - // qWarning() < devices = aConn->devices(); - foreach(QDBusObjectPath device, devices) { - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); - if(ifaceDevice->ip4Address() == ipaddress) { - return true; - } - } - return false; -} - -QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) -{ - // check active connections first. - QStringList conIdPath = getConnectionPathForId(id); -// qWarning() << Q_FUNC_INFO << id << conIdPath; - - QNetworkInterface interface; - foreach(QString conpath, activeConnectionPaths) { - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(conpath); - - if(aConn->connection().path() == conIdPath.at(1) - && aConn->serviceName() == conIdPath.at(0)) { - - QList devs = aConn->devices(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one - interface = ifaceDevice->interface(); - return interface; - } - } - -//try guessing - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == type /*&& devIface->managed()*/) { - interface = devIface->interface(); - if(devIface->state() == NM_STATE_DISCONNECTED) { - return interface; - } - } - } - return interface; -} - -quint64 QNmWifiEngine::receivedDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - - QString devFile; - devFile = configurationInterface.value(id); - QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); - if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&rx); - in >> result; - rx.close(); - } - return result; -} - -quint64 QNmWifiEngine::sentDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - QString devFile; - devFile = configurationInterface.value(id); - - QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); - if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&tx); - in >> result; - tx.close(); - } - return result; -} - -void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) -{ - QDBusPendingReply reply = *openCall; - if (reply.isError()) { - qWarning() <<"Error" << reply.error().name() << reply.error().message() - < list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - -// qWarning() << devIface->connectionInterface()->path(); - - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - ////////////// AccessPoints - QList apList = devWirelessIface->getAccessPoints(); - - foreach(QDBusObjectPath path, apList) { - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - QString ssid = accessPointIface->ssid(); - availableAccessPoints.insert(ssid, path); - } - } - } -} - -QString QNmWifiEngine::deviceConnectionPath(const QString &mac) -{ -// qWarning() << __FUNCTION__ << mac; - QString newMac = mac; - newMac = newMac.replace(":","_").toLower(); - //device object path might not contain just mac address - //might contain extra numbers on the end. thanks HAL - foreach(QString device, devicePaths) { - if(device.contains(newMac)) { - newMac = device; - break; - } - } - return newMac; -} - -QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << uuid << sysIface->getUuid(); - if(sysIface->getUuid() == uuid) { -// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); - return QStringList() << service << sysIface->connectionInterface()->path(); - } - } - } - return QStringList(); -} - -QT_END_NAMESPACE - diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.h b/src/plugins/bearer/networkmanager/qnmwifiengine.h deleted file mode 100644 index d651ef4..0000000 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.h +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNMWIFIENGINE_P_H -#define QNMWIFIENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -//#include - -#include -#include -#include - -#include "qnetworkmanagerservice.h" - -#include -#include -#include -#include - - - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QNmWifiEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QNmWifiEngine(QObject *parent = 0); - ~QNmWifiEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QNmWifiEngine *instance(); - - QStringList knownSsids; - //inline void emitConfigurationsChanged() { emit configurationsChanged(); } - QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); - - QStringList getConnectionPathForId(const QString &uuid); - //QString getConnectionPathForId(const QString &name = QString()); - quint64 sentDataForId(const QString &id) const; - quint64 receivedDataForId(const QString &id) const; - -private: - bool updated; - QString activatingConnectionPath; - QStringList activeConnectionPaths; - - - QMap availableAccessPoints; - void scanForAccessPoints(); - - QStringList devicePaths; - - void getActiveConnectionsPaths(); - void getKnownSsids(); - void accessPointConnections(); - void knownConnections(); - void findConnections(); - QString deviceConnectionPath(const QString &mac); - - QList foundConfigurations; - // QHash > allConfigurations; - - QNetworkManagerInterface *iface; - - QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); - QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); - - QString getActiveConnectionPath(const QString &identifier); - QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); - - QNetworkConfiguration::StateFlags getStateForId(const QString &id); - - QNetworkInterface getBestInterface(quint32 type, const QString &conPath); - - QMap configurationInterface; - - bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); - -private slots: - void updateDeviceInterfaceState(const QString &, quint32); - void addDevice(QDBusObjectPath path); - void removeDevice(QDBusObjectPath path); - -Q_SIGNALS: - void configurationChanged(const QNetworkConfiguration& config); - void updateAccessPointState(const QString &, quint32); -// void slotActivationFinished(QDBusPendingCallWatcher*); - -private slots: - void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); - void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); - void cmpPropertiesChanged(const QString &, QMap map); - void newConnection(QDBusObjectPath); - void settingsConnectionRemoved(const QString &); - void slotActivationFinished(QDBusPendingCallWatcher*); -}; - -QT_END_NAMESPACE - -#endif - - -- cgit v0.12 From b22d0a9c4d6e3309287aefdc1a300e2fc566c2c7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 10 Dec 2009 16:57:42 +1000 Subject: Remove unused global statics. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 1 - src/plugins/bearer/corewlan/qcorewlanengine.mm | 7 ------- src/plugins/bearer/generic/qgenericengine.cpp | 7 ------- src/plugins/bearer/generic/qgenericengine.h | 2 -- src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 4 ---- src/plugins/bearer/nla/qnlaengine.cpp | 9 --------- src/plugins/bearer/nla/qnlaengine.h | 2 -- 7 files changed, 32 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 7ccfeea..2be81d1 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -70,7 +70,6 @@ public: void requestUpdate(); - static QCoreWlanEngine *instance(); static bool getAllScInterfaces(); private: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 9dea217..c6ea56a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -66,8 +66,6 @@ QMap networkInterfaces; QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) - inline QString cfstringRefToQstring(CFStringRef cfStringRef) { // return QString([cfStringRef UTF8String]); QString retVal; @@ -310,11 +308,6 @@ void QCoreWlanEngine::requestUpdate() emit configurationsChanged(); } -QCoreWlanEngine *QCoreWlanEngine::instance() -{ - return coreWlanEngine(); -} - QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) { QList foundConfigs; diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 339ef9c..0d9a958 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QGenericEngine, genericEngine) - static QString qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WIN32 @@ -170,11 +168,6 @@ void QGenericEngine::requestUpdate() QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } -QGenericEngine *QGenericEngine::instance() -{ - return genericEngine(); -} - void QGenericEngine::doRequestUpdate() { // Immediately after connecting with a wireless access point diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 9359d7f..a671ceb 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -71,8 +71,6 @@ public: QNetworkSession::State sessionStateForId(const QString &id); - static QGenericEngine *instance(); - private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 5ca49a9..93fc9ca 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) - WlanOpenHandleProto local_WlanOpenHandle = 0; WlanRegisterNotificationProto local_WlanRegisterNotification = 0; WlanEnumInterfacesProto local_WlanEnumInterfaces = 0; @@ -63,8 +61,6 @@ WlanScanProto local_WlanScan = 0; WlanFreeMemoryProto local_WlanFreeMemory = 0; WlanCloseHandleProto local_WlanCloseHandle = 0; - - void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) { Q_UNUSED(d); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 2ad9cac..47bd8d5 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) - QWindowsSockInit2::QWindowsSockInit2() : version(0) { @@ -579,13 +577,6 @@ void QNlaEngine::requestUpdate() nlaThread->forceUpdate(); } -QNlaEngine *QNlaEngine::instance() -{ - return nlaEngine(); -} - #include "qnlaengine.moc" QT_END_NAMESPACE - - diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 1e66c83..464275d 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -92,8 +92,6 @@ public: void requestUpdate(); - static QNlaEngine *instance(); - private: QWindowsSockInit2 winSock; QNlaThread *nlaThread; -- cgit v0.12 From 6f0a0af87c2063cd1dac75134f5cd05291a9196d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 10 Dec 2009 17:10:53 +1000 Subject: Convert NLA plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 12 ++- src/plugins/bearer/nla/qnlaengine.cpp | 101 ++++++++++++++++++++----- src/plugins/bearer/nla/qnlaengine.h | 6 +- 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 6f833f3..495be4a 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -198,7 +198,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (nmWifi) { sessionEngines.append(nmWifi); connect(nmWifi, SIGNAL(updateCompleted()), - this, SIGNAL(configurationUpdateComplete())); + this, SLOT(updateConfigurations())); connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), @@ -217,7 +217,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (generic) { sessionEngines.append(generic); connect(generic, SIGNAL(updateCompleted()), - this, SIGNAL(configurationUpdateComplete())); + this, SLOT(updateConfigurations())); connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), @@ -235,6 +235,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); if (nla) { sessionEngines.append(nla); + connect(nla, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(nla, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nla, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nla, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 47bd8d5..a9fc2ee 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -238,21 +238,8 @@ QList QNlaThread::getConfigurations() { QMutexLocker locker(&mutex); - QList foundConfigurations; - - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - - foundConfigurations.append(config); - } + QList foundConfigurations = fetchedConfigurations; + fetchedConfigurations.clear(); return foundConfigurations; } @@ -324,7 +311,10 @@ void QNlaThread::run() #ifndef Q_OS_WINCE // Not interested in unrelated IO completion events // although we also don't want to block them - while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION) {} + while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION && + handle) + { + } #else WaitForSingleObject(changeEvent, WSA_INFINITE); #endif @@ -515,7 +505,7 @@ QNlaEngine::QNlaEngine(QObject *parent) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), - this, SIGNAL(configurationsChanged())); + this, SLOT(networksChanged())); nlaThread->start(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); @@ -526,12 +516,57 @@ QNlaEngine::~QNlaEngine() delete nlaThread; } -QList QNlaEngine::getConfigurations(bool *ok) +void QNlaEngine::networksChanged() { - if (ok) - *ok = true; + QStringList previous = accessPointConfigurations.keys(); + + QList foundConfigurations = nlaThread->getConfigurations(); + while (!foundConfigurations.isEmpty()) { + QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst(); + + previous.removeAll(cpPriv->id); + + if (accessPointConfigurations.contains(cpPriv->id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id); + + bool changed = false; + + if (ptr->isValid != cpPriv->isValid) { + ptr->isValid = cpPriv->isValid; + changed = true; + } + + if (ptr->name != cpPriv->name) { + ptr->name = cpPriv->name; + changed = true; + } + + if (ptr->state != cpPriv->state) { + ptr->state = cpPriv->state; + changed = true; + } - return nlaThread->getConfigurations(); + if (changed) + emit configurationChanged(ptr); + + delete cpPriv; + } else { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + + accessPointConfigurations.insert(ptr->id, ptr); + + emit configurationAdded(ptr); + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } + + emit updateCompleted(); } QString QNlaEngine::getInterfaceFromId(const QString &id) @@ -577,6 +612,30 @@ void QNlaEngine::requestUpdate() nlaThread->forceUpdate(); } +QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 464275d..dd038d1 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -81,7 +81,6 @@ public: QNlaEngine(QObject *parent = 0); ~QNlaEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -92,6 +91,11 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + +private Q_SLOTS: + void networksChanged(); + private: QWindowsSockInit2 winSock; QNlaThread *nlaThread; -- cgit v0.12 From a60b9d95fddb75a53cde258dbf4b9063a58a88b8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 11 Dec 2009 11:27:14 +1000 Subject: Convert Native Wifi plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 14 ++- .../bearer/nativewifi/qnativewifiengine.cpp | 115 ++++++++++++++++----- src/plugins/bearer/nativewifi/qnativewifiengine.h | 7 +- 3 files changed, 106 insertions(+), 30 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 495be4a..c9b10dd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -251,9 +251,21 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QBearerEnginePlugin *nativeWifiPlugin = qobject_cast(l->instance(QLatin1String("nativewifi"))); if (nativeWifiPlugin) { - QNetworkSessionEngine *nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); + QNetworkSessionEngine *nativeWifi = + nativeWifiPlugin->create(QLatin1String("nativewifi")); if (nativeWifi) { sessionEngines.append(nativeWifi); + connect(nativeWifi, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(nativeWifi, + SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nativeWifi, + SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nativeWifi, + SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; } diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 93fc9ca..e65eeea 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -68,7 +68,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) switch (data->NotificationCode) { case wlan_notification_acm_connection_complete: case wlan_notification_acm_disconnected: - d->emitConfigurationsChanged(); + QMetaObject::invokeMethod(d, "scanComplete", Qt::QueuedConnection); break; default: qDebug() << "wlan unknown notification"; @@ -96,8 +96,9 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent) // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. // We need to poll for changes in available wireless networks. - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(scanComplete())); pollTimer.setInterval(10000); + scanComplete(); } QNativeWifiEngine::~QNativeWifiEngine() @@ -105,19 +106,16 @@ QNativeWifiEngine::~QNativeWifiEngine() local_WlanCloseHandle(handle, 0); } -QList QNativeWifiEngine::getConfigurations(bool *ok) +void QNativeWifiEngine::scanComplete() { - if (ok) - *ok = false; - - QList foundConfigurations; + QStringList previous = accessPointConfigurations.keys(); // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return foundConfigurations; + return; } for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { @@ -146,36 +144,66 @@ QList QNativeWifiEngine::getConfigurations(bool network.dot11Ssid.uSSIDLength); } - // don't add duplicate networks - if (seenNetworks.contains(networkName)) - continue; - else - seenNetworks.append(networkName); - - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString id = QString::number(qHash(QLatin1String("WLAN:") + networkName)); - cpPriv->isValid = true; + previous.removeAll(id); - cpPriv->name = networkName; - cpPriv->id = QString::number(qHash(QLatin1String("WLAN:") + cpPriv->name)); + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE)) - cpPriv->state = QNetworkConfiguration::Undefined; + state = QNetworkConfiguration::Undefined; if (network.strProfileName[0] != 0) { if (network.bNetworkConnectable) { if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) - cpPriv->state = QNetworkConfiguration::Active; + state = QNetworkConfiguration::Active; else - cpPriv->state = QNetworkConfiguration::Discovered; + state = QNetworkConfiguration::Discovered; } else { - cpPriv->state = QNetworkConfiguration::Defined; + state = QNetworkConfiguration::Defined; } } - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (seenNetworks.contains(networkName)) + continue; + else + seenNetworks.append(networkName); + + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); - foundConfigurations.append(cpPriv); + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->name != networkName) { + ptr->name = networkName; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) + emit configurationChanged(ptr); + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = networkName; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + + emit configurationAdded(ptr); + } } local_WlanFreeMemory(networkList); @@ -183,12 +211,16 @@ QList QNativeWifiEngine::getConfigurations(bool local_WlanFreeMemory(interfaceList); - if (ok) - *ok = true; + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } pollTimer.start(); - return foundConfigurations; + emit updateCompleted(); } QString QNativeWifiEngine::getInterfaceFromId(const QString &id) @@ -227,6 +259,7 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0')); local_WlanFreeMemory(connectionAttributes); + local_WlanFreeMemory(interfaceList); return guid.toUpper(); } @@ -234,6 +267,8 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) local_WlanFreeMemory(connectionAttributes); } + local_WlanFreeMemory(interfaceList); + return QString(); } @@ -397,6 +432,32 @@ void QNativeWifiEngine::requestUpdate() if (result != ERROR_SUCCESS) qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); } + + local_WlanFreeMemory(interfaceList); +} + +QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; } QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 6686ea8..5d6af40 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; +struct WLAN_NOTIFICATION_DATA; class QNativeWifiEngine : public QNetworkSessionEngine { @@ -69,7 +70,6 @@ public: QNativeWifiEngine(QObject *parent = 0); ~QNativeWifiEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -80,10 +80,13 @@ public: void requestUpdate(); - inline void emitConfigurationsChanged() { emit configurationsChanged(); } + QNetworkSession::State sessionStateForId(const QString &id); inline bool available() const { return handle != 0; } +public Q_SLOTS: + void scanComplete(); + private: QTimer pollTimer; -- cgit v0.12 From 33ff53925ba6d62ecc868920c6bc914824feec54 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 11 Dec 2009 12:45:40 +1000 Subject: Remove unused BEARER_ENGINE preprocessor define. --- src/network/bearer/bearer.pri | 2 -- src/network/bearer/qnetworkconfigmanager_p.h | 6 ------ src/network/bearer/qnetworkconfiguration_p.h | 9 ++------- src/network/bearer/qnetworksession_p.h | 11 ++--------- src/plugins/bearer/corewlan/corewlan.pro | 2 -- src/plugins/bearer/generic/generic.pro | 2 -- src/plugins/bearer/nativewifi/nativewifi.pro | 2 -- src/plugins/bearer/networkmanager/networkmanager.pro | 2 +- src/plugins/bearer/nla/nla.pro | 2 -- 9 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 5bae333..4f6c549 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -69,8 +69,6 @@ symbian { INSTALLS += pkgconfig documentation } else { - DEFINES += BEARER_ENGINE - HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 37e88d3..a45d534 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -93,13 +93,10 @@ Q_SIGNALS: void onlineStateChanged(bool isOnline); private: -#ifdef BEARER_ENGINE void updateInternetServiceConfiguration(); void abort(); -#endif -#ifdef BEARER_ENGINE public: QList sessionEngines; @@ -108,14 +105,11 @@ private: bool updating; QSet updatingEngines; -#endif private Q_SLOTS: -#ifdef BEARER_ENGINE void configurationAdded(QNetworkConfigurationPrivatePointer ptr); void configurationRemoved(QNetworkConfigurationPrivatePointer ptr); void configurationChanged(QNetworkConfigurationPrivatePointer ptr); -#endif }; QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 8e69248..365ec95 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -64,12 +64,9 @@ class QNetworkConfigurationPrivate : public QSharedData { public: QNetworkConfigurationPrivate () - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose) + : isValid(false), type(QNetworkConfiguration::Invalid), + roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), internet(false) { -#ifdef BEARER_ENGINE - internet = false; -#endif } ~QNetworkConfigurationPrivate() @@ -86,9 +83,7 @@ public: bool roamingSupported; QNetworkConfiguration::Purpose purpose; -#ifdef BEARER_ENGINE bool internet; -#endif QList serviceNetworkMembers; QNetworkInterface serviceInterface; diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 0e11b3d..0a45c92 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -55,9 +55,7 @@ #include "qnetworkconfigmanager_p.h" #include "qnetworksession.h" -#ifdef BEARER_ENGINE #include "qnetworksessionengine_p.h" -#endif #include "qnetworksession.h" #include @@ -65,9 +63,7 @@ QT_BEGIN_NAMESPACE -#ifdef BEARER_ENGINE class QNetworkSessionEngine; -#endif class QNetworkSessionPrivate : public QObject { @@ -117,12 +113,10 @@ Q_SIGNALS: void quitPendingWaitsForOpened(); private Q_SLOTS: -#ifdef BEARER_ENGINE void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); -#endif private: QNetworkConfigurationManager manager; @@ -146,17 +140,16 @@ private: QNetworkSession::State state; bool isActive; -#ifdef BEARER_ENGINE bool opened; QNetworkSessionEngine *engine; -#endif + QNetworkSession::SessionError lastError; QNetworkSession* q; friend class QNetworkSession; -#if defined(BEARER_ENGINE) && defined(BACKEND_NM) +#if defined(BACKEND_NM) QDateTime startTime; void setActiveTimeStamp(); #endif diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index ffac6df..ac04e95 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -11,8 +11,6 @@ contains(QT_CONFIG, corewlan) { } } -DEFINES += BEARER_ENGINE - HEADERS += qcorewlanengine.h SOURCES += qcorewlanengine.mm main.cpp diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 506417c..0015041 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network -DEFINES += BEARER_ENGINE - HEADERS += qgenericengine.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp main.cpp diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 3aab552..583edd4 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network -DEFINES += BEARER_ENGINE - HEADERS += qnativewifiengine.h platformdefs.h SOURCES += qnativewifiengine.cpp main.cpp diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 79c68ea..57f7ca7 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -3,7 +3,7 @@ include(../../qpluginbase.pri) QT += network dbus -DEFINES += BEARER_ENGINE BACKEND_NM +DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 78f3271..62a920a 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -9,8 +9,6 @@ QT += network LIBS += -lWs2 } -DEFINES += BEARER_ENGINE - HEADERS += qnlaengine.h \ ../platformdefs_win.h SOURCES += qnlaengine.cpp main.cpp -- cgit v0.12 From 56c7d0baf1b7611f17938cf0eb920ccdae53e7ed Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 11:19:18 +1000 Subject: Remove bearer.pro. --- src/network/bearer/bearer.pro | 163 ------------------------------------------ 1 file changed, 163 deletions(-) delete mode 100644 src/network/bearer/bearer.pro diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro deleted file mode 100644 index 2255b7c..0000000 --- a/src/network/bearer/bearer.pro +++ /dev/null @@ -1,163 +0,0 @@ -# Qt bearer management library -TEMPLATE = lib -TARGET = QtBearer - -QT += network -include (../../common.pri) - -DEFINES += QT_BUILD_BEARER_LIB QT_MAKEDLL - -#DEFINES += BEARER_MANAGEMENT_DEBUG - -PUBLIC_HEADERS += qnetworkconfiguration.h \ - qnetworksession.h \ - qnetworkconfigmanager.h - -HEADERS += $$PUBLIC_HEADERS -SOURCES += qnetworksession.cpp \ - qnetworkconfigmanager.cpp \ - qnetworkconfiguration.cpp - -symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { - message("Building with SNAP support") - DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1 - LIBS += -lcmmanager - } else { - message("Building without SNAP support") - LIBS += -lapengine - } - - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - - HEADERS += qnetworkconfigmanager_s60_p.h \ - qnetworkconfiguration_s60_p.h \ - qnetworksession_s60_p.h - SOURCES += qnetworkconfigmanager_s60_p.cpp \ - qnetworkconfiguration_s60_p.cpp \ - qnetworksession_s60_p.cpp - - LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ - -lcentralrepository \ - -lesock \ - -linsock \ - -lecom \ - -lefsrv \ - -lnetmeta - - deploy.path = $${EPOCROOT} - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - - for(header, exportheaders.sources) { - BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" - } - - bearer_deployment.sources = QtBearer.dll - bearer_deployment.path = /sys/bin - DEPLOYMENT += bearer_deployment - - TARGET.CAPABILITY = All -TCB -} else { - maemo { - QT += dbus - CONFIG += link_pkgconfig - - exists(../debug) { - message("Enabling debug messages.") - DEFINES += BEARER_MANAGEMENT_DEBUG - } - - HEADERS += qnetworksession_maemo_p.h \ - qnetworkconfigmanager_maemo_p.h \ - qnetworkconfiguration_maemo_p.h - - SOURCES += qnetworkconfigmanager_maemo.cpp \ - qnetworksession_maemo.cpp - - documentation.path = $$QT_MOBILITY_PREFIX/doc - documentation.files = doc/html - - PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - - CONFIG += create_pc create_prl - QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig - pkgconfig.files = QtBearer.pc - - INSTALLS += pkgconfig documentation - - } else { - - DEFINES += BEARER_ENGINE - - HEADERS += qnetworkconfigmanager_p.h \ - qnetworkconfiguration_p.h \ - qnetworksession_p.h \ - qnetworksessionengine_p.h \ - qgenericengine_p.h - - SOURCES += qnetworkconfigmanager_p.cpp \ - qnetworksession_p.cpp \ - qnetworksessionengine.cpp \ - qgenericengine.cpp - - unix:!mac:contains(networkmanager_enabled, yes) { - contains(QT_CONFIG,dbus) { - DEFINES += BACKEND_NM - QT += dbus - - HEADERS += qnmdbushelper_p.h \ - qnetworkmanagerservice_p.h \ - qnmwifiengine_unix_p.h - - SOURCES += qnmdbushelper.cpp \ - qnetworkmanagerservice_p.cpp \ - qnmwifiengine_unix.cpp - } else { - message("NetworkManager backend requires Qt DBus support") - } - } - - win32: { - HEADERS += qnlaengine_win_p.h \ - qnetworksessionengine_win_p.h - - !wince*:HEADERS += qnativewifiengine_win_p.h - - SOURCES += qnlaengine_win.cpp - - !wince*:SOURCES += qnativewifiengine_win.cpp - - !wince*:LIBS += -lWs2_32 - wince*:LIBS += -lWs2 - } - } - macx: { - HEADERS += qcorewlanengine_mac_p.h - SOURCES+= qcorewlanengine_mac.mm - LIBS += -framework Foundation -framework SystemConfiguration - - contains(corewlan_enabled, yes) { - isEmpty(QMAKE_MAC_SDK) { - SDK6="yes" - } else { - contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { - SDK6="yes" - } - } - - !isEmpty(SDK6) { - LIBS += -framework CoreWLAN - DEFINES += MAC_SDK_10_6 - } - } - - - } -} - -include(../../features/deploy.pri) -- cgit v0.12 From 2fa4daa2acd0af503f5802eff773f1fa2117a788 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 09:20:17 +1000 Subject: Fix memory leak in NLA engine. --- src/plugins/bearer/nla/qnlaengine.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index a9fc2ee..bf0d74f 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -576,15 +576,7 @@ QString QNlaEngine::getInterfaceFromId(const QString &id) bool QNlaEngine::hasIdentifier(const QString &id) { - if (configurationInterface.contains(id.toUInt())) - return true; - - foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { - if (cpPriv->id == id) - return true; - } - - return false; + return configurationInterface.contains(id.toUInt()); } QString QNlaEngine::bearerName(const QString &id) -- cgit v0.12 From c68598b2bd82abee5da2596949e1e95c9a59e584 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 12:13:14 +1000 Subject: Emit updateCompleted() when requestUpdate() is called. --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 ++++++++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 3de20a3..0af3675 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -116,6 +116,7 @@ QNetworkManagerEngine::~QNetworkManagerEngine() void QNetworkManagerEngine::doRequestUpdate() { + emit updateCompleted(); } QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) @@ -319,6 +320,13 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat } } +void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, + const QMap &properties) +{ + qDebug() << Q_FUNC_INFO << path; + qDebug() << properties; +} + void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) { QNetworkManagerInterfaceDevice device(path.path()); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 9e8af3b..1636c91 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -87,6 +87,8 @@ private Q_SLOTS: const QMap &properties); void activeConnectionPropertiesChanged(const QString &path, const QMap &properties); + void devicePropertiesChanged(const QString &path, + const QMap &properties); void deviceAdded(const QDBusObjectPath &path); void deviceRemoved(const QDBusObjectPath &path); -- cgit v0.12 From c3049983cf0ac72ae4a524a0a365ea88e950bfc0 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 17:11:20 +1000 Subject: Convert Core Wlan plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 8 + src/plugins/bearer/corewlan/qcorewlanengine.h | 14 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 239 +++++++++++++++++++++---- 3 files changed, 220 insertions(+), 41 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c9b10dd..cb83789 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -186,6 +186,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); if (coreWifi) { sessionEngines.append(coreWifi); + connect(coreWifi, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(coreWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(coreWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(coreWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 2be81d1..ea9bcfd 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QCOREWLANENGINE_P_H -#define QCOREWLANENGINE_P_H +#ifndef QCOREWLANENGINE_H +#define QCOREWLANENGINE_H #include @@ -59,7 +59,6 @@ public: QCoreWlanEngine(QObject *parent = 0); ~QCoreWlanEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -70,13 +69,18 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + static bool getAllScInterfaces(); +private Q_SLOTS: + void doRequestUpdate(); + private: bool isWifiReady(const QString &dev); - QMap configurationInterface; + QMap configurationInterface; QTimer pollTimer; - QList scanForSsids(const QString &interfaceName); + QStringList scanForSsids(const QString &interfaceName); QList getWlanProfiles(const QString &interfaceName); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index c6ea56a..7e14e69 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -107,9 +107,9 @@ static QString qGetInterfaceType(const QString &interfaceString) QCoreWlanEngine::QCoreWlanEngine(QObject *parent) : QNetworkSessionEngine(parent) { - getAllScInterfaces(); - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); + doRequestUpdate(); } QCoreWlanEngine::~QCoreWlanEngine() @@ -137,6 +137,7 @@ QList QCoreWlanEngine::getWifiConfigurations() return QList (); } +#if 0 QList QCoreWlanEngine::getConfigurations(bool *ok) { if (ok) @@ -202,15 +203,16 @@ QList QCoreWlanEngine::getConfigurations(bool *o pollTimer.start(); return foundConfigurations; } +#endif QString QCoreWlanEngine::getInterfaceFromId(const QString &id) { - return configurationInterface.value(id.toUInt()); + return configurationInterface.value(id); } bool QCoreWlanEngine::hasIdentifier(const QString &id) { - return configurationInterface.contains(id.toUInt()); + return configurationInterface.contains(id); } QString QCoreWlanEngine::bearerName(const QString &id) @@ -304,13 +306,119 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) void QCoreWlanEngine::requestUpdate() { + pollTimer.stop(); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +void QCoreWlanEngine::doRequestUpdate() +{ getAllScInterfaces(); - emit configurationsChanged(); + + QStringList previous = accessPointConfigurations.keys(); + + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + if (i.value() == QLatin1String("WLAN")) { + QStringList added = scanForSsids(i.key()); + while (!added.isEmpty()) { + previous.removeAll(added.takeFirst()); + } + } + + qDebug() << "Found configuration" << i.key(); + QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); + + if (!interface.isValid()) + continue; + + uint identifier; + if (interface.index()) + identifier = qHash(QLatin1String("corewlan:") + QString::number(interface.index())); + else + identifier = qHash(QLatin1String("corewlan:") + interface.hardwareAddress()); + + const QString id = QString::number(identifier); + + previous.removeAll(id); + + QString name = interface.humanReadableName(); + if (name.isEmpty()) + name = interface.name(); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; + + qDebug() << "interface flags:" << interface.flags(); + + if (interface.flags() && QNetworkInterface::IsRunning) + state = QNetworkConfiguration::Defined; + + if (!interface.addressEntries().isEmpty()) + state = QNetworkConfiguration::Active; + + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->name != name) { + ptr->name = name; + changed = true; + } + + if (ptr->id != id) { + ptr->id = id; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) { + qDebug() << "Configuration changed" << ptr->name << ptr->id; + emit configurationChanged(ptr); + } + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = name; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interface.name()); + + qDebug() << "Configuration Added" << ptr->name << ptr->id; + emit configurationAdded(ptr); + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); + + qDebug() << "Configuration Removed" << ptr->name << ptr->id; + configurationInterface.remove(ptr->id); + emit configurationRemoved(ptr); + } + + pollTimer.start(); + + emit updateCompleted(); } -QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) +QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) { - QList foundConfigs; + QStringList found; + #if defined(MAC_SDK_10_6) NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -319,45 +427,80 @@ QList QCoreWlanEngine::scanForSsids(const QStrin NSDictionary *parametersDict = nil; NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; - if(!err) { + if (!err) { for(uint row=0; row < [apArray count]; row++ ) { CWNetwork *apNetwork = [apArray objectAtIndex:row]; - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QString networkSsid = nsstringToQString([apNetwork ssid]); - cpPriv->name = networkSsid; - cpPriv->isValid = true; - cpPriv->id = networkSsid; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); + + const QString networkSsid = nsstringToQString([apNetwork ssid]); + + const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); + found.append(id); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; + + if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + QString interfaceSsidString = nsstringToQString([currentInterface ssid]); + qDebug() << "interfaceSsidString:" << interfaceSsidString; + if (networkSsid == nsstringToQString([currentInterface ssid])) + state = QNetworkConfiguration::Active; + } else { + if (isKnownSsid(interfaceName, networkSsid)) + state = QNetworkConfiguration::Discovered; + else + state = QNetworkConfiguration::Defined; + } + qDebug() << "state is:" << state; CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; - if(!userNetworkProfile) { - } else { + if (userNetworkProfile) { qWarning() <<"Has profile!" ; } - if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); - if( cpPriv->name == interfaceSsidString) { - cpPriv->state |= QNetworkConfiguration::Active; + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; } - } else { - if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { - cpPriv->state = QNetworkConfiguration::Discovered; - } else { - cpPriv->state = QNetworkConfiguration::Defined; + + if (ptr->name != networkSsid) { + ptr->name = networkSsid; + changed = true; } + + if (ptr->id != id) { + ptr->id = id; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) { + qDebug() << "WLAN Configuration Changed" << interfaceName << ptr->name << ptr->id; + emit configurationChanged(ptr); + } + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = networkSsid; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interfaceName); + + qDebug() << "WLAN Configuration Added" << interfaceName << ptr->name << ptr->id; + emit configurationAdded(ptr); } - if(!cpPriv->state) { - cpPriv->state = QNetworkConfiguration::Undefined; - } - if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - else - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - foundConfigs.append(cpPriv); } } else { qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) @@ -367,7 +510,7 @@ QList QCoreWlanEngine::scanForSsids(const QStrin #else Q_UNUSED(interfaceName); #endif - return foundConfigs; + return found; } bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) @@ -449,4 +592,28 @@ bool QCoreWlanEngine::getAllScInterfaces() return true; } +QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + QT_END_NAMESPACE -- cgit v0.12 From ca7fe1713ff82dcde8fb2fdfb0664b5dfa830bd7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 17:26:36 +1000 Subject: Remove some unused functions and debug output. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 1 - src/plugins/bearer/corewlan/qcorewlanengine.mm | 106 +------------------------ 2 files changed, 2 insertions(+), 105 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index ea9bcfd..237680a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -84,7 +84,6 @@ private: QList getWlanProfiles(const QString &interfaceName); - QList getWifiConfigurations(); bool isKnownSsid(const QString &interfaceName, const QString &ssid); }; diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 7e14e69..6625443 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -116,95 +116,6 @@ QCoreWlanEngine::~QCoreWlanEngine() { } -QList QCoreWlanEngine::getWifiConfigurations() -{ - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - QString interfaceName = i.key(); - if (i.value() == "WLAN") { - if(!isWifiReady(interfaceName)) { - qWarning() << "wifi not powered on"; - return QList(); - } else { - // QList profs = getWlanProfiles(interfaceName); - scanForSsids(interfaceName); - } - } else { - - } - } - return QList (); -} - -#if 0 -QList QCoreWlanEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = true; - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - QList foundConfigurations; - QList wificonfigs = getWifiConfigurations(); - - uint identifier; - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - if (i.value() == "WLAN") { - QList fetchedConfigurations = scanForSsids(i.key()); - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; - - identifier = config->name.toUInt(); - configurationInterface[identifier] = config->serviceInterface.name(); - foundConfigurations.append(config); - } - } - - QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - - if (interface.index()) - identifier = interface.index(); - else - identifier = qHash(interface.hardwareAddress()); - - cpPriv->id = QString::number(identifier); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Undefined; - - if (interface.flags() & QNetworkInterface::IsRunning) { - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->internet = true; - } - if ( !interface.addressEntries().isEmpty()) { - cpPriv->state |= QNetworkConfiguration::Active; - cpPriv->internet = true; - } - configurationInterface[identifier] = interface.name(); - foundConfigurations.append(cpPriv); - } - [autoreleasepool release]; - pollTimer.start(); - return foundConfigurations; -} -#endif - QString QCoreWlanEngine::getInterfaceFromId(const QString &id) { return configurationInterface.value(id); @@ -326,7 +237,6 @@ void QCoreWlanEngine::doRequestUpdate() } } - qDebug() << "Found configuration" << i.key(); QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); if (!interface.isValid()) @@ -348,8 +258,6 @@ void QCoreWlanEngine::doRequestUpdate() QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; - qDebug() << "interface flags:" << interface.flags(); - if (interface.flags() && QNetworkInterface::IsRunning) state = QNetworkConfiguration::Defined; @@ -381,10 +289,8 @@ void QCoreWlanEngine::doRequestUpdate() changed = true; } - if (changed) { - qDebug() << "Configuration changed" << ptr->name << ptr->id; + if (changed) emit configurationChanged(ptr); - } } else { QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); @@ -397,7 +303,6 @@ void QCoreWlanEngine::doRequestUpdate() accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); - qDebug() << "Configuration Added" << ptr->name << ptr->id; emit configurationAdded(ptr); } } @@ -405,7 +310,6 @@ void QCoreWlanEngine::doRequestUpdate() while (!previous.isEmpty()) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); - qDebug() << "Configuration Removed" << ptr->name << ptr->id; configurationInterface.remove(ptr->id); emit configurationRemoved(ptr); } @@ -439,8 +343,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - QString interfaceSsidString = nsstringToQString([currentInterface ssid]); - qDebug() << "interfaceSsidString:" << interfaceSsidString; if (networkSsid == nsstringToQString([currentInterface ssid])) state = QNetworkConfiguration::Active; } else { @@ -449,7 +351,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) else state = QNetworkConfiguration::Defined; } - qDebug() << "state is:" << state; CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; @@ -482,10 +383,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) changed = true; } - if (changed) { - qDebug() << "WLAN Configuration Changed" << interfaceName << ptr->name << ptr->id; + if (changed) emit configurationChanged(ptr); - } } else { QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); @@ -498,7 +397,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interfaceName); - qDebug() << "WLAN Configuration Added" << interfaceName << ptr->name << ptr->id; emit configurationAdded(ptr); } } -- cgit v0.12 From 31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 5 Jan 2010 09:06:49 +1000 Subject: Bearer Management Integration 2. --- config.tests/mac/corelwan/corewlan.pro | 4 - config.tests/mac/corelwan/corewlantest.mm | 49 --- config.tests/mac/corewlan/corewlan.pro | 4 + config.tests/mac/corewlan/corewlantest.mm | 49 +++ examples/network/bearercloud/bearercloud.pro | 13 +- examples/network/bearercloud/cloud.cpp | 12 +- examples/network/bearercloud/cloud.h | 2 + examples/network/bearermonitor/bearermonitor.pro | 12 +- examples/network/bearermonitor/sessionwidget.cpp | 15 +- src/network/bearer/bearer.pro | 19 +- src/network/bearer/qcorewlanengine_mac.mm | 121 +++--- src/network/bearer/qcorewlanengine_mac_p.h | 3 +- src/network/bearer/qgenericengine.cpp | 39 +- src/network/bearer/qgenericengine_p.h | 2 +- src/network/bearer/qnativewifiengine_win.cpp | 7 +- src/network/bearer/qnativewifiengine_win_p.h | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 3 + src/network/bearer/qnetworkconfigmanager_s60_p.h | 3 + src/network/bearer/qnetworkconfiguration.cpp | 56 ++- src/network/bearer/qnetworkconfiguration.h | 1 + src/network/bearer/qnetworkconfiguration_maemo_p.h | 13 + src/network/bearer/qnetworkconfiguration_p.h | 6 + src/network/bearer/qnetworkconfiguration_s60_p.cpp | 16 + src/network/bearer/qnetworkconfiguration_s60_p.h | 1 + src/network/bearer/qnetworkmanagerservice_p.cpp | 44 +- src/network/bearer/qnetworksession.cpp | 146 ++++--- src/network/bearer/qnetworksession.h | 3 +- src/network/bearer/qnetworksession_maemo.cpp | 47 +- src/network/bearer/qnetworksession_maemo_p.h | 6 +- src/network/bearer/qnetworksession_p.cpp | 32 +- src/network/bearer/qnetworksession_p.h | 4 +- src/network/bearer/qnetworksession_s60_p.cpp | 76 +--- src/network/bearer/qnetworksession_s60_p.h | 3 +- src/network/bearer/qnetworksessionengine_p.h | 2 +- src/network/bearer/qnlaengine_win.cpp | 26 +- src/network/bearer/qnmwifiengine_unix.cpp | 473 ++++++--------------- src/network/bearer/qnmwifiengine_unix_p.h | 7 +- .../qnetworkconfigmanager.pro | 3 +- .../tst_qnetworkconfigmanager.cpp | 8 +- .../qnetworkconfiguration.pro | 3 +- .../tst_qnetworkconfiguration.cpp | 8 +- tests/auto/qnetworksession/lackey/lackey.pro | 3 +- tests/auto/qnetworksession/lackey/main.cpp | 2 +- .../tst_qnetworksession/tst_qnetworksession.cpp | 86 ++-- .../tst_qnetworksession/tst_qnetworksession.pro | 3 +- tests/manual/bearerex/bearerex.cpp | 37 +- tests/manual/bearerex/bearerex.h | 3 + tests/manual/bearerex/bearerex.pro | 11 +- tests/manual/networkmanager/networkmanager.pro | 3 +- tests/manual/networkmanager/nmview.cpp | 2 - tests/manual/networkmanager/nmview.h | 2 + 51 files changed, 696 insertions(+), 799 deletions(-) delete mode 100644 config.tests/mac/corelwan/corewlan.pro delete mode 100644 config.tests/mac/corelwan/corewlantest.mm create mode 100644 config.tests/mac/corewlan/corewlan.pro create mode 100644 config.tests/mac/corewlan/corewlantest.mm diff --git a/config.tests/mac/corelwan/corewlan.pro b/config.tests/mac/corelwan/corewlan.pro deleted file mode 100644 index 54a6c36..0000000 --- a/config.tests/mac/corelwan/corewlan.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES=corewlantest.mm -TARGET=corewlan -LIBS += -framework CoreWLAN -framework Foundation -CONFIG-=app_bundle diff --git a/config.tests/mac/corelwan/corewlantest.mm b/config.tests/mac/corelwan/corewlantest.mm deleted file mode 100644 index bcddf44..0000000 --- a/config.tests/mac/corelwan/corewlantest.mm +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main() -{ - [CWInterface interfaceWithName:@"en2"]; - return 0; -} diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro new file mode 100644 index 0000000..54a6c36 --- /dev/null +++ b/config.tests/mac/corewlan/corewlan.pro @@ -0,0 +1,4 @@ +SOURCES=corewlantest.mm +TARGET=corewlan +LIBS += -framework CoreWLAN -framework Foundation +CONFIG-=app_bundle diff --git a/config.tests/mac/corewlan/corewlantest.mm b/config.tests/mac/corewlan/corewlantest.mm new file mode 100644 index 0000000..bcddf44 --- /dev/null +++ b/config.tests/mac/corewlan/corewlantest.mm @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main() +{ + [CWInterface interfaceWithName:@"en2"]; + return 0; +} diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 308ddda..75e3049 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -15,16 +15,9 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer CONFIG += console -include(../examples.pri) - - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - INCLUDEPATH += ../../ - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 4a1bde7..61bd88e 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -226,7 +226,7 @@ QVariant Cloud::itemChange(GraphicsItemChange change, const QVariant &value) void Cloud::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - if (session->isActive()) + if (session->isOpen()) session->close(); else session->open(); @@ -258,7 +258,7 @@ void Cloud::stateChanged(QNetworkSession::State state) tooltip += tr("
Interface: %1").arg(interface.humanReadableName()); tooltip += tr("
Id: %1").arg(configuration.identifier()); - const QString bearerName = session->bearerName(); + const QString bearerName = configuration.bearerName(); if (!bearerName.isEmpty()) tooltip += tr("
Bearer: %1").arg(bearerName); @@ -289,10 +289,10 @@ void Cloud::stateChanged(QNetworkSession::State state) s = s.arg(tr("Unknown")); } - if (session->isActive()) - s = s.arg(tr("Active")); + if (session->isOpen()) + s = s.arg(tr("Open")); else - s = s.arg(tr("Inactive")); + s = s.arg(tr("Closed")); tooltip += s; @@ -307,7 +307,7 @@ void Cloud::stateChanged(QNetworkSession::State state) //! [1] void Cloud::newConfigurationActivated() { - const QString bearerName = session->bearerName(); + const QString bearerName = configuration.bearerName(); if (!svgCache.contains(bearerName)) { if (bearerName == QLatin1String("WLAN")) svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h index 4ce43df..b542bf7 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -45,8 +45,10 @@ #include QTM_USE_NAMESPACE +QT_BEGIN_NAMESPACE class QGraphicsTextItem; class QGraphicsSvgItem; +QT_END_NAMESPACE class Cloud : public QObject, public QGraphicsItem { diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index c8fb3c2..acbee71 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -17,16 +17,12 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer + win32:!wince*:LIBS += -lWs2_32 wince*:LIBS += -lWs2 CONFIG += console -include(../examples.pri) - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 7633dd7..0277d87 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "sessionwidget.h" +#include "qnetworkconfigmanager.h" SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) : QWidget(parent) @@ -79,7 +80,13 @@ void SessionWidget::updateSession() updateSessionState(session->state()); updateSessionError(session->error()); - bearer->setText(session->bearerName()); + if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) + bearer->setText(session->configuration().bearerName()); + else { + QNetworkConfigurationManager mgr; + QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString()); + bearer->setText(c.bearerName()); + } interfaceName->setText(session->interface().humanReadableName()); interfaceGuid->setText(session->interface().name()); @@ -140,10 +147,10 @@ void SessionWidget::updateSessionState(QNetworkSession::State state) s = s.arg(tr("Unknown")); } - if (session->isActive()) - s = s.arg(tr("Active")); + if (session->isOpen()) + s = s.arg(tr("Open")); else - s = s.arg(tr("Inactive")); + s = s.arg(tr("Closed")); sessionState->setText(s); } diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro index 2255b7c..ce39db6 100644 --- a/src/network/bearer/bearer.pro +++ b/src/network/bearer/bearer.pro @@ -19,8 +19,7 @@ SOURCES += qnetworksession.cpp \ qnetworkconfiguration.cpp symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + contains(snap_enabled, yes) { message("Building with SNAP support") DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1 LIBS += -lcmmanager @@ -48,21 +47,21 @@ symbian: { -lefsrv \ -lnetmeta + TARGET.CAPABILITY = ALL -TCB + TARGET.UID3 = 0x2002AC81 + deploy.path = $${EPOCROOT} exportheaders.sources = $$PUBLIC_HEADERS exportheaders.path = epoc32/include - for(header, exportheaders.sources) { BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" } - - bearer_deployment.sources = QtBearer.dll - bearer_deployment.path = /sys/bin - DEPLOYMENT += bearer_deployment - - TARGET.CAPABILITY = All -TCB + + QtBearerManagement.sources = QtBearer.dll + QtBearerManagement.path = /sys/bin + DEPLOYMENT += QtBearerManagement } else { - maemo { + maemo6 { QT += dbus CONFIG += link_pkgconfig diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 5451615..41ec79a 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -102,7 +102,7 @@ inline QStringList nsarrayToQStringList(void *nsarray) static QString qGetInterfaceType(const QString &interfaceString) { - return networkInterfaces.value(interfaceString); + return networkInterfaces.value(interfaceString, QLatin1String("Unknown")); } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) @@ -115,66 +115,52 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { -} - -QList QCoreWlanEngine::getWifiConfigurations() -{ - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - QString interfaceName = i.key(); - if (i.value() == "WLAN") { - if(!isWifiReady(interfaceName)) { - qWarning() << "wifi not powered on"; - return QList(); - } else { - // QList profs = getWlanProfiles(interfaceName); - scanForSsids(interfaceName); - } - } else { - - } + QNetworkConfigurationPrivate* cpPriv = 0; + foundConfigurations.clear(); + while(!foundConfigurations.isEmpty()) { + cpPriv = foundConfigurations.takeFirst(); + delete cpPriv; } - return QList (); } QList QCoreWlanEngine::getConfigurations(bool *ok) { if (ok) *ok = true; - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - QList foundConfigurations; - QList wificonfigs = getWifiConfigurations(); + foundConfigurations.clear(); uint identifier; QMapIterator i(networkInterfaces); + QNetworkConfigurationPrivate* cpPriv = 0; while (i.hasNext()) { i.next(); if (i.value() == "WLAN") { QList fetchedConfigurations = scanForSsids(i.key()); for (int i = 0; i < fetchedConfigurations.count(); ++i) { - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate(); + cpPriv = fetchedConfigurations.at(i); + config->name = cpPriv->name; + config->isValid = cpPriv->isValid; + config->id = cpPriv->id; - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; + config->state = cpPriv->state; + config->type = cpPriv->type; + config->roamingSupported = cpPriv->roamingSupported; + config->purpose = cpPriv->purpose; + config->internet = cpPriv->internet; + config->serviceInterface = cpPriv->serviceInterface; + config->bearer = cpPriv->bearer; identifier = config->name.toUInt(); configurationInterface[identifier] = config->serviceInterface.name(); foundConfigurations.append(config); + delete cpPriv; } } QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate(); const QString humanReadableName = interface.humanReadableName(); cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; cpPriv->isValid = true; @@ -197,9 +183,10 @@ QList QCoreWlanEngine::getConfigurations(bool *o cpPriv->internet = true; } configurationInterface[identifier] = interface.name(); + cpPriv->bearer = interface.name().isEmpty()? QLatin1String("Unknown") : qGetInterfaceType(interface.name()); foundConfigurations.append(cpPriv); } - [autoreleasepool release]; + pollTimer.start(); return foundConfigurations; } @@ -214,16 +201,6 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QCoreWlanEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - void QCoreWlanEngine::connectToId(const QString &id) { NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -239,14 +216,22 @@ void QCoreWlanEngine::connectToId(const QString &id) NSEnumerator *enumerator = [remNets objectEnumerator]; CWWirelessProfile *wProfile; NSUInteger index=0; + CWNetwork *apNetwork; + NSDictionary *parametersDict; + NSArray* apArray; + + CW8021XProfile *user8021XProfile; + NSError *err; + NSMutableDictionary *params; + while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile if(id == nsstringToQString([wProfile ssid])) { - CW8021XProfile *user8021XProfile = nil; + user8021XProfile = nil; user8021XProfile = [ wProfile user8021XProfile]; - NSError *err = nil; - NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; + err = nil; + params = [NSMutableDictionary dictionaryWithCapacity:0]; if(user8021XProfile) { [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; @@ -254,17 +239,22 @@ void QCoreWlanEngine::connectToId(const QString &id) [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; } - NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + parametersDict = nil; + apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; + apNetwork = [apArray objectAtIndex:row]; if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { + bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; + if(!result) { qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); emit connectionError(id, ConnectError); } else { + [apNetwork release]; [autoreleasepool release]; return; } @@ -274,6 +264,8 @@ void QCoreWlanEngine::connectToId(const QString &id) } index++; } + [apNetwork release]; + emit connectionError(id, InterfaceLookupError); #endif } else { @@ -325,24 +317,21 @@ QList QCoreWlanEngine::scanForSsids(const QStrin NSDictionary *parametersDict = nil; NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + CWNetwork *apNetwork; if(!err) { for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; + NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init]; + + apNetwork = [apArray objectAtIndex:row]; QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); QString networkSsid = nsstringToQString([apNetwork ssid]); cpPriv->name = networkSsid; cpPriv->isValid = true; cpPriv->id = networkSsid; cpPriv->internet = true; + cpPriv->bearer = QLatin1String("WLAN"); cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); - - CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; - CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; - if(!userNetworkProfile) { - } else { - qWarning() <<"Has profile!" ; - } + cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName); if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); @@ -364,12 +353,14 @@ QList QCoreWlanEngine::scanForSsids(const QStrin else cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; foundConfigs.append(cpPriv); + [looppool release]; } } else { qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) < getWlanProfiles(const QString &interfaceName); - QList getWifiConfigurations(); bool isKnownSsid(const QString &interfaceName, const QString &ssid); + QList foundConfigurations; + }; QTM_END_NAMESPACE diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp index 184a69c..10cea0c 100644 --- a/src/network/bearer/qgenericengine.cpp +++ b/src/network/bearer/qgenericengine.cpp @@ -53,6 +53,13 @@ #include "qnetworksessionengine_win_p.h" #endif +#ifdef Q_OS_LINUX +#include +#include +#include +#include +#endif + QTM_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QGenericEngine, genericEngine) @@ -69,7 +76,7 @@ static QString qGetInterfaceType(const QString &interface) HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QString(); + return QLatin1String("Unknown"); oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -77,7 +84,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QString(); + return QLatin1String("Unknown"); } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -90,7 +97,7 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) return QLatin1String("Ethernet"); else - return QString(); + return QLatin1String("Unknown"); } CloseHandle(handle); @@ -114,11 +121,24 @@ static QString qGetInterfaceType(const QString &interface) #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << medium << physicalMedium; #endif +#elif defined(Q_OS_LINUX) + int sock = socket(AF_INET, SOCK_DGRAM, 0); + + ifreq request; + strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name)); + if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) { + switch (request.ifr_hwaddr.sa_family) { + case ARPHRD_ETHER: + return QLatin1String("Ethernet"); + } + } + + close(sock); #else Q_UNUSED(interface); #endif - return QString(); + return QLatin1String("Unknown"); } QGenericEngine::QGenericEngine(QObject *parent) @@ -176,6 +196,11 @@ QList QGenericEngine::getConfigurations(bool *ok cpPriv->id = QString::number(identifier); cpPriv->state = QNetworkConfiguration::Discovered; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (interface.name().isEmpty()) + cpPriv->bearer = QLatin1String("Unknown"); + else + cpPriv->bearer = qGetInterfaceType(interface.name()); + if (interface.flags() & QNetworkInterface::IsUp) cpPriv->state |= QNetworkConfiguration::Active; @@ -199,15 +224,15 @@ bool QGenericEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QGenericEngine::bearerName(const QString &id) +/*QString QGenericEngine::bearerName(const QString &id) { QString interface = getInterfaceFromId(id); if (interface.isEmpty()) - return QString(); + return QLatin1String("Unknown"); return qGetInterfaceType(interface); -} +}*/ void QGenericEngine::connectToId(const QString &id) { diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h index 976776e..5c08aa2 100644 --- a/src/network/bearer/qgenericengine_p.h +++ b/src/network/bearer/qgenericengine_p.h @@ -74,7 +74,7 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); + //QString bearerName(const QString &id); void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp index d8fe5fb..008a9cf 100644 --- a/src/network/bearer/qnativewifiengine_win.cpp +++ b/src/network/bearer/qnativewifiengine_win.cpp @@ -479,6 +479,8 @@ QList QNativeWifiEngine::getConfigurations(bool } cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->bearer = QLatin1String("WLAN"); + foundConfigurations.append(cpPriv); } @@ -537,6 +539,7 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) } local_WlanFreeMemory(connectionAttributes); + local_WlanFreeMemory(interfaceList); } return QString(); @@ -591,10 +594,10 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) return false; } -QString QNativeWifiEngine::bearerName(const QString &) +/*QString QNativeWifiEngine::bearerName(const QString &) { return QLatin1String("WLAN"); -} +}*/ void QNativeWifiEngine::connectToId(const QString &id) { diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h index 0d5bcb0..e911746 100644 --- a/src/network/bearer/qnativewifiengine_win_p.h +++ b/src/network/bearer/qnativewifiengine_win_p.h @@ -73,7 +73,7 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); + //QString bearerName(const QString &id); void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 8b15f41..39426d0 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -78,6 +78,7 @@ void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurati ptr.data()->roamingSupported = cpPriv->roamingSupported; ptr.data()->purpose = cpPriv->purpose; ptr.data()->internet = cpPriv->internet; + ptr.data()->bearer = cpPriv->bearer; accessPointConfigurations.insert(cpPriv->id, ptr); configurationEngine.insert(cpPriv->id, engine); @@ -135,6 +136,7 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura ptr.data()->type != cpPriv->type || ptr.data()->roamingSupported != cpPriv->roamingSupported || ptr.data()->purpose != cpPriv->purpose || + ptr.data()->bearer != cpPriv->bearer || ptr.data()->internet != cpPriv->internet) { const QNetworkConfiguration::StateFlags oldState = ptr.data()->state; @@ -147,6 +149,7 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura ptr.data()->roamingSupported = cpPriv->roamingSupported; ptr.data()->purpose = cpPriv->purpose; ptr.data()->internet = cpPriv->internet; + ptr.data()->bearer = cpPriv->bearer; if (!firstUpdate) { QNetworkConfiguration item; diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index 296d67f..679fa6c 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -63,7 +63,10 @@ #endif class CCommsDatabase; + +QT_BEGIN_NAMESPACE class QTimer; +QT_END_NAMESPACE QTM_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index c92b356..56907c3 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -164,9 +164,9 @@ QTM_BEGIN_NAMESPACE QNetworkConfiguration::Defined. If the configuration is a service network this flag is set if at least one of the underlying access points configurations has the Discovered state. - \value Active The configuration is currently used by an open/active network session - (see \l QNetworkSession::isActive()). However this does not mean that the - current process is the entity that created the active session. It merely + \value Active The configuration is currently used by an open network session + (see \l QNetworkSession::isOpen()). However this does not mean that the + current process is the entity that created the open session. It merely indicates that if a new QNetworkSession were to be constructed based on this configuration \l QNetworkSession::state() would return \l QNetworkSession::Connected. This state implies the @@ -344,6 +344,56 @@ QList QNetworkConfiguration::children() const return results; } +/*! + Returns the type of bearer. The string is not translated and + therefore can not be shown to the user. The subsequent table presents the currently known + bearer types: + + \table + \header + \o Value + \o Description + \row + \o Unknown + \o The session is based on an unknown or unspecified bearer type. + \row + \o Ethernet + \o The session is based on Ethernet. + \row + \o WLAN + \o The session is based on Wireless LAN. + \row + \o 2G + \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. + \row + \o CDMA2000 + \o The session uses CDMA. + \row + \o WCDMA + \o The session uses W-CDMA/UMTS. + \row + \o HSPA + \o The session uses High Speed Packet Access. + \row + \o Bluetooth + \o The session uses Bluetooth. + \row + \o WiMAX + \o The session uses WiMAX. + \endtable + + This function returns an empty string if this is an invalid configuration, + a network configuration of type \l QNetworkConfiguration::ServiceNetwork or + \l QNetworkConfiguration::UserChoice. +*/ +QString QNetworkConfiguration::bearerName() const +{ + if (!isValid()) + return QString(); + + return d->bearerName(); +} + QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index f8c17d5..860be4b 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -91,6 +91,7 @@ public: StateFlags state() const; Type type() const; Purpose purpose() const; + QString bearerName() const; QString identifier() const; bool isRoamingAvailable() const; QList children() const; diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h index 8d786aa..2597605 100644 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h @@ -89,6 +89,19 @@ public: /* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */ QByteArray network_id; /* typically WLAN ssid or similar */ QString iap_type; /* is this one WLAN or GPRS */ + QString bearerName() const + { + if (iap_type == "WLAN_INFRA" || + iap_type == "WLAN_ADHOC") + return QString("WLAN"); + else if (iap_type == "GPRS") + return QString("HSPA"); + + //return whatever it is + //this may have to be split up later on + return iap_type; + } + uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */ QString service_type; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index a3bcd9a..c2834e6 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -78,6 +78,12 @@ public: } QString name; + QString bearer; + inline QString bearerName() const + { + return bearer; + } + bool isValid; QString id; QNetworkConfiguration::StateFlags state; diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 61548ba..02115d9 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -57,4 +57,20 @@ QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() serviceNetworkMembers.clear(); } +QString QNetworkConfigurationPrivate::bearerName() const +{ + switch (bearer) { + case QNetworkConfigurationPrivate::BearerEthernet: return QLatin1String("Ethernet"); + case QNetworkConfigurationPrivate::BearerWLAN: return QLatin1String("WLAN"); + case QNetworkConfigurationPrivate::Bearer2G: return QLatin1String("2G"); + case QNetworkConfigurationPrivate::BearerCDMA2000: return QLatin1String("CDMA2000"); + case QNetworkConfigurationPrivate::BearerWCDMA: return QLatin1String("WCDMA"); + case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); + case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); + case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); + default: return QLatin1String("Unknown"); + } +} + + QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index 44f8f56..6c87200 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -87,6 +87,7 @@ public: QList > serviceNetworkMembers; QNetworkConfigurationPrivate::Bearer bearer; + QString bearerName() const; TUint32 numericId; TUint connectionId; diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp index 2f91af0..5804686 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.cpp +++ b/src/network/bearer/qnetworkmanagerservice_p.cpp @@ -70,7 +70,7 @@ public: }; QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfacePrivate(); d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, @@ -93,6 +93,8 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) QNetworkManagerInterface::~QNetworkManagerInterface() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -195,7 +197,7 @@ public: }; QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceAccessPointPrivate(); d->path = dbusPathName; @@ -214,6 +216,8 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -229,6 +233,9 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -304,7 +311,7 @@ public: }; QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDevicePrivate(); d->path = deviceObjectPath; @@ -322,6 +329,8 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -337,6 +346,9 @@ bool QNetworkManagerInterfaceDevice::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), this, SIGNAL(stateChanged(const QString&, quint32))); @@ -396,6 +408,7 @@ public: }; QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDeviceWiredPrivate(); d->path = ifaceDevicePath; @@ -413,6 +426,8 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -430,6 +445,9 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections() bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -473,6 +491,7 @@ public: }; QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); d->path = ifaceDevicePath; @@ -490,6 +509,8 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -505,6 +526,9 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -592,7 +616,6 @@ public: QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) : QObject(parent) { -// qWarning() << __PRETTY_FUNCTION__; d = new QNetworkManagerSettingsPrivate(); d->path = settingsService; d->connectionInterface = new QDBusInterface(settingsService, @@ -655,6 +678,7 @@ public: }; QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { qDBusRegisterMetaType(); d = new QNetworkManagerSettingsConnectionPrivate(); @@ -676,6 +700,8 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -697,6 +723,9 @@ bool QNetworkManagerSettingsConnection::setConnections() allOk = true; } + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)), this,SIGNAL(removed( const QString &))); @@ -880,6 +909,7 @@ public: }; QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerConnectionActivePrivate(); d->path = activeConnectionObjectPath; @@ -897,6 +927,8 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -912,6 +944,9 @@ bool QNetworkManagerConnectionActive::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -975,6 +1010,7 @@ public: }; QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) + : QObject(parent) { d = new QNetworkManagerIp4ConfigPrivate(); d->path = deviceObjectPath; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index d3a323a..6171350 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -46,7 +46,7 @@ #ifdef Q_OS_SYMBIAN #include "qnetworksession_s60_p.h" -#elif MAEMO +#elif Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" #else #include "qnetworksession_p.h" @@ -72,34 +72,41 @@ QTM_BEGIN_NAMESPACE QNetworkSession supports session management within the same process and depending on the platform's capabilities may support out-of-process sessions. If the same - network configuration is used by multiple active sessions the underlying network interface is only terminated once + network configuration is used by multiple open sessions the underlying network interface is only terminated once the last session has been closed. \section1 Roaming Applications may connect to the preferredConfigurationChanged() signal in order to receive notifications when a more suitable access point becomes available. - In response to this signal the application may initiate the roaming via migrate() - or may ignore() the new access point. Once the session has roamed the + In response to this signal the application must either initiate the roaming via migrate() + or ignore() the new access point. Once the session has roamed the newConfigurationActivated() signal is emitted. The application may now test the - carrier and can accept() or reject() it. The session will return to the previous - access point if the roaming was rejected. + carrier and must either accept() or reject() it. The session will return to the previous + access point if the roaming was rejected. The subsequent state diagram depicts the required + state transitions. + + \image roaming-states.png - Some platforms may support the notion of forced roaming and application level roaming (ALR). + Some platforms may distinguish forced roaming and application level roaming (ALR). ALR implies that the application controls (via migrate(), ignore(), accept() and reject()) - whether a network session can roam from one network configuration to the next. Such control is useful + whether a network session can roam from one access point to the next. Such control is useful if the application maintains stateful socket connections and wants to control the transition from - one interface to the next. - - Forced roaming implies that the system automatically roams to the next network without + one interface to the next. Forced roaming implies that the system automatically roams to the next network without consulting the application. This has the advantage that the application can make use of roaming features without actually being aware of it. It is expected that the application detects that the underlying socket is broken and automatically reconnects via the new network link. - If the platform supports both modes of roaming an application indicates its preference + If the platform supports both modes of roaming, an application indicates its preference by connecting to the preferredConfigurationChanged() signal. Connecting to this signal means that the application wants to take control over the roaming behavior and therefore implies application - level roaming. + level roaming. If the client does not connect to the preferredConfigurationChanged(), forced roaming + is used. If forced roaming is not supported the network session will not roam by default. + + Some applications may want to suppress any form of roaming altogether. Possible use cases may be + high priority downloads or remote services which cannot handle a roaming enabled client. Clients + can suppress roaming by connecting to the preferredConfigurationChanged() signal and answer each + signal emission with ignore(). \sa QNetworkConfiguration, QNetworkConfigurationManager */ @@ -119,7 +126,7 @@ QTM_BEGIN_NAMESPACE \value Connecting The network session is being established. \value Connected The network session is connected. If the current process wishes to use this session it has to register its interest by calling open(). A network session - is considered to be ready for socket operations if it isActive() and connected. + is considered to be ready for socket operations if it isOpen() and connected. \value Closing The network session is in the process of being shut down. \value Disconnected The network session is not connected. The associated QNetworkConfiguration has the state QNetworkConfiguration::Discovered. @@ -167,9 +174,8 @@ QTM_BEGIN_NAMESPACE details such as proxy settings and \a isSeamless indicates whether roaming will break the sessions IP address. - As a consequence to this signal the application may start the roaming process - by calling migrate() or may chose to ignore() the new access point. If the application - doesn't call either of the two functions the session ignores the migration opportunity. + As a consequence to this signal the application must either start the roaming process + by calling migrate() or choose to ignore() the new access point. If the roaming process is non-seamless the IP address will change which means that a socket becomes invalid. However seamless mobility can ensure that the local IP address @@ -194,7 +200,7 @@ QTM_BEGIN_NAMESPACE This signal is emitted once the session has roamed to the new access point. The application may reopen its socket and test the suitability of the new network link. - Subsequently it may accept() or reject() the new access point. + Subsequently it must either accept() or reject() the new access point. \sa accept(), reject() */ @@ -239,13 +245,13 @@ QNetworkSession::~QNetworkSession() } /*! - Creates an active/open session which increases the session counter on the underlying network interface. + Creates an open session which increases the session counter on the underlying network interface. The system will not terminate a network interface until the session reference counter reaches zero. - Therefore an active session allows an application to register its use of the interface. + Therefore an open session allows an application to register its use of the interface. - The interface is started if it is not active yet. Some platforms may not provide support - for out-of-process sessions. On such platforms the session counter ignores any sessions - held by another process. The platform capabilities can be + As a result of calling open() the interface will be started if it is not connected/up yet. + Some platforms may not provide support for out-of-process sessions. On such platforms the session + counter ignores any sessions held by another process. The platform capabilities can be detected via QNetworkConfigurationManager::capabilities(). Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired @@ -253,7 +259,7 @@ QNetworkSession::~QNetworkSession() It is not a requirement to open a session in order to monitor the underlying network interface. - \sa close(), stop(), isActive() + \sa close(), stop(), isOpen() */ void QNetworkSession::open() { @@ -279,7 +285,7 @@ void QNetworkSession::open() */ bool QNetworkSession::waitForOpened(int msecs) { - if (d->isActive) + if (d->isOpen) return true; if (d->state != Connecting) @@ -297,13 +303,13 @@ bool QNetworkSession::waitForOpened(int msecs) loop->disconnect(); loop->deleteLater(); - return d->isActive; + return d->isOpen; } /*! Decreases the session counter on the associated network configuration. If the session counter reaches zero the active network interface is shut down. This also means that state() will only change from \l Connected to - \l Disconnected if this was the last active session. + \l Disconnected if the current session was the last open session. If the platform does not support out-of-process sessions calling this function does not stop the interface. In this case \l{stop()} has to be used to force a shut down. @@ -312,7 +318,7 @@ bool QNetworkSession::waitForOpened(int msecs) Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired by connecting to the stateChanged(), opened() or error() signals. - \sa open(), stop(), isActive() + \sa open(), stop(), isOpen() */ void QNetworkSession::close() { @@ -320,7 +326,7 @@ void QNetworkSession::close() } /*! - Invalidates all active sessions against the network interface and therefore stops the + Invalidates all open sessions against the network interface and therefore stops the underlying network interface. This function always changes the session's state() flag to \l Disconnected. @@ -341,15 +347,19 @@ QNetworkConfiguration QNetworkSession::configuration() const return d->publicConfig; } -/*! - Returns the type of bearer currently used by this session. The string is not translated and therefore can - not be shown to the user. The subsequent table presents the currently known bearer types: +/* + Returns the type of bearer currently used by this session. The string is not translated and + therefore can not be shown to the user. The subsequent table presents the currently known + bearer types: \table \header \o Value \o Description \row + \o Unknown + \o The session is based on an unknown or unspecified bearer type. + \row \o Ethernet \o The session is based on Ethernet. \row @@ -380,12 +390,14 @@ QNetworkConfiguration QNetworkSession::configuration() const active configuration is returned. Therefore the bearer type may change over time. - This function returns an empty string if this session is based on an invalid configuration. + This function returns an empty string if this session is based on an invalid configuration, or + a network configuration of type \l QNetworkConfiguration::ServiceNetwork with no + \l {QNetworkConfiguration::children()}{children}. */ -QString QNetworkSession::bearerName() const +/*QString QNetworkSession::bearerName() const { return d->bearerName(); -} +}*/ /*! Returns the network interface that is used by this session. @@ -402,25 +414,29 @@ QNetworkInterface QNetworkSession::interface() const } /*! - Returns true if this object holds an active session on the underlying network interface. + Returns true if this session is open. If the number of all open sessions is greater than + zero the underlying network interface will remain connected/up. + The session can be controlled via open() and close(). */ -bool QNetworkSession::isActive() const +bool QNetworkSession::isOpen() const { - return d->isActive; + return d->isOpen; } /*! - Returns the state of the session. If the session is based on a - single access point configuration the state of the session is the same as the state of the - associated network interface. Therefore a network session object can be used to monitor - network interfaces. + Returns the state of the session. + + If the session is based on a single access point configuration the state of the + session is the same as the state of the associated network interface. Therefore + a network session object can be used to monitor network interfaces. A \l QNetworkConfiguration::ServiceNetwork based session summarizes the state of all its children - and therefore returns the \l Connected state if at least one of its sub configurations is connected. + and therefore returns the \l Connected state if at least one of the service network's + \l {QNetworkConfiguration::children()}{children()} configurations is active. - Note that it is not required to hold an active session in order to obtain the network interface state. - A connected but inactive session may be used to monitor network interfaces whereas an active and connected + Note that it is not required to hold an open session in order to obtain the network interface state. + A connected but closed session may be used to monitor network interfaces whereas an open and connected session object may prevent the network interface from being shut down. \sa error(), stateChanged() @@ -463,8 +479,8 @@ QString QNetworkSession::errorString() const \header \o Key \o Description \row - \o ActiveConfigurationIdentifier - \o If the session \l isActive() this property returns the identifier of the + \o ActiveConfiguration + \o If the session \l isOpen() this property returns the identifier of the QNetworkConfiguration that is used by this session; otherwise an empty string. The main purpose of this key is to determine which Internet access point is used @@ -476,7 +492,7 @@ QString QNetworkSession::errorString() const QNetworkSession* session = new QNetworkSession(ap); ... //code activates session - QString ident = session->sessionProperty("ActiveConfigurationIdentifier").toString(); + QString ident = session->sessionProperty("ActiveConfiguration").toString(); if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) { Q_ASSERT( ap.identifier() != ident ); Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) ); @@ -485,17 +501,17 @@ QString QNetworkSession::errorString() const } \endcode \row - \o UserChoiceConfigurationIdentifier - \o If the session \l isActive() and is bound to a QNetworkConfiguration of type + \o UserChoiceConfiguration + \o If the session \l isOpen() and is bound to a QNetworkConfiguration of type UserChoice, this property returns the identifier of the QNetworkConfiguration that the configuration resolved to when \l open() was called; otherwise an empty string. The purpose of this key is to determine the real QNetworkConfiguration that the - session is using. This key is different to \i ActiveConfigurationIdentifier in that + session is using. This key is different to \i ActiveConfiguration in that this key may return an identifier for either a \l {QNetworkConfiguration::ServiceNetwork}{service network} or a \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations - whereas \i ActiveConfigurationIdentifier always returns identifiers for + whereas \i ActiveConfiguration always returns identifiers to \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations. \row \o ConnectInBackground @@ -509,15 +525,15 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const if (!d->publicConfig.isValid()) return QVariant(); - if (key == "ActiveConfigurationIdentifier") { - if (!d->isActive) + if (key == "ActiveConfiguration") { + if (!d->isOpen) return QString(); else return d->activeConfig.identifier(); } - if (key == "UserChoiceConfigurationIdentifier") { - if (!d->isActive || d->publicConfig.type() != QNetworkConfiguration::UserChoice) + if (key == "UserChoiceConfiguration") { + if (!d->isOpen || d->publicConfig.type() != QNetworkConfiguration::UserChoice) return QString(); if (d->serviceConfig.isValid()) @@ -534,13 +550,13 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const \a key. Removing an already set property can be achieved by passing an invalid QVariant. - Note that the \i UserChoiceConfigurationIdentifier and \i ActiveConfigurationIdentifier + Note that the \i UserChoiceConfiguration and \i ActiveConfiguration properties are read only and cannot be changed using this method. */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) { - if (key == "ActiveConfigurationIdentifier" - || key == "UserChoiceConfigurationIdentifier") + if (key == "ActiveConfiguration" + || key == "UserChoiceConfiguration") return; d->setSessionProperty(key, value); @@ -560,16 +576,14 @@ void QNetworkSession::migrate() } /*! - This function indicates that the application does not wish to roam the session. This - is the default behavior if an application doesn't call migrate() in response to a - preferredConfigurationChanged() signal. + This function indicates that the application does not wish to roam the session. \sa migrate() */ void QNetworkSession::ignore() { - //TODO Do we really need this function if we consider that this is - // the default behavior if nobody calls migrate()? + // Needed on at least Symbian platform: the roaming must be explicitly + // ignore()'d or migrate()'d d->ignore(); } @@ -602,7 +616,7 @@ void QNetworkSession::reject() /*! Returns the amount of data sent in bytes; otherwise 0. - This field value includes the usage across all active network + This field value includes the usage across all open network sessions which use the same network interface. If the session is based on a service network configuration the number of @@ -619,7 +633,7 @@ quint64 QNetworkSession::bytesWritten() const /*! Returns the amount of data received in bytes; otherwise 0. - This field value includes the usage across all active network + This field value includes the usage across all open network sessions which use the same network interface. If the session is based on a service network configuration the number of diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 47377c4..7e52674 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -82,9 +82,8 @@ public: QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); virtual ~QNetworkSession(); - bool isActive() const; + bool isOpen() const; QNetworkConfiguration configuration() const; - QString bearerName() const; QNetworkInterface interface() const; State state() const; diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp index c7c7a31..b3afc77 100644 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ b/src/network/bearer/qnetworksession_maemo.cpp @@ -305,14 +305,14 @@ void QNetworkSessionPrivate::updateState(QNetworkSession::State newState) state = newState; if (state == QNetworkSession::Disconnected) { - isActive = false; + isOpen = false; currentNetworkInterface.clear(); if (publicConfig.type() == QNetworkConfiguration::UserChoice) activeConfig.d->state = QNetworkConfiguration::Defined; publicConfig.d->state = QNetworkConfiguration::Defined; } else if (state == QNetworkSession::Connected) { - isActive = true; + isOpen = true; if (publicConfig.type() == QNetworkConfiguration::UserChoice) { activeConfig.d->state = QNetworkConfiguration::Active; activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; @@ -436,7 +436,7 @@ void QNetworkSessionPrivate::syncStateWithInterface() /* Initially we are not active although the configuration might be in * connected state. */ - isActive = false; + isOpen = false; opened = false; QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); @@ -684,13 +684,13 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig() clearConfiguration(activeConfig); } - bool oldActive = isActive; - isActive = newActive; + bool oldActive = isOpen; + isOpen = newActive; - if (!oldActive && isActive) + if (!oldActive && isOpen) emit quitPendingWaitsForOpened(); - if (oldActive && !isActive) + if (oldActive && !isOpen) emit q->closed(); if (oldState != state) { @@ -776,7 +776,7 @@ void QNetworkSessionPrivate::open() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (!isActive) { + } else if (!isOpen) { if (publicConfig.type() == QNetworkConfiguration::UserChoice) { /* Caller is trying to connect to default IAP. @@ -810,8 +810,8 @@ void QNetworkSessionPrivate::open() return; } - isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isActive) + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) emit quitPendingWaitsForOpened(); } else { /* We seem to be active so inform caller */ @@ -826,7 +826,6 @@ void QNetworkSessionPrivate::do_open() bool st; QString result; QString iap = publicConfig.identifier(); - QString bearer_name; if (state == QNetworkSession::Connected) { #ifdef BEARER_MANAGEMENT_DEBUG @@ -922,14 +921,7 @@ void QNetworkSessionPrivate::do_open() if (!name.isEmpty()) config.d->name = name; - bearer_name = connect_result.connect.network_type; - if (bearer_name == "WLAN_INFRA" || - bearer_name == "WLAN_ADHOC") - currentBearerName = "WLAN"; - else if (bearer_name == "GPRS") - currentBearerName = "HSPA"; - else - currentBearerName = bearer_name; + config.d->iap_type = connect_result.connect.network_type; config.d->isValid = true; config.d->state = QNetworkConfiguration::Active; @@ -1032,9 +1024,9 @@ void QNetworkSessionPrivate::close() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (isActive) { + } else if (isOpen) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -1067,11 +1059,11 @@ void QNetworkSessionPrivate::stop() mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data()); opened = false; - isActive = false; + isOpen = false; } else { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -1142,15 +1134,6 @@ QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const } -QString QNetworkSessionPrivate::bearerName() const -{ - if (!publicConfig.isValid()) - return QString(); - - return currentBearerName; -} - - QString QNetworkSessionPrivate::errorString() const { QString errorStr; diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index e233087..892262d 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -69,7 +69,7 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isActive(false), + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) { } @@ -88,7 +88,6 @@ public: QNetworkInterface currentInterface() const; QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; void open(); void close(); @@ -142,7 +141,7 @@ private: void cleanupAnyConfiguration(); QNetworkSession::State state; - bool isActive; + bool isOpen; bool opened; icd_connection_flags connectFlags; @@ -152,7 +151,6 @@ private: friend class QNetworkSession; QDateTime startTime; - QString currentBearerName; QString currentNetworkInterface; friend class IcdListener; void updateState(QNetworkSession::State); diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index c6f9833..1dfc949 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -189,7 +189,7 @@ void QNetworkSessionPrivate::open() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (!isActive) { + } else if (!isOpen) { if ((activeConfig.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { lastError =QNetworkSession::InvalidConfigurationError; @@ -206,8 +206,8 @@ void QNetworkSessionPrivate::open() engine->connectToId(activeConfig.identifier()); } - isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isActive) + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) emit quitPendingWaitsForOpened(); } } @@ -217,9 +217,9 @@ void QNetworkSessionPrivate::close() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (isActive) { + } else if (isOpen) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -240,7 +240,7 @@ void QNetworkSessionPrivate::stop() } opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -286,13 +286,13 @@ void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QV { } -QString QNetworkSessionPrivate::bearerName() const +/*QString QNetworkSessionPrivate::bearerName() const { if (!publicConfig.isValid() || !engine) return QString(); return engine->bearerName(activeConfig.identifier()); -} +}*/ QString QNetworkSessionPrivate::errorString() const { @@ -321,7 +321,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const quint64 QNetworkSessionPrivate::bytesWritten() const { #if defined(BACKEND_NM) - if( state == QNetworkSession::Connected ) { + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { @@ -339,7 +339,7 @@ quint64 QNetworkSessionPrivate::bytesWritten() const quint64 QNetworkSessionPrivate::bytesReceived() const { #if defined(BACKEND_NM) - if( state == QNetworkSession::Connected ) { + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { @@ -425,12 +425,12 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig() state = QNetworkSession::NotAvailable; } - bool oldActive = isActive; - isActive = newActive; + bool oldActive = isOpen; + isOpen = newActive; - if (!oldActive && isActive) + if (!oldActive && isOpen) emit quitPendingWaitsForOpened(); - if (oldActive && !isActive) + if (oldActive && !isOpen) emit q->closed(); if (oldState != state) @@ -460,7 +460,7 @@ void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &con { if (activeConfig == config) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); @@ -530,7 +530,7 @@ if(serviceName.isEmpty()) QNetworkManagerSettingsConnection *sysIface; sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isActive = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; } if(startTime.isNull()) startTime = QDateTime::currentDateTime(); diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a2aaa6a..09fcfca 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -73,7 +73,7 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isActive(false) + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false) { } @@ -143,7 +143,7 @@ private: QNetworkConfiguration activeConfig; QNetworkSession::State state; - bool isActive; + bool isOpen; #ifdef BEARER_ENGINE bool opened; diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp index 764c1c4..f9cb09f 100644 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ b/src/network/bearer/qnetworksession_s60_p.cpp @@ -53,7 +53,7 @@ QTM_BEGIN_NAMESPACE QNetworkSessionPrivate::QNetworkSessionPrivate() : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), - isActive(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), + isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), iALREnabled(0) { CActiveScheduler::Add(this); @@ -69,7 +69,7 @@ QNetworkSessionPrivate::QNetworkSessionPrivate() QNetworkSessionPrivate::~QNetworkSessionPrivate() { - isActive = false; + isOpen = false; // Cancel Connection Progress Notifications first. // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() @@ -233,7 +233,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const void QNetworkSessionPrivate::open() { - if (isActive || !publicConfig.d || (state == QNetworkSession::Connecting)) { + if (isOpen || !publicConfig.d || (state == QNetworkSession::Connecting)) { return; } @@ -296,7 +296,7 @@ void QNetworkSessionPrivate::open() error = iDynamicSetdefaultif(&ifr); } - isActive = true; + isOpen = true; // Make sure that state will be Connected newState(QNetworkSession::Connected); emit quitPendingWaitsForOpened(); @@ -333,7 +333,7 @@ void QNetworkSessionPrivate::open() } if (error != KErrNone) { - isActive = false; + isOpen = false; iError = QNetworkSession::UnknownSessionError; emit q->error(iError); if (ipConnectionNotifier) { @@ -372,12 +372,12 @@ TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const void QNetworkSessionPrivate::close(bool allowSignals) { - if (!isActive) { + if (!isOpen) { return; } TUint activeIap = activeConfig.d.data()->numericId; - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); @@ -419,13 +419,13 @@ void QNetworkSessionPrivate::close(bool allowSignals) void QNetworkSessionPrivate::stop() { - if (!isActive) { + if (!isOpen) { return; } - isActive = false; + isOpen = false; newState(QNetworkSession::Closing); iConnection.Stop(RConnection::EStopAuthoritative); - isActive = true; + isOpen = true; close(false); emit q->closed(); } @@ -510,8 +510,8 @@ void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, T void QNetworkSessionPrivate::Error(TInt /*aError*/) { - if (isActive) { - isActive = false; + if (isOpen) { + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::RoamingError; @@ -558,40 +558,6 @@ QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkC return config; } -QString QNetworkSessionPrivate::bearerName() const -{ - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - config = publicConfig; - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - if (activeConfig.isValid()) { - config = activeConfig; - } else { - config = bestConfigFromSNAP(publicConfig); - } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (activeConfig.isValid()) { - config = activeConfig; - } - } - - if (!config.isValid()) { - return QString(); - } - - switch (config.d.data()->bearer) { - case QNetworkConfigurationPrivate::BearerEthernet: return QString("Ethernet"); - case QNetworkConfigurationPrivate::BearerWLAN: return QString("WLAN"); - case QNetworkConfigurationPrivate::Bearer2G: return QString("2G"); - case QNetworkConfigurationPrivate::BearerCDMA2000: return QString("CDMA2000"); - case QNetworkConfigurationPrivate::BearerWCDMA: return QString("WCDMA"); - case QNetworkConfigurationPrivate::BearerHSPA: return QString("HSPA"); - case QNetworkConfigurationPrivate::BearerBluetooth: return QString("Bluetooth"); - case QNetworkConfigurationPrivate::BearerWiMAX: return QString("WiMAX"); - default: return QString(); - } -} - quint64 QNetworkSessionPrivate::bytesWritten() const { return transferredData(KUplinkData); @@ -673,7 +639,7 @@ quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const quint64 QNetworkSessionPrivate::activeTime() const { - if (!isActive || startTime.isNull()) { + if (!isOpen || startTime.isNull()) { return 0; } return startTime.secsTo(QDateTime::currentDateTime()); @@ -785,7 +751,7 @@ void QNetworkSessionPrivate::RunL() } if (error != KErrNone) { - isActive = false; + isOpen = false; iError = QNetworkSession::UnknownSessionError; emit q->error(iError); Cancel(); @@ -802,7 +768,7 @@ void QNetworkSessionPrivate::RunL() iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); } #endif - isActive = true; + isOpen = true; activeConfig = newActiveConfig; activeInterface = interface(activeConfig.d.data()->numericId); if (publicConfig.type() == QNetworkConfiguration::UserChoice) { @@ -818,7 +784,7 @@ void QNetworkSessionPrivate::RunL() } break; case KErrNotFound: // Connection failed - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::InvalidConfigurationError; @@ -832,7 +798,7 @@ void QNetworkSessionPrivate::RunL() case KErrCancel: // Connection attempt cancelled case KErrAlreadyExists: // Connection already exists default: - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::UnknownSessionError; @@ -855,7 +821,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc { // Make sure that activeConfig is always updated when SNAP is signaled to be // connected. - if (isActive && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && + if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && newState == QNetworkSession::Connected) { activeConfig = activeConfiguration(accessPointId); activeInterface = interface(activeConfig.d.data()->numericId); @@ -872,12 +838,12 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc } bool emitSessionClosed = false; - if (isActive && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { // Active & Connected state should change directly to Disconnected state // only when something forces connection to close (eg. when another // application or session stops connection or when network drops // unexpectedly). - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::SessionAbortedError; @@ -903,7 +869,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc emit q->stateChanged(state); retVal = true; } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isActive) { + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { if (activeConfig.d.data()->numericId == accessPointId) { state = newState; emit q->stateChanged(state); diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h index cfb99c9..ed322dd 100644 --- a/src/network/bearer/qnetworksession_s60_p.h +++ b/src/network/bearer/qnetworksession_s60_p.h @@ -92,7 +92,6 @@ public: QNetworkInterface currentInterface() const; QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; void setALREnabled(bool enabled); @@ -158,7 +157,7 @@ private: // data mutable QNetworkInterface activeInterface; QNetworkSession::State state; - bool isActive; + bool isOpen; QNetworkSession* q; QDateTime startTime; diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 795a209..3977b15 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -81,7 +81,7 @@ public: virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; - virtual QString bearerName(const QString &id) = 0; + //virtual QString bearerName(const QString &id) = 0; virtual void connectToId(const QString &id) = 0; virtual void disconnectFromId(const QString &id) = 0; diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp index b606ef4..a3f6017 100644 --- a/src/network/bearer/qnlaengine_win.cpp +++ b/src/network/bearer/qnlaengine_win.cpp @@ -133,7 +133,7 @@ static QString qGetInterfaceType(const QString &interface) HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QString(); + return QLatin1String("Unknown"); oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QString(); + return QLatin1String("Unknown"); } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -154,7 +154,7 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) return QLatin1String("Ethernet"); else - return QString(); + return QLatin1String("Unknown"); } CloseHandle(handle); @@ -181,7 +181,7 @@ static QString qGetInterfaceType(const QString &interface) #endif - return QString(); + return QLatin1String("Unknown"); } class QNlaThread : public QThread @@ -252,6 +252,9 @@ QList QNlaThread::getConfigurations() config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; config->purpose = fetchedConfigurations.at(i)->purpose; config->internet = fetchedConfigurations.at(i)->internet; + if (QNlaEngine *engine = qobject_cast(parent())) { + config->bearer = engine->bearerName(config->id); + } foundConfigurations.append(config); } @@ -546,12 +549,17 @@ bool QNlaEngine::hasIdentifier(const QString &id) if (configurationInterface.contains(id.toUInt())) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { - if (cpPriv->id == id) - return true; + bool result = false; + QList l = nlaThread->getConfigurations(); + while (!l.isEmpty()) { + QNetworkConfigurationPrivate* cpPriv = l.takeFirst(); + if (!result && cpPriv->id == id) { + result = true; + } + delete cpPriv; } - - return false; + + return result; } QString QNlaEngine::bearerName(const QString &id) diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp index f558fa8..2444919 100644 --- a/src/network/bearer/qnmwifiengine_unix.cpp +++ b/src/network/bearer/qnmwifiengine_unix.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -65,7 +66,7 @@ QTM_BEGIN_NAMESPACE QNmWifiEngine::QNmWifiEngine(QObject *parent) : QNetworkSessionEngine(parent) { - iface = new QNetworkManagerInterface(); + iface = new QNetworkManagerInterface(this); if(!iface->isValid()) { return; } @@ -74,6 +75,8 @@ QNmWifiEngine::QNmWifiEngine(QObject *parent) this,SLOT(addDevice(QDBusObjectPath))); connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), this,SLOT(removeDevice(QDBusObjectPath))); + connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); QList list = iface->getDevices(); @@ -84,9 +87,9 @@ QNmWifiEngine::QNmWifiEngine(QObject *parent) QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + QNetworkManagerSettings *settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface = new QNetworkManagerSettings(service, this); settingsiface->setConnections(); connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), this,(SLOT(newConnection(QDBusObjectPath)))); @@ -107,6 +110,7 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d QNetworkManagerIp4Config * ipIface; ipIface = new QNetworkManagerIp4Config(path); newname = ipIface->domains().join(" "); + delete ipIface; } //fallback to interface name if(newname.isEmpty()) @@ -117,17 +121,16 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d QList QNmWifiEngine::getConfigurations(bool *ok) { -// qWarning() << Q_FUNC_INFO << updated; if (ok) *ok = false; if(!updated) { foundConfigurations.clear(); if(knownSsids.isEmpty()) - getKnownSsids(); // list of ssids that have user configurations. + updateKnownSsids(); // list of ssids that have user configurations. scanForAccessPoints(); - getActiveConnectionsPaths(); + updateActiveConnectionsPaths(); knownConnections(); accessPointConnections(); @@ -139,160 +142,8 @@ QList QNmWifiEngine::getConfigurations(bool *ok) return foundConfigurations; } -void QNmWifiEngine::findConnections() -{ - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - - //// eth - switch (devIface->deviceType()) { -// qWarning() << devIface->connectionInterface()->path(); - - case DEVICE_TYPE_802_3_ETHERNET: - { - QString ident; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - - ident = devWiredIface->hwAddress(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = getNameForConfiguration(devIface); - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = devWiredIface->carrier(); - - cpPriv->serviceInterface = devIface->interface(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - switch (devIface->state()) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_FAILED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_UNAVAILABLE: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_DISCONNECTED: - { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Defined); - } - break; - case NM_DEVICE_STATE_ACTIVATED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); - break; - default: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - }; - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { -// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; -// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// -// //// connections -// QStringList connectionServices; -// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; -// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -// -// QString connPath; -// -// foreach (QString service, connectionServices) { -// QString ident; -// QNetworkManagerSettings *settingsiface; -// settingsiface = new QNetworkManagerSettings(service); -// QList list = settingsiface->listConnections(); -// -// foreach(QDBusObjectPath path, list) { //for each connection path -//qWarning() << path.path(); -// ident = path.path(); -// bool addIt = false; -// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -// cpPriv->isValid = true; -// cpPriv->id = ident; -// cpPriv->internet = true; -// -// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered -// | QNetworkConfiguration::Defined); -// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; -// -// QNetworkManagerSettingsConnection *sysIface; -// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// cpPriv->name = sysIface->getId();//ii.value().toString(); -//qWarning() << cpPriv->name; -// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// // get the wifi interface state first.. do we need this? -// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); -// } -// -// //#if 0 -// foreach(QString conpath, activeConnectionPaths) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// if( aConn->connection().path() == ident) { -// -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// QNetworkManagerInterfaceDevice *ifaceDevice; -// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); -// cpPriv->serviceInterface = ifaceDevice->interface(); -// cpPriv->state = getStateFlag(ifaceDevice->state()); -// //cpPriv->accessPoint = aConn->specificObject().path(); -// -// break; -// } -// } -// } -// //#endif -// // } //end while connection -// if(addIt) { -// foundConfigurations.append(cpPriv); -// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); -// } -// } -// } //end each connection service -// -// // ////////////// AccessPoints -//// QList apList = devWirelessIface->getAccessPoints(); -////// qWarning() << apList.count(); -//// foreach(QDBusObjectPath path, apList) { -//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); -//// if(cpPriv->isValid) { -//// foundConfigurations.append(cpPriv); -//// } -//// } - } // end DEVICE_TYPE_802_11_WIRELESS - break; - }; - } //end foreach device -} - void QNmWifiEngine::knownConnections() { -// qWarning() << Q_FUNC_INFO; //// connections QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; @@ -300,21 +151,18 @@ void QNmWifiEngine::knownConnections() QString connPath; + QScopedPointer settingsiface; foreach (QString service, connectionServices) { QString ident; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); -// qWarning() <setConnections(); connect(sysIface, SIGNAL(removed(QString)), this,SLOT(settingsConnectionRemoved(QString))); @@ -322,27 +170,23 @@ void QNmWifiEngine::knownConnections() cpPriv->name = sysIface->getId(); cpPriv->isValid = true; cpPriv->id = sysIface->getUuid(); -// cpPriv->id = ident; cpPriv->internet = true; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -//qWarning() << cpPriv->name; cpPriv->state = getStateForId(cpPriv->id); cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { QString mac = sysIface->getMacAddress(); if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; QString devPath; devPath = deviceConnectionPath(mac); - // qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + QNetworkManagerInterfaceDevice devIface(devPath); + cpPriv->serviceInterface = devIface.interface(); + QScopedPointer devWiredIface; + devWiredIface.reset(new QNetworkManagerInterfaceDeviceWired(devIface.connectionInterface()->path())); cpPriv->internet = devWiredIface->carrier(); // use this mac addy @@ -356,19 +200,15 @@ void QNmWifiEngine::knownConnections() } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { QString mac = sysIface->getMacAddress();; if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; QString devPath; devPath = deviceConnectionPath(mac); -// qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); + QNetworkManagerInterfaceDevice devIface(devPath); + cpPriv->serviceInterface = devIface.interface(); // use this mac addy } else { cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); } - // cpPriv->serviceInterface = devIface->interface(); addIt = true; // get the wifi interface state first.. do we need this? // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); @@ -376,6 +216,7 @@ void QNmWifiEngine::knownConnections() if(addIt) { foundConfigurations.append(cpPriv); configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + cpPriv->bearer = bearerName(cpPriv->id); } } //end each connection service } @@ -383,22 +224,21 @@ void QNmWifiEngine::knownConnections() void QNmWifiEngine::accessPointConnections() { - //qWarning() << Q_FUNC_INFO; QList list = iface->getDevices(); + QScopedPointer devIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { QList apList = availableAccessPoints.uniqueKeys(); QList::const_iterator i; for (i = apList.constBegin(); i != apList.constEnd(); ++i) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QNetworkConfigurationPrivate* cpPriv; cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); if(cpPriv->isValid) { foundConfigurations.append(cpPriv); - // qWarning() << "adding" << cpPriv->name << "to things"; configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + cpPriv->bearer = bearerName(cpPriv->id); } } } @@ -414,46 +254,43 @@ bool QNmWifiEngine::hasIdentifier(const QString &id) { if (configurationInterface.contains(id)) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { - if (cpPriv->id == id) - return true; - } + return false; } QString QNmWifiEngine::bearerName(const QString &id) { QString interface = getInterfaceFromId(id); - + QScopedPointer devIface; QList list = iface->getDevices(); foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); + if(interface == devIface->interface().name()) { + switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: - return QLatin1String("Ethernet"); - break; - case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: - return QLatin1String("WLAN"); - break; - case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: - return QLatin1String("2G"); - break; - case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: - return QLatin1String("CDMA2000"); - break; - default: - break; - }; + case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: + return QLatin1String("Ethernet"); + break; + case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: + return QLatin1String("WLAN"); + break; + case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: + return QLatin1String("2G"); + break; + case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: + return QLatin1String("CDMA2000"); + break; + default: + break; + } } } - return QString(); + return QLatin1String("Unknown"); } void QNmWifiEngine::connectToId(const QString &id) { -// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; activatingConnectionPath = id; QStringList connectionSettings = getConnectionPathForId(id); if(connectionSettings.isEmpty()) { @@ -469,34 +306,26 @@ void QNmWifiEngine::connectToId(const QString &id) devPath = deviceConnectionPath(interface); QDBusObjectPath devicePath(devPath); - iface = new QNetworkManagerInterface(); iface->activateConnection( connectionSettings.at(0), connectionPath, devicePath, connectionPath); - - connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), - this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); } void QNmWifiEngine::disconnectFromId(const QString &id) { QString activeConnectionPath = getActiveConnectionPath(id); - //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; if (!activeConnectionPath.isEmpty()) { - QNetworkManagerConnectionActive *activeCon; - activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); - QNetworkManagerSettingsConnection *settingsCon; - settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); + QScopedPointer activeCon; + activeCon.reset(new QNetworkManagerConnectionActive(activeConnectionPath)); + QScopedPointer settingsCon; + settingsCon.reset(new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path())); - if(settingsCon->isAutoConnect()) { -// qWarning() << id << "is autoconnect"; + if(settingsCon->getType() == DEVICE_TYPE_802_3_ETHERNET /*NM_DEVICE_TYPE_ETHERNET*/) { //use depreciated value for now emit connectionError(id, OperationNotSupported); - //unsupported } else { -// qWarning() <deactivateConnection(dbpath); activatingConnectionPath = ""; @@ -525,58 +354,43 @@ QNmWifiEngine *QNmWifiEngine::instance() return 0; } -void QNmWifiEngine::getKnownSsids() +void QNmWifiEngine::updateKnownSsids() { QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; + + QScopedPointer settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << sysIface->getSsid(); - knownSsids << sysIface->getSsid(); + QNetworkManagerSettingsConnection sysIface(service, path.path()); + knownSsids << sysIface.getSsid(); } } } -void QNmWifiEngine::getActiveConnectionsPaths() -{ -// qWarning() << Q_FUNC_INFO; - QNetworkManagerInterface *dbIface; +void QNmWifiEngine::updateActiveConnectionsPaths() +{ //need to know which connection paths are currently active/connected + QScopedPointer dbIface; activeConnectionPaths.clear(); - dbIface = new QNetworkManagerInterface; + dbIface.reset(new QNetworkManagerInterface); QList connections = dbIface->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - activeConnectionPaths << conpath.path(); -// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); - - QNetworkManagerConnectionActive *activeConn; - activeConn = new QNetworkManagerConnectionActive(conpath.path()); - -// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); - - } + activeConnectionPaths << conpath.path(); + } } QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) -{ //foreach accessPoint - //qWarning() << Q_FUNC_INFO << iPath << path.path(); +{ - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(iPath); - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); + QScopedPointer devIface(new QNetworkManagerInterfaceDevice(iPath)); + QScopedPointer devWirelessIface(new QNetworkManagerInterfaceDeviceWireless(iPath)); QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + QScopedPointer accessPointIface(new QNetworkManagerInterfaceAccessPoint(path.path())); QString ident = accessPointIface->connectionInterface()->path(); quint32 nmState = devIface->state(); @@ -587,7 +401,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); bool addIt = true; - //qWarning() << availableAccessPoints.count() << ssid; // if(availableAccessPoints.contains(ssid)) { // addIt = false; @@ -609,8 +422,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa cpPriv->type = QNetworkConfiguration::InternetAccessPoint; cpPriv->serviceInterface = devIface->interface(); - //qWarning() <<__FUNCTION__ << ssid; - cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); if(activeAPPath == accessPointIface->connectionInterface()->path()) { @@ -631,7 +442,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) { QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; -//qWarning() << nmState << knownSsids; // this is the state of the wifi device interface if(isKnown) state = ( QNetworkConfiguration::Defined); @@ -667,15 +477,12 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QString QNmWifiEngine::getActiveConnectionPath(const QString &id) { - //qWarning() << Q_FUNC_INFO << id; - QStringList connectionSettings = getConnectionPathForId(id); - //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - QList connections = ifaceD->activeConnections(); + QStringList connectionSettings = getConnectionPathForId(id); + QNetworkManagerInterface ifaceD; + QList connections = ifaceD.activeConnections(); + QScopedPointer conDetailsD; foreach(QDBusObjectPath path, connections) { - QNetworkManagerConnectionActive *conDetailsD; - conDetailsD = new QNetworkManagerConnectionActive( path.path()); + conDetailsD.reset(new QNetworkManagerConnectionActive( path.path())); if(conDetailsD->connection().path() == connectionSettings.at(1) && conDetailsD->serviceName() == connectionSettings.at(0)) return path.path(); @@ -685,7 +492,6 @@ QString QNmWifiEngine::getActiveConnectionPath(const QString &id) QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) { -// qWarning() << Q_FUNC_INFO << nmstate; QNetworkConfiguration::StateFlags flag; switch (nmstate) { case NM_DEVICE_STATE_UNKNOWN: @@ -718,8 +524,6 @@ QString QNmWifiEngine::getActiveConnectionPath(const QString &id) void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) { -// qWarning() << Q_FUNC_INFO << path << nmState; - if(nmState == NM_DEVICE_STATE_ACTIVATED || nmState == NM_DEVICE_STATE_DISCONNECTED || nmState == NM_DEVICE_STATE_UNAVAILABLE @@ -730,7 +534,6 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 OperationNotSupported, DisconnectionError, */ -// qWarning() << Q_FUNC_INFO << ident; QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); switch (nmState) { case NM_DEVICE_STATE_UNKNOWN: @@ -738,7 +541,6 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 state = (QNetworkConfiguration::Undefined); emit connectionError(activatingConnectionPath, ConnectError); requestUpdate(); -// qWarning() << Q_FUNC_INFO; break; case NM_DEVICE_STATE_UNAVAILABLE: state = (QNetworkConfiguration::Defined); @@ -765,8 +567,7 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 void QNmWifiEngine::addDevice(QDBusObjectPath path) { - //qWarning() << Q_FUNC_INFO << path.path(); - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path(), this); devIface->setConnections(); connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); @@ -778,7 +579,7 @@ void QNmWifiEngine::addDevice(QDBusObjectPath path) case DEVICE_TYPE_802_3_ETHERNET: { QNetworkManagerInterfaceDeviceWired * devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path(), this); devWiredIface->setConnections(); connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), this,SLOT(cmpPropertiesChanged( const QString &, QMap))); @@ -788,7 +589,7 @@ void QNmWifiEngine::addDevice(QDBusObjectPath path) case DEVICE_TYPE_802_11_WIRELESS: { QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path(), this); devWirelessIface->setConnections(); connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), @@ -834,7 +635,6 @@ void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap i(map); while (i.hasNext()) { i.next(); -// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); if( i.key() == "State") { //only applies to device interfaces updateDeviceInterfaceState(path, i.value().toUInt()); } @@ -848,8 +648,6 @@ void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap devs = aConn->devices(); + QList devs = aConn.devices(); + QScopedPointer ifaceDevice; + QScopedPointer devWiredIface; foreach(QDBusObjectPath dev, devs) { - //qWarning() << "foreach" << dev.path(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); + ifaceDevice.reset(new QNetworkManagerInterfaceDevice(dev.path())); if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { @@ -898,8 +690,7 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { isAvailable = true; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); + devWiredIface.reset(new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path())); if(!devWiredIface->carrier()) return QNetworkConfiguration::Defined; } //end eth @@ -911,9 +702,8 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id } } else { // not active - //qWarning() << Q_FUNC_INFO << "Not active"; - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); + QScopedPointer sysIface; + sysIface.reset(new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1))); if(sysIface->isValid()) { if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { QString ssid = sysIface->getSsid(); @@ -921,21 +711,16 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id if(knownSsids.contains(ssid, Qt::CaseSensitive)) { foreach(QString onessid, knownSsids) { - // qWarning() << ssid << onessid; if(onessid == ssid && availableAccessPoints.contains(ssid)) { - // qWarning() < devices = aConn->devices(); - foreach(QDBusObjectPath device, devices) { - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); - if(ifaceDevice->ip4Address() == ipaddress) { - return true; - } + + QScopedPointer aConn; + aConn.reset(new QNetworkManagerConnectionActive(aConPath)); + QScopedPointer ifaceDevice; + QList devices = aConn->devices(); + foreach(QDBusObjectPath device, devices) { + ifaceDevice.reset(new QNetworkManagerInterfaceDevice(device.path())); + if(ifaceDevice->ip4Address() == ipaddress) { + return true; } - return false; + } + return false; } QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) { // check active connections first. - QStringList conIdPath = getConnectionPathForId(id); -// qWarning() << Q_FUNC_INFO << id << conIdPath; + QStringList conIdPath = getConnectionPathForId(id); QNetworkInterface interface; - foreach(QString conpath, activeConnectionPaths) { - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(conpath); + QScopedPointer aConn; + foreach(QString conpath, activeConnectionPaths) { + aConn.reset(new QNetworkManagerConnectionActive(conpath)); if(aConn->connection().path() == conIdPath.at(1) && aConn->serviceName() == conIdPath.at(0)) { QList devs = aConn->devices(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one - interface = ifaceDevice->interface(); - return interface; + QNetworkManagerInterfaceDevice ifaceDevice(devs[0].path()); //just take the first one + return ifaceDevice.interface(); } } -//try guessing + //try guessing QList list = iface->getDevices(); + QScopedPointer devIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == type /*&& devIface->managed()*/) { - interface = devIface->interface(); if(devIface->state() == NM_STATE_DISCONNECTED) { - return interface; + return devIface->interface(); } } } - return interface; + return QNetworkInterface(); } quint64 QNmWifiEngine::receivedDataForId(const QString &id) const @@ -1037,13 +819,11 @@ quint64 QNmWifiEngine::sentDataForId(const QString &id) const void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) { - //qWarning() << Q_FUNC_INFO; requestUpdate(); } void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) { - //qWarning() << Q_FUNC_INFO; requestUpdate(); } @@ -1054,10 +834,9 @@ void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) qWarning() <<"Error" << reply.error().name() << reply.error().message() < list = iface->getDevices(); + QScopedPointer devIface; + QScopedPointer devWirelessIface; + QScopedPointer accessPointIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// qWarning() << devIface->connectionInterface()->path(); - - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface.reset(new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path())); ////////////// AccessPoints QList apList = devWirelessIface->getAccessPoints(); foreach(QDBusObjectPath path, apList) { - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + accessPointIface.reset(new QNetworkManagerInterfaceAccessPoint(path.path())); QString ssid = accessPointIface->ssid(); availableAccessPoints.insert(ssid, path); } @@ -1109,19 +886,15 @@ QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; + QScopedPointer settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); + QScopedPointer sysIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << uuid << sysIface->getUuid(); - if(sysIface->getUuid() == uuid) { -// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); + sysIface.reset(new QNetworkManagerSettingsConnection(service, path.path())); + if(sysIface->getUuid() == uuid) return QStringList() << service << sysIface->connectionInterface()->path(); - } } } return QStringList(); diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h index 1287800..470c8d3 100644 --- a/src/network/bearer/qnmwifiengine_unix_p.h +++ b/src/network/bearer/qnmwifiengine_unix_p.h @@ -112,11 +112,10 @@ private: QStringList devicePaths; - void getActiveConnectionsPaths(); - void getKnownSsids(); + void updateActiveConnectionsPaths(); + void updateKnownSsids(); void accessPointConnections(); void knownConnections(); - void findConnections(); QString deviceConnectionPath(const QString &mac); QList foundConfigurations; @@ -145,8 +144,6 @@ private slots: Q_SIGNALS: void configurationChanged(const QNetworkConfiguration& config); - void updateAccessPointState(const QString &, quint32); -// void slotActivationFinished(QDBusPendingCallWatcher*); private slots: void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index 0b2ed1a..bdd4926 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../src/bearer include(../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index 796677d..6ab0e6f 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -66,7 +66,7 @@ private slots: void configurationFromIdentifier(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -78,7 +78,7 @@ private: void tst_QNetworkConfigurationManager::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -152,7 +152,7 @@ void tst_QNetworkConfigurationManager::initTestCase() void tst_QNetworkConfigurationManager::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index 61e4097..c5a08b3 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../src/bearer include(../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index cbb13f3..e929a61 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -65,7 +65,7 @@ private slots: void isRoamingAvailable(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -77,7 +77,7 @@ private: void tst_QNetworkConfiguration::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -150,7 +150,7 @@ void tst_QNetworkConfiguration::initTestCase() void tst_QNetworkConfiguration::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index 4cb8555..b8a006b 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -9,4 +9,5 @@ CONFIG+= testcase include(../../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 53f6f4f..f3a7a07 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -107,7 +107,7 @@ int main(int argc, char** argv) session->open(); session->waitForOpened(); - } while (!(session && session->isActive())); + } while (!(session && session->isOpen())); qDebug() << "loop done"; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index cbd4c8f..86b3e46 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -46,7 +46,7 @@ #include #include -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -84,7 +84,7 @@ private: uint inProcessSessionManagementCount; -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -100,7 +100,7 @@ void tst_QNetworkSession::initTestCase() qRegisterMetaType("QNetworkSession::SessionError"); qRegisterMetaType("QNetworkConfiguration"); -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -186,7 +186,7 @@ void tst_QNetworkSession::cleanupTestCase() "tests in inProcessSessionManagement()"); } -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); @@ -212,7 +212,7 @@ void tst_QNetworkSession::cleanupTestCase() void tst_QNetworkSession::invalidSession() { QNetworkSession session(QNetworkConfiguration(), 0); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); QVERIFY(session.state() == QNetworkSession::Invalid); } @@ -236,7 +236,7 @@ void tst_QNetworkSession::sessionProperties() QVERIFY(session.configuration() == configuration); - QStringList validBearerNames = QStringList() << QString() + QStringList validBearerNames = QStringList() << QLatin1String("Unknown") << QLatin1String("Ethernet") << QLatin1String("WLAN") << QLatin1String("2G") @@ -246,10 +246,21 @@ void tst_QNetworkSession::sessionProperties() << QLatin1String("Bluetooth") << QLatin1String("WiMAX"); - if (!configuration.isValid()) - QVERIFY(session.bearerName().isEmpty()); - else - QVERIFY(validBearerNames.contains(session.bearerName())); + if (!configuration.isValid()) { + QVERIFY(configuration.bearerName().isEmpty()); + } else { + switch (configuration.type()) + { + case QNetworkConfiguration::ServiceNetwork: + case QNetworkConfiguration::UserChoice: + default: + QVERIFY(configuration.bearerName().isEmpty()); + break; + case QNetworkConfiguration::InternetAccessPoint: + QVERIFY(validBearerNames.contains(configuration.bearerName())); + break; + } + } // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. @@ -302,9 +313,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString().isEmpty()); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); // The remaining tests require the session to be not NotAvailable. @@ -324,7 +335,7 @@ void tst_QNetworkSession::userChoiceSession() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -359,7 +370,7 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.interface().isValid()); const QString userChoiceIdentifier = - session.sessionProperty("UserChoiceConfigurationIdentifier").toString(); + session.sessionProperty("UserChoiceConfiguration").toString(); QVERIFY(!userChoiceIdentifier.isEmpty()); QVERIFY(userChoiceIdentifier != configuration.identifier()); @@ -371,12 +382,12 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); const QString testIdentifier("abc"); - //resetting UserChoiceConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("UserChoiceConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("UserChoiceConfigurationIdentifier").toString() != testIdentifier); + //resetting UserChoiceConfiguration is ignored (read only property) + session.setSessionProperty("UserChoiceConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier); const QString activeIdentifier = - session.sessionProperty("ActiveConfigurationIdentifier").toString(); + session.sessionProperty("ActiveConfiguration").toString(); QVERIFY(!activeIdentifier.isEmpty()); QVERIFY(activeIdentifier != configuration.identifier()); @@ -387,9 +398,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(activeConfiguration.isValid()); QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); - //resetting ActiveConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("ActiveConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString() != testIdentifier); + //resetting ActiveConfiguration is ignored (read only property) + session.setSessionProperty("ActiveConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier); if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { QVERIFY(userChoiceConfiguration == activeConfiguration); @@ -427,7 +438,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test initial state of the session. { QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); // session may be invalid if configuration is removed between when // sessionOpenCloseStop_data() is called and here. QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || @@ -453,7 +464,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -517,7 +528,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test opening a second session. { QVERIFY(session2.configuration() == configuration); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.error() == QNetworkSession::UnknownSessionError); @@ -525,8 +536,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -550,7 +561,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); if (!errorSpy2.isEmpty()) { QVERIFY(!errorSpy.isEmpty()); @@ -632,7 +643,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() } } if (roamedSuccessfully) { - QString configId = session.sessionProperty("ActiveConfigurationIdentifier").toString(); + QString configId = session.sessionProperty("ActiveConfiguration").toString(); QNetworkConfiguration config = manager.configurationFromIdentifier(configId); QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); @@ -641,7 +652,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session3.open(); session3.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); session.stop(); @@ -682,9 +693,9 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!sessionClosedSpy2.isEmpty()); #ifndef Q_CC_NOKIAX86 - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); #endif - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); } else { // Test closing the second session. { @@ -698,8 +709,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(sessionClosedSpy.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(!session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -724,7 +735,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); if (expectStateChange) QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -781,12 +792,15 @@ void tst_QNetworkSession::outOfProcessSession() QList before = manager.allConfigurations(QNetworkConfiguration::Active); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); + // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. QLocalServer oopServer; + // First remove possible earlier listening address which would cause listen to fail + // (e.g. previously abruptly ended unit test might cause this) + QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); QProcess lackey; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index 1410601..ccc405e 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../../src/bearer include(../../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer wince* { LACKEY.sources = $$OUTPUT_DIR/build/tests/bin/qnetworksessionlackey.exe diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index 68590cc..f62d8d2 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -69,10 +69,6 @@ void BearerEx::createMenus() menuBar()->addAction(act1); connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked())); - m_openAction = new QAction(tr("Open Session"), this); - menuBar()->addAction(m_openAction); - connect(m_openAction, SIGNAL(triggered()), this, SLOT(on_openSessionButton_clicked())); - QAction* exitAct = new QAction(tr("Exit"), this); menuBar()->addAction(exitAct); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -290,7 +286,7 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); + bearerLineEdit->setText(apNetworkConfiguration->bearerName()); sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ QString(" / ")+ QString::number(m_NetworkSession->bytesReceived())); @@ -341,7 +337,7 @@ void SessionTab::on_sendRequestButton_clicked() void SessionTab::on_openSessionButton_clicked() { m_NetworkSession->open(); - if (m_NetworkSession->isActive()) { + if (m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -349,7 +345,7 @@ void SessionTab::on_openSessionButton_clicked() void SessionTab::on_closeSessionButton_clicked() { m_NetworkSession->close(); - if (!m_NetworkSession->isActive()) { + if (!m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -418,7 +414,7 @@ void SessionTab::opened() listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); m_eventListWidget->addItem(listItem); - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -428,7 +424,7 @@ void SessionTab::opened() } if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) { - QVariant identifier = m_NetworkSession->property("UserChoiceConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -490,22 +486,21 @@ void SessionTab::stateChanged(QNetworkSession::State state) void SessionTab::newState(QNetworkSession::State state) { - if (state == QNetworkSession::Connected) { - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); - if (!identifier.isNull()) { - QString configId = identifier.toString(); - QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); - if (config.isValid()) { - iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); - } + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); + if (state == QNetworkSession::Connected && !identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid()) { + iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + bearerLineEdit->setText(config.bearerName()); } + } else { + bearerLineEdit->setText(m_NetworkSession->configuration().bearerName()); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); - QString active; - if (m_NetworkSession->isActive()) { - active = " (A)"; + if (m_NetworkSession->isOpen()) { + active = " (O)"; } stateLineEdit->setText(stateString(state)+active); } diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index f18180e..b8a2393 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -51,7 +51,10 @@ #include "qnetworksession.h" #include "xqlistwidget.h" +QT_BEGIN_NAMESPACE class QHttp; +QT_END_NAMESPACE + class SessionTab; QTM_USE_NAMESPACE diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro index a870eb1..e480d43 100644 --- a/tests/manual/bearerex/bearerex.pro +++ b/tests/manual/bearerex/bearerex.pro @@ -24,11 +24,6 @@ SOURCES += bearerex.cpp \ main.cpp \ xqlistwidget.cpp -symbian: { - bearerex.sources = Qtbearer.dll - bearerex.path = /sys/bin - DEPLOYMENT += bearerex - - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/manual/networkmanager/networkmanager.pro b/tests/manual/networkmanager/networkmanager.pro index 31b2af1..7ff370a 100644 --- a/tests/manual/networkmanager/networkmanager.pro +++ b/tests/manual/networkmanager/networkmanager.pro @@ -12,7 +12,8 @@ requires(contains(QT_CONFIG,dbus)) INCLUDEPATH += ../../src/bearer include(../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer #MOC_DIR = .moc #OBJECTS_DIR = .obj diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp index ca9d907..fde5cae 100644 --- a/tests/manual/networkmanager/nmview.cpp +++ b/tests/manual/networkmanager/nmview.cpp @@ -188,8 +188,6 @@ void NMView::getActiveConnections() void NMView::update() { -// if(sess) -// qWarning() << __FUNCTION__<< sess->bytesWritten() << sess->bearerName(); // QNetworkManagerInterface *dbIface; // dbIface = new QNetworkManagerInterface; // QList connections = dbIface->activeConnections(); diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h index 641385e..e15aacd 100644 --- a/tests/manual/networkmanager/nmview.h +++ b/tests/manual/networkmanager/nmview.h @@ -49,9 +49,11 @@ QTM_USE_NAMESPACE +QT_BEGIN_NAMESPACE class QListWidget; class QTreeWidget; class QTreeWidgetItem; +QT_END_NAMESPACE class NMView : public QDialog, private Ui::Dialog { -- cgit v0.12 From 4ef1103e6b399cb9421fb001f81af47bca20d2a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 09:35:51 +1000 Subject: Fix failure on Windows after merge. --- src/plugins/bearer/nla/qnlaengine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index be1cd28..51897f0 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -406,8 +406,6 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name)); cpPriv->state = QNetworkConfiguration::Defined; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - if (QNlaEngine *engine = qobject_cast(parent())) - config->bearer = engine->bearerName(config->id); #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "size:" << querySet->dwSize; @@ -443,6 +441,9 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query } while (offset != 0 && offset < querySet->lpBlob->cbSize); } + if (QNlaEngine *engine = qobject_cast(parent())) + cpPriv->bearer = engine->bearerName(cpPriv->id); + return cpPriv; } -- cgit v0.12 From b2fc251bb4628a06282d1dcaeda79222b300b912 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 09:43:03 +1000 Subject: Bearer Management Integration 3. --- src/network/bearer/qcorewlanengine_mac.mm | 16 ++-------------- src/network/bearer/qcorewlanengine_mac_p.h | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 41ec79a..6fad457 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -75,7 +75,7 @@ inline QString cfstringRefToQstring(CFStringRef cfStringRef) { if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { retVal = QString::fromUtf8(cstring); } - delete cstring; + delete[] cstring; return retVal; } @@ -315,7 +315,7 @@ QList QCoreWlanEngine::scanForSsids(const QStrin CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; NSError *err = nil; NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; CWNetwork *apNetwork; if(!err) { @@ -396,18 +396,6 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s return false; } -QList QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) -{ - Q_UNUSED(interfaceName) -#if defined(MAC_SDK_10_6) -// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { -// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); -// } - -#endif - return QList (); -} - bool QCoreWlanEngine::getAllScInterfaces() { networkInterfaces.clear(); diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h index 6ad093a..5bdba3d 100644 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ b/src/network/bearer/qcorewlanengine_mac_p.h @@ -88,8 +88,6 @@ private: QTimer pollTimer; QList scanForSsids(const QString &interfaceName); - QList getWlanProfiles(const QString &interfaceName); - bool isKnownSsid(const QString &interfaceName, const QString &ssid); QList foundConfigurations; -- cgit v0.12 From 6cdcb06d6d8fb60f250aa0389e8d545d0d52fb79 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 10:01:30 +1000 Subject: Fix failures on Mac OS X after merge. --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 3ceebbd..2a3fecf 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -306,6 +306,7 @@ void QCoreWlanEngine::doRequestUpdate() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->bearer = qGetInterfaceType(interface.name()); accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); @@ -345,6 +346,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) apNetwork = [apArray objectAtIndex:row]; + const QString networkSsid = nsstringToQString([apNetwork ssid]); + const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); found.append(id); -- cgit v0.12 From 6b700e2bc14d2b159c2faa6f3fe8ca6d77d42f5b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 10:01:55 +1000 Subject: Fix test compile failure when using frameworks on Mac OS X. --- src/network/bearer/qbearerplugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h index 036d712..970410b 100644 --- a/src/network/bearer/qbearerplugin.h +++ b/src/network/bearer/qbearerplugin.h @@ -42,7 +42,7 @@ #ifndef QBEARERPLUGIN_H #define QBEARERPLUGIN_H -#include "qnetworksessionengine_p.h" +#include #include #include -- cgit v0.12 From bd532d0cb6da5d09e048192171d7f5263e22eca6 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 4 Dec 2009 09:48:46 +1000 Subject: Fix build on Maemo, force type to qreal. --- src/gui/painting/qpainter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fc1863f..ab5773e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + // QtCore #include #include @@ -5918,7 +5919,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) if (QPixmapCache::find(key, pixmap)) return pixmap; - const qreal halfPeriod = qMax(qreal(2), radiusBase * 1.61803399); // the golden ratio + const qreal halfPeriod = qMax(qreal(2), radiusBase * qreal(1.61803399)); // the golden ratio const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); const int radius = qFloor(radiusBase); -- cgit v0.12 From b2477aec2adad08c4f44ffcdc2f9ad1c0ce4a56b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 7 Jan 2010 13:03:34 +1000 Subject: Make compile for Symbian. --- src/network/bearer/bearer.pri | 12 ++++---- src/network/bearer/qnetworkconfigmanager.cpp | 36 ++++++++++++++++++++++++ src/network/bearer/qnetworkconfigmanager_s60_p.h | 4 +-- src/network/bearer/qnetworkconfiguration_s60_p.h | 2 +- src/plugins/bearer/bearer.pro | 2 ++ 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 4f6c549..766e717 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -4,13 +4,11 @@ HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworksession.h \ - bearer/qnetworkconfigmanager.h \ - bearer/qbearerplugin.h + bearer/qnetworkconfigmanager.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ - bearer/qnetworkconfiguration.cpp \ - bearer/qbearerplugin.cpp + bearer/qnetworkconfiguration.cpp symbian { exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ @@ -72,11 +70,13 @@ symbian { HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ - bearer/qnetworksessionengine_p.h + bearer/qnetworksessionengine_p.h \ + bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ bearer/qnetworksession_p.cpp \ - bearer/qnetworksessionengine.cpp + bearer/qnetworksessionengine.cpp \ + bearer/qbearerplugin.cpp contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM } diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 6b73e3c..7f58e07 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -238,6 +238,32 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); +#ifdef Q_OS_SYMBIAN + QList cpsIdents = conPriv->accessPointConfigurations.keys(); + + //find all InternetAccessPoints + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->accessPointConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->accessPointConfigurations.value(ii); + result << pt; + } + } + + //find all service networks + cpsIdents = conPriv->snapConfigurations.keys(); + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->snapConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->snapConfigurations.value(ii); + result << pt; + } + } +#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); @@ -264,6 +290,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe } } } +#endif return result; } @@ -280,6 +307,14 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; +#ifdef Q_OS_SYMBIAN + if (conPriv->accessPointConfigurations.contains(identifier)) + item.d = conPriv->accessPointConfigurations.value(identifier); + else if (conPriv->snapConfigurations.contains(identifier)) + item.d = conPriv->snapConfigurations.value(identifier); + else if (conPriv->userChoiceConfigurations.contains(identifier)) + item.d = conPriv->userChoiceConfigurations.value(identifier); +#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); @@ -292,6 +327,7 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( return item; } +#endif return item; } diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index 568803d..3378898 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include -#include +#include +#include "qnetworkconfiguration_s60_p.h" #include #include diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index 0973152..5e75c13 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 58d2613..05fce8c 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,7 +1,9 @@ TEMPLATE = subdirs +!symbian:!maemo { SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan +} -- cgit v0.12 From aed972b88e96596114ef8a5a350063744220f8c4 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 11 Jan 2010 12:09:34 +1000 Subject: Return empty bearer name for invalid, ServiceNetwork and UserChoice. --- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 3064840..d01d4d9 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -68,7 +68,7 @@ QString QNetworkConfigurationPrivate::bearerName() const case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QLatin1String("Unknown"); + default: return QString(); } } -- cgit v0.12 From e620ab4a391ea1c86718856b31f6a5c4928a18a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 12 Jan 2010 16:15:26 +1000 Subject: Partially convert Symbian backend into a plugin. QNetworkSession functionality not converted yet. --- src/network/bearer/bearer.pri | 30 +- src/network/bearer/qnetworkconfigmanager.cpp | 42 - src/network/bearer/qnetworkconfigmanager_p.cpp | 122 +-- src/network/bearer/qnetworkconfigmanager_p.h | 2 - src/network/bearer/qnetworkconfigmanager_s60_p.cpp | 974 --------------------- src/network/bearer/qnetworkconfigmanager_s60_p.h | 185 ---- src/network/bearer/qnetworkconfiguration.cpp | 4 - src/network/bearer/qnetworkconfiguration_p.h | 1 - src/network/bearer/qnetworkconfiguration_s60_p.cpp | 17 - src/network/bearer/qnetworkconfiguration_s60_p.h | 109 --- src/network/bearer/qnetworksession.cpp | 8 +- src/network/bearer/qnetworksessionengine.cpp | 6 + src/network/bearer/qnetworksessionengine_p.h | 3 + src/plugins/bearer/bearer.pro | 3 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 + src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 + src/plugins/bearer/generic/qgenericengine.cpp | 7 + src/plugins/bearer/generic/qgenericengine.h | 2 + .../bearer/nativewifi/qnativewifiengine.cpp | 6 + src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 + .../networkmanager/qnetworkmanagerengine.cpp | 6 + .../bearer/networkmanager/qnetworkmanagerengine.h | 2 + src/plugins/bearer/nla/qnlaengine.cpp | 5 + src/plugins/bearer/nla/qnlaengine.h | 2 + src/plugins/bearer/symbian/main.cpp | 86 ++ src/plugins/bearer/symbian/symbian.pro | 33 + src/plugins/bearer/symbian/symbianengine.cpp | 931 ++++++++++++++++++++ src/plugins/bearer/symbian/symbianengine.h | 201 +++++ src/s60installs/s60installs.pro | 10 +- 29 files changed, 1334 insertions(+), 1472 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.cpp delete mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.h delete mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.h create mode 100644 src/plugins/bearer/symbian/main.cpp create mode 100644 src/plugins/bearer/symbian/symbian.pro create mode 100644 src/plugins/bearer/symbian/symbianengine.cpp create mode 100644 src/plugins/bearer/symbian/symbianengine.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 766e717..169c8b7 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -10,35 +10,11 @@ SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ bearer/qnetworkconfiguration.cpp -symbian { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { - message("Building with SNAP support") - DEFINES += SNAP_FUNCTIONALITY_AVAILABLE - LIBS += -lcmmanager - } else { - message("Building without SNAP support") - LIBS += -lapengine - } - - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +symbian_disabled { + HEADERS += bearer/qnetworksession_s60_p.h - HEADERS += bearer/qnetworkconfigmanager_s60_p.h \ - bearer/qnetworkconfiguration_s60_p.h \ - bearer/qnetworksession_s60_p.h - SOURCES += bearer/qnetworkconfigmanager_s60_p.cpp \ - bearer/qnetworkconfiguration_s60_p.cpp \ + SOURCES += bearer/qnetworkconfiguration_s60_p.cpp \ bearer/qnetworksession_s60_p.cpp - - LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ - -lcentralrepository \ - -lesock \ - -linsock \ - -lecom \ - -lefsrv \ - -lnetmeta } else:maemo { QT += dbus CONFIG += link_pkgconfig diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 7f58e07..f4daf4a 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -41,12 +41,8 @@ #include "qnetworkconfigmanager.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworkconfigmanager_s60_p.h" -#else #include "qnetworkconfigmanager_p.h" #include "qnetworksessionengine_p.h" -#endif #include @@ -54,12 +50,10 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); -#ifndef Q_OS_SYMBIAN QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { return connManager(); } -#endif /*! \class QNetworkConfigurationManager @@ -238,32 +232,6 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); -#ifdef Q_OS_SYMBIAN - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - - //find all InternetAccessPoints - foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - result << pt; - } - } - - //find all service networks - cpsIdents = conPriv->snapConfigurations.keys(); - foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->snapConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->snapConfigurations.value(ii); - result << pt; - } - } -#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); @@ -290,7 +258,6 @@ QList QNetworkConfigurationManager::allConfigurations(QNe } } } -#endif return result; } @@ -307,14 +274,6 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; -#ifdef Q_OS_SYMBIAN - if (conPriv->accessPointConfigurations.contains(identifier)) - item.d = conPriv->accessPointConfigurations.value(identifier); - else if (conPriv->snapConfigurations.contains(identifier)) - item.d = conPriv->snapConfigurations.value(identifier); - else if (conPriv->userChoiceConfigurations.contains(identifier)) - item.d = conPriv->userChoiceConfigurations.value(identifier); -#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); @@ -327,7 +286,6 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( return item; } -#endif return item; } diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index cb83789..c00d6d3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -59,11 +59,6 @@ QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() delete sessionEngines.takeFirst(); } -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags = QNetworkConfigurationManager::ForcedRoaming; -} - void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { if (!firstUpdate) { @@ -177,106 +172,25 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() updating = false; QFactoryLoader *l = loader(); - QStringList keys = l->keys(); - - if (keys.contains(QLatin1String("corewlan"))) { - QBearerEnginePlugin *coreWlanPlugin = - qobject_cast(l->instance(QLatin1String("corewlan"))); - if (coreWlanPlugin) { - QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); - if (coreWifi) { - sessionEngines.append(coreWifi); - connect(coreWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(coreWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(coreWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(coreWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("networkmanager"))) { - QBearerEnginePlugin *nmPlugin = - qobject_cast(l->instance(QLatin1String("networkmanager"))); - if (nmPlugin) { - QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); - if (nmWifi) { - sessionEngines.append(nmWifi); - connect(nmWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nmWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("generic"))) { - QBearerEnginePlugin *genericPlugin = - qobject_cast(l->instance(QLatin1String("generic"))); - if (genericPlugin) { - QNetworkSessionEngine *generic = genericPlugin->create(QLatin1String("generic")); - if (generic) { - sessionEngines.append(generic); - connect(generic, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(generic, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("nla"))) { - QBearerEnginePlugin *nlaPlugin = - qobject_cast(l->instance(QLatin1String("nla"))); - if (nlaPlugin) { - QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); - if (nla) { - sessionEngines.append(nla); - connect(nla, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nla, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nla, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nla, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - if (keys.contains(QLatin1String("nativewifi"))) { - QBearerEnginePlugin *nativeWifiPlugin = - qobject_cast(l->instance(QLatin1String("nativewifi"))); - if (nativeWifiPlugin) { - QNetworkSessionEngine *nativeWifi = - nativeWifiPlugin->create(QLatin1String("nativewifi")); - if (nativeWifi) { - sessionEngines.append(nativeWifi); - connect(nativeWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nativeWifi, - SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nativeWifi, - SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nativeWifi, - SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - } + foreach (const QString &key, l->keys()) { + QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); + if (plugin) { + QNetworkSessionEngine *engine = plugin->create(key); + if (!engine) + continue; + + sessionEngines.append(engine); + connect(engine, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); + + capFlags |= engine->capabilities(); } } } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index a45d534..d7a813b 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -67,7 +67,6 @@ public: QNetworkConfigurationManagerPrivate() : QObject(0), capFlags(0), firstUpdate(true) { - registerPlatformCapabilities(); updateConfigurations(); } @@ -76,7 +75,6 @@ public: QNetworkConfiguration defaultConfiguration(); QNetworkConfigurationManager::Capabilities capFlags; - void registerPlatformCapabilities(); void performAsyncConfigurationUpdate(); diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp deleted file mode 100644 index b5bd4d2..0000000 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp +++ /dev/null @@ -1,974 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworkconfigmanager_s60_p.h" - -#include -#include -#include - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include - #include - #include - #include - #include - #include -#else - #include - #include - #include -#endif - -QT_BEGIN_NAMESPACE - -static const int KValueThatWillBeAddedToSNAPId = 1000; -static const int KUserChoiceIAPId = 0; - -QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() - : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0), iFirstUpdate(true), iInitOk(true) -{ - CActiveScheduler::Add(this); - - registerPlatformCapabilities(); - TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); - if (error != KErrNone) { - iInitOk = false; - return; - } - - TRAP_IGNORE(iConnectionMonitor.ConnectL()); - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - TRAP(error, iCmManager.OpenL()); - if (error != KErrNone) { - iInitOk = false; - return; - } -#endif - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = "UserChoice"; - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->isValid = true; - cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); - cpPriv->numericId = KUserChoiceIAPId; - cpPriv->connectionId = 0; - cpPriv->type = QNetworkConfiguration::UserChoice; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - QExplicitlySharedDataPointer ptr(cpPriv); - userChoiceConfigurations.insert(cpPriv->id, ptr); - - updateConfigurations(); - updateStatesToSnaps(); - - // Start monitoring IAP and/or SNAP changes in Symbian CommsDB - startCommsDatabaseNotifications(); -} - -QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() -{ - Cancel(); - - QList configIdents = snapConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = userChoiceConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - priv->manager = 0; - } - - iConnectionMonitor.CancelNotifications(); - iConnectionMonitor.Close(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iCmManager.Close(); -#endif - - delete ipAccessPointsAvailabilityScanner; - delete ipCommsDB; -} - - -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - capFlags |= QNetworkConfigurationManager::DirectConnectionRouting; - capFlags |= QNetworkConfigurationManager::SystemSessionSupport; -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming; - capFlags |= QNetworkConfigurationManager::ForcedRoaming; -#endif - capFlags |= QNetworkConfigurationManager::DataStatistics; -} - -void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() -{ - if (!iInitOk || iUpdateGoingOn) { - return; - } - iUpdateGoingOn = true; - - stopCommsDatabaseNotifications(); - updateConfigurations(); // Synchronous call - updateAvailableAccessPoints(); // Asynchronous call -} - -void QNetworkConfigurationManagerPrivate::updateConfigurations() -{ - if (!iInitOk) { - return; - } - - TRAP_IGNORE(updateConfigurationsL()); -} - -void QNetworkConfigurationManagerPrivate::updateConfigurationsL() -{ - QList knownConfigs = accessPointConfigurations.keys(); - QList knownSnapConfigs = snapConfigurations.keys(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - // S60 version is >= Series60 3rd Edition Feature Pack 2 - TInt error = KErrNone; - - // Loop through all IAPs - RArray connectionMethods; // IAPs - CleanupClosePushL(connectionMethods); - iCmManager.ConnectionMethodL(connectionMethods); - for(int i = 0; i < connectionMethods.Count(); i++) { - RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); - CleanupClosePushL(connectionMethod); - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); - if (accessPointConfigurations.contains(ident)) { - knownConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = NULL; - TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); - if (error == KErrNone) { - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(cpPriv->id, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } - } - CleanupStack::PopAndDestroy(&connectionMethod); - } - CleanupStack::PopAndDestroy(&connectionMethods); - - // Loop through all SNAPs - RArray destinations; - CleanupClosePushL(destinations); - iCmManager.AllDestinationsL(destinations); - for(int i = 0; i < destinations.Count(); i++) { - RCmDestination destination; - destination = iCmManager.DestinationL(destinations[i]); - CleanupClosePushL(destination); - QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids - if (snapConfigurations.contains(ident)) { - knownSnapConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - CleanupStack::PushL(cpPriv); - - HBufC *pName = destination.NameLC(); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->numericId = destination.Id(); - cpPriv->connectionId = 0; - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->type = QNetworkConfiguration::ServiceNetwork; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - - QExplicitlySharedDataPointer ptr(cpPriv); - snapConfigurations.insert(ident, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - - CleanupStack::Pop(cpPriv); - } - QExplicitlySharedDataPointer privSNAP = snapConfigurations.value(ident); - - for (int j=0; j < destination.ConnectionMethodCount(); j++) { - RCmConnectionMethod connectionMethod = destination.ConnectionMethodL(j); - CleanupClosePushL(connectionMethod); - - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString iface = QString::number(qHash(iapId)); - // Check that IAP can be found from accessPointConfigurations list - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data() == 0) { - QNetworkConfigurationPrivate* cpPriv = NULL; - TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); - if (error == KErrNone) { - QExplicitlySharedDataPointer ptr(cpPriv); - ptr.data()->serviceNetworkPtr = privSNAP; - accessPointConfigurations.insert(cpPriv->id, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - privSNAP->serviceNetworkMembers.append(ptr); - } - } else { - knownConfigs.removeOne(iface); - // Check that IAP can be found from related SNAP's configuration list - bool iapFound = false; - for (int i=0; iserviceNetworkMembers.count(); i++) { - if (privSNAP->serviceNetworkMembers[i]->numericId == iapId) { - iapFound = true; - break; - } - } - if (!iapFound) { - priv.data()->serviceNetworkPtr = privSNAP; - privSNAP->serviceNetworkMembers.append(priv); - } - } - - CleanupStack::PopAndDestroy(&connectionMethod); - } - - if (privSNAP->serviceNetworkMembers.count() > 1) { - // Roaming is supported only if SNAP contains more than one IAP - privSNAP->roamingSupported = true; - } - - CleanupStack::PopAndDestroy(&destination); - } - CleanupStack::PopAndDestroy(&destinations); - -#else - // S60 version is < Series60 3rd Edition Feature Pack 2 - CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); - - // Loop through all IAPs - TUint32 apId = 0; - TInt retVal = pDbTView->GotoFirstRecord(); - while (retVal == KErrNone) { - pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); - QString ident = QString::number(qHash(apId)); - if (accessPointConfigurations.contains(ident)) { - knownConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(ident, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } else { - delete cpPriv; - } - } - retVal = pDbTView->GotoNextRecord(); - } - CleanupStack::PopAndDestroy(pDbTView); -#endif - updateActiveAccessPoints(); - - foreach (QString oldIface, knownConfigs) { - //remove non existing IAP - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - } - // Remove non existing IAP from SNAPs - QList snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { - QExplicitlySharedDataPointer priv2 = snapConfigurations.value(iface); - // => Check if one of the IAPs of the SNAP is active - for (int i=0; iserviceNetworkMembers.count(); i++) { - if (priv2->serviceNetworkMembers[i]->numericId == priv->numericId) { - priv2->serviceNetworkMembers.removeAt(i); - break; - } - } - } - } - foreach (QString oldIface, knownSnapConfigs) { - //remove non existing SNAPs - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - } - } - - iFirstUpdate = false; -} - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -QNetworkConfigurationPrivate* QNetworkConfigurationManagerPrivate::configFromConnectionMethodL( - RCmConnectionMethod& connectionMethod) -{ - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - CleanupStack::PushL(cpPriv); - - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); - - HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); - CleanupStack::PushL(pName); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - - TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); - switch (bearerId) { - case KCommDbBearerCSD: - cpPriv->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case KCommDbBearerWcdma: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerWCDMA; - break; - case KCommDbBearerLAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - case KCommDbBearerVirtual: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - case KCommDbBearerPAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - case KCommDbBearerWLAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerWLAN; - break; - default: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - } - - TInt error = KErrNone; - TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType); - switch (bearerType) { - case KUidPacketDataBearerType: - // "Packet data" Bearer => Mapping is done using "Access point name" - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EPacketDataAPName)); - break; - case KUidWlanBearerType: - // "Wireless LAN" Bearer => Mapping is done using "WLAN network name" = SSID - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EWlanSSID)); - break; - } - if (!pName) { - // "Data call" Bearer or "High Speed (GSM)" Bearer => Mapping is done using "Dial-up number" - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EDialDefaultTelNum)); - } - - if (error == KErrNone && pName) { - CleanupStack::PushL(pName); - cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - } - - cpPriv->state = QNetworkConfiguration::Defined; - TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected); - if (isConnected) { - cpPriv->state = QNetworkConfiguration::Active; - } - - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->numericId = iapId; - cpPriv->connectionId = 0; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - - CleanupStack::Pop(cpPriv); - return cpPriv; -} -#else -bool QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDb( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) -{ - TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); - if (error != KErrNone) { - return false; - } - return true; -} - -void QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDbL( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) -{ - CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); - CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); - TBuf name; - - CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB); - TUint32 apId = pApUtils->WapIdFromIapIdL(aApId); - - pDataHandler->AccessPointDataL(apId,*pAPItem); - pAPItem->ReadTextL(EApIapName, name); - if (name.Compare(_L("Easy WLAN")) == 0) { - // "Easy WLAN" won't be accepted to the Configurations list - User::Leave(KErrNotFound); - } - - QString ident = QString::number(qHash(aApId)); - - apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); - apNetworkConfiguration->isValid = true; - apNetworkConfiguration->id = ident; - apNetworkConfiguration->numericId = aApId; - apNetworkConfiguration->connectionId = 0; - apNetworkConfiguration->state = (QNetworkConfiguration::Defined); - apNetworkConfiguration->type = QNetworkConfiguration::InternetAccessPoint; - apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose; - apNetworkConfiguration->roamingSupported = false; - switch (pAPItem->BearerTypeL()) { - case EApBearerTypeCSD: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case EApBearerTypeGPRS: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case EApBearerTypeHSCSD: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerHSPA; - break; - case EApBearerTypeCDMA: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerCDMA2000; - break; - case EApBearerTypeWLAN: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerWLAN; - break; - case EApBearerTypeLAN: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - case EApBearerTypeLANModem: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - default: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - } - apNetworkConfiguration->manager = this; - - CleanupStack::PopAndDestroy(pApUtils); - CleanupStack::PopAndDestroy(pAPItem); - CleanupStack::PopAndDestroy(pDataHandler); -} -#endif - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() -{ - QNetworkConfiguration config; - - if (iInitOk) { - stopCommsDatabaseNotifications(); - TRAP_IGNORE(config = defaultConfigurationL()); - startCommsDatabaseNotifications(); - } - - return config; -} - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfigurationL() -{ - QNetworkConfiguration item; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - // Check Default Connection (SNAP or IAP) - TCmDefConnValue defaultConnectionValue; - iCmManager.ReadDefConnL(defaultConnectionValue); - if (defaultConnectionValue.iType == ECmDefConnDestination) { - QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); - QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { - QString iface = QString::number(qHash(defaultConnectionValue.iId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } -#endif - - if (!item.isValid()) { - QString iface = QString::number(qHash(KUserChoiceIAPId)); - QExplicitlySharedDataPointer priv = userChoiceConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } - - return item; -} - -void QNetworkConfigurationManagerPrivate::updateActiveAccessPoints() -{ - bool online = false; - QList inactiveConfigs = accessPointConfigurations.keys(); - - TRequestStatus status; - TUint connectionCount; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest(status); - - // Go through all connections and set state of related IAPs to Active - TUint connectionId; - TUint subConnectionCount; - TUint apId; - if (status.Int() == KErrNone) { - for (TUint i = 1; i <= connectionCount; i++) { - iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - online = true; - inactiveConfigs.removeOne(ident); - priv.data()->connectionId = connectionId; - // Configuration is Active - changeConfigurationStateTo(priv, QNetworkConfiguration::Active); - } - } - } - - // Make sure that state of rest of the IAPs won't be Active - foreach (QString iface, inactiveConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is either Defined or Discovered - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered); - } - } - - if (iOnline != online) { - iOnline = online; - emit this->onlineStateChanged(iOnline); - } -} - -void QNetworkConfigurationManagerPrivate::updateAvailableAccessPoints() -{ - if (!ipAccessPointsAvailabilityScanner) { - ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); - } - if (ipAccessPointsAvailabilityScanner) { - // Scanning may take a while because WLAN scanning will be done (if device supports WLAN). - ipAccessPointsAvailabilityScanner->StartScanning(); - } -} - -void QNetworkConfigurationManagerPrivate::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) -{ - iUpdateGoingOn = false; - if (scanSuccessful) { - QList unavailableConfigs = accessPointConfigurations.keys(); - - // Set state of returned IAPs to Discovered - // if state is not already Active - for(TUint i=0; i priv = accessPointConfigurations.value(ident); - if (priv.data()) { - unavailableConfigs.removeOne(ident); - if (priv.data()->state < QNetworkConfiguration::Active) { - // Configuration is either Discovered or Active - changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); - } - } - } - - // Make sure that state of rest of the IAPs won't be Discovered or Active - foreach (QString iface, unavailableConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is Defined - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); - } - } - } - - updateStatesToSnaps(); - - startCommsDatabaseNotifications(); - - emit this->configurationUpdateComplete(); -} - -void QNetworkConfigurationManagerPrivate::updateStatesToSnaps() -{ - // Go through SNAPs and set correct state to SNAPs - QList snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { - bool discovered = false; - bool active = false; - QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); - // => Check if one of the IAPs of the SNAP is discovered or active - // => If one of IAPs is active, also SNAP is active - // => If one of IAPs is discovered but none of the IAPs is active, SNAP is discovered - for (int i=0; iserviceNetworkMembers.count(); i++) { - QExplicitlySharedDataPointer priv2 = priv->serviceNetworkMembers[i]; - if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Active) - == QNetworkConfiguration::Active) { - active = true; - break; - } else if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Discovered) - == QNetworkConfiguration::Discovered) { - discovered = true; - } - } - if (active) { - changeConfigurationStateTo(priv, QNetworkConfiguration::Active); - } else if (discovered) { - changeConfigurationStateTo(priv, QNetworkConfiguration::Discovered); - } else { - changeConfigurationStateTo(priv, QNetworkConfiguration::Defined); - } - } -} - -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if (newState != sharedData.data()->state) { - sharedData.data()->state = newState; - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -/* changeConfigurationStateAtMinTo function does not overwrite possible better - * state (e.g. Discovered state does not overwrite Active state) but - * makes sure that state is at minimum given state. -*/ -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if ((newState | sharedData.data()->state) != sharedData.data()->state) { - sharedData.data()->state = (sharedData.data()->state | newState); - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -/* changeConfigurationStateAtMaxTo function overwrites possible better - * state (e.g. Discovered state overwrites Active state) and - * makes sure that state is at maximum given state (e.g. Discovered state - * does not overwrite Defined state). -*/ -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if ((newState & sharedData.data()->state) != sharedData.data()->state) { - sharedData.data()->state = (newState & sharedData.data()->state); - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -void QNetworkConfigurationManagerPrivate::startCommsDatabaseNotifications() -{ - if (!iWaitingCommsDatabaseNotifications) { - iWaitingCommsDatabaseNotifications = ETrue; - if (!IsActive()) { - SetActive(); - // Start waiting for new notification - ipCommsDB->RequestNotification(iStatus); - } - } -} - -void QNetworkConfigurationManagerPrivate::stopCommsDatabaseNotifications() -{ - if (iWaitingCommsDatabaseNotifications) { - iWaitingCommsDatabaseNotifications = EFalse; - if (!IsActive()) { - SetActive(); - // Make sure that notifier recorded events will not be returned - // as soon as the client issues the next RequestNotification() request. - ipCommsDB->RequestNotification(iStatus); - ipCommsDB->CancelRequestNotification(); - } else { - ipCommsDB->CancelRequestNotification(); - } - } -} - -void QNetworkConfigurationManagerPrivate::RunL() -{ - if (iStatus != KErrCancel) { - RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); - switch (event) { - case RDbNotifier::EUnlock: /** All read locks have been removed. */ - case RDbNotifier::ECommit: /** A transaction has been committed. */ - case RDbNotifier::ERollback: /** A transaction has been rolled back */ - case RDbNotifier::ERecover: /** The database has been recovered */ - // Note that if further database events occur while a client is handling - // a request completion, the notifier records the most significant database - // event and this is signalled as soon as the client issues the next - // RequestNotification() request. - // => Stop recording notifications - stopCommsDatabaseNotifications(); - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); - } - iWaitingCommsDatabaseNotifications = true; - break; - default: - // Do nothing - break; - } - } - - if (iWaitingCommsDatabaseNotifications) { - if (!IsActive()) { - SetActive(); - // Start waiting for new notification - ipCommsDB->RequestNotification(iStatus); - } - } -} - -void QNetworkConfigurationManagerPrivate::DoCancel() -{ - ipCommsDB->CancelRequestNotification(); -} - - -void QNetworkConfigurationManagerPrivate::EventL(const CConnMonEventBase& aEvent) -{ - switch (aEvent.EventType()) { - case EConnMonCreateConnection: - { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint subConnectionCount = 0; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - priv.data()->connectionId = connectionId; - // Configuration is Active - if (changeConfigurationStateTo(priv, QNetworkConfiguration::Active)) { - updateStatesToSnaps(); - } - if (!iOnline) { - iOnline = true; - emit this->onlineStateChanged(iOnline); - } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - QExplicitlySharedDataPointer priv = dataByConnectionId(connectionId); - if (priv.data()) { - priv.data()->connectionId = 0; - // Configuration is either Defined or Discovered - if (changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered)) { - updateStatesToSnaps(); - } - } - - bool online = false; - QList iapConfigs = accessPointConfigurations.keys(); - foreach (QString iface, iapConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()->state == QNetworkConfiguration::Active) { - online = true; - break; - } - } - if (iOnline != online) { - iOnline = online; - emit this->onlineStateChanged(iOnline); - } - } - break; - - case EConnMonIapAvailabilityChange: - { - CConnMonIapAvailabilityChange* realEvent; - realEvent = (CConnMonIapAvailabilityChange*) &aEvent; - TConnMonIapInfo iaps = realEvent->IapAvailability(); - QList unDiscoveredConfigs = accessPointConfigurations.keys(); - for ( TUint i = 0; i < iaps.Count(); i++ ) { - QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - // Configuration is either Discovered or Active - changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); - unDiscoveredConfigs.removeOne(ident); - } - } - foreach (QString iface, unDiscoveredConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is Defined - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); - } - } - } - break; - - default: - // For unrecognized events - break; - } -} - -QExplicitlySharedDataPointer QNetworkConfigurationManagerPrivate::dataByConnectionId(TUint aConnectionId) -{ - QNetworkConfiguration item; - - QHash >::const_iterator i = - accessPointConfigurations.constBegin(); - while (i != accessPointConfigurations.constEnd()) { - QExplicitlySharedDataPointer priv = i.value(); - if (priv.data()->connectionId == aConnectionId) { - return priv; - } - ++i; - } - - return QExplicitlySharedDataPointer(); -} - -AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, - RConnectionMonitor& connectionMonitor) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) -{ - CActiveScheduler::Add(this); -} - -AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() -{ - Cancel(); -} - -void AccessPointsAvailabilityScanner::DoCancel() -{ - iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); -} - -void AccessPointsAvailabilityScanner::StartScanning() -{ - iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); - if (!IsActive()) { - SetActive(); - } -} - -void AccessPointsAvailabilityScanner::RunL() -{ - if (iStatus.Int() != KErrNone) { - iIapBuf().iCount = 0; - iOwner.accessPointScanningReady(false,iIapBuf()); - } else { - iOwner.accessPointScanningReady(true,iIapBuf()); - } -} -#include "moc_qnetworkconfigmanager_s60_p.cpp" -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h deleted file mode 100644 index 3378898..0000000 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONMANAGERPRIVATE_H -#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "qnetworkconfiguration_s60_p.h" - -#include -#include -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include -#endif - -class CCommsDatabase; - -QT_BEGIN_NAMESPACE -class QTimer; -QT_END_NAMESPACE - -QT_BEGIN_NAMESPACE - -class QNetworkSessionPrivate; -class AccessPointsAvailabilityScanner; - -class QNetworkConfigurationManagerPrivate : public QObject, public CActive, public MConnectionMonitorObserver -{ - Q_OBJECT - -public: - QNetworkConfigurationManagerPrivate(); - virtual ~QNetworkConfigurationManagerPrivate(); - - QNetworkConfiguration defaultConfiguration(); - void performAsyncConfigurationUpdate(); - -Q_SIGNALS: - void configurationAdded(const QNetworkConfiguration& config); - void configurationRemoved(const QNetworkConfiguration& config); - void configurationUpdateComplete(); - void configurationChanged(const QNetworkConfiguration& config); - void onlineStateChanged(bool isOnline); - -public Q_SLOTS: - void updateConfigurations(); - -private: - void registerPlatformCapabilities(); - void updateStatesToSnaps(); - bool changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); - bool changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); - bool changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - QNetworkConfigurationPrivate* configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); -#else - bool readNetworkConfigurationValuesFromCommsDb( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); - void readNetworkConfigurationValuesFromCommsDbL( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); -#endif - - void updateConfigurationsL(); - void updateActiveAccessPoints(); - void updateAvailableAccessPoints(); - void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); - void startCommsDatabaseNotifications(); - void stopCommsDatabaseNotifications(); - - QNetworkConfiguration defaultConfigurationL(); - TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; - void startMonitoringIAPData(TUint32 aIapId); - QExplicitlySharedDataPointer dataByConnectionId(TUint aConnectionId); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // MConnectionMonitorObserver - void EventL(const CConnMonEventBase& aEvent); - -public: // Data - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; - QNetworkConfigurationManager::Capabilities capFlags; - -private: // Data - bool iFirstUpdate; - CCommsDatabase* ipCommsDB; - RConnectionMonitor iConnectionMonitor; - - TBool iWaitingCommsDatabaseNotifications; - TBool iOnline; - TBool iInitOk; - TBool iUpdateGoingOn; - - - AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; - - friend class QNetworkSessionPrivate; - friend class AccessPointsAvailabilityScanner; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - RCmManager iCmManager; -#endif -}; - -class AccessPointsAvailabilityScanner : public CActive -{ -public: - AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, - RConnectionMonitor& connectionMonitor); - ~AccessPointsAvailabilityScanner(); - - void StartScanning(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // Data - QNetworkConfigurationManagerPrivate& iOwner; - RConnectionMonitor& iConnectionMonitor; - TConnMonIapInfoBuf iIapBuf; -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index e1b2828..1585be1 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -41,11 +41,7 @@ #include "qnetworkconfiguration.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworkconfiguration_s60_p.h" -#else #include "qnetworkconfiguration_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 68d6ba4..bfc42f5 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -92,7 +92,6 @@ public: bool internet; QList serviceNetworkMembers; - QNetworkInterface serviceInterface; private: diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index d01d4d9..142415a 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -39,24 +39,8 @@ ** ****************************************************************************/ -#include "qnetworkconfiguration_s60_p.h" - QT_BEGIN_NAMESPACE -QNetworkConfigurationPrivate::QNetworkConfigurationPrivate() - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), - bearer(QNetworkConfigurationPrivate::BearerUnknown), numericId(0), - connectionId(0), manager(0) -{ -} - -QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() -{ - //release pointers to member configurations - serviceNetworkMembers.clear(); -} - QString QNetworkConfigurationPrivate::bearerName() const { switch (bearer) { @@ -72,5 +56,4 @@ QString QNetworkConfigurationPrivate::bearerName() const } } - QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h deleted file mode 100644 index 5e75c13..0000000 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONPRIVATE_H -#define QNETWORKCONFIGURATIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate : public QSharedData -{ -public: - enum Bearer { - BearerEthernet, - BearerWLAN, - Bearer2G, - BearerCDMA2000, - BearerWCDMA, - BearerHSPA, - BearerBluetooth, - BearerWiMAX, - BearerUnknown = -1 - }; - - QNetworkConfigurationPrivate(); - ~QNetworkConfigurationPrivate(); - - QString name; - bool isValid; - QString id; - QNetworkConfiguration::StateFlags state; - QNetworkConfiguration::Type type; - bool roamingSupported; - QNetworkConfiguration::Purpose purpose; - - QList > serviceNetworkMembers; - - QNetworkConfigurationPrivate::Bearer bearer; - QString bearerName() const; - TUint32 numericId; - TUint connectionId; - - TAny* manager; - - QString mappingName; - - QExplicitlySharedDataPointer serviceNetworkPtr; - -private: - // disallow detaching - QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); - QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 74b9787..5f87d95 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -44,9 +44,7 @@ #include "qnetworksession.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworksession_s60_p.h" -#elif Q_WS_MAEMO_6 +#if Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" #else #include "qnetworksession_p.h" @@ -672,7 +670,7 @@ void QNetworkSession::connectNotify(const char *signal) QObject::connectNotify(signal); //check for preferredConfigurationChanged() signal connect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN_disabled if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { d->setALREnabled(true); } @@ -692,7 +690,7 @@ void QNetworkSession::disconnectNotify(const char *signal) QObject::disconnectNotify(signal); //check for preferredConfigurationChanged() signal disconnect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN_disabled if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { d->setALREnabled(false); } diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 0aa9d19..0744add 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -61,6 +61,12 @@ QNetworkSessionEngine::~QNetworkSessionEngine() priv->isValid = false; priv->id.clear(); } + + foreach (const QString &oldIface, userChoiceConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } } #include "moc_qnetworksessionengine_p.cpp" diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 202a7dc..a1a3370 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -55,6 +55,7 @@ #include "qnetworkconfiguration_p.h" #include "qnetworksession.h" +#include "qnetworkconfigmanager.h" #include #include @@ -94,6 +95,8 @@ public: virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 05fce8c..ab0a816 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,9 +1,10 @@ TEMPLATE = subdirs -!symbian:!maemo { +!maemo { SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan +symbian:SUBDIRS += symbian } diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 45a5ee9..dd07d83 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -71,6 +71,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 2a3fecf..7ee0723 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -512,4 +512,9 @@ QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 9294fad..d50aa75 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -142,6 +142,8 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { + qDebug() << Q_FUNC_INFO; + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); doRequestUpdate(); @@ -314,5 +316,10 @@ QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QGenericEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index a671ceb..730301b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -71,6 +71,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 0050770..82ddaf9 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -461,4 +461,10 @@ QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNativeWifiEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::CanStartAndStopInterfaces; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 511a6a4..9d92562 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -82,6 +82,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 20dee1f..e1fcd46 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -667,5 +667,11 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::CanStartAndStopInterfaces; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 1636c91..3752dce 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -82,6 +82,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 51897f0..d3e3fd2 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -631,6 +631,11 @@ QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index dd038d1..5e80db1 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -93,6 +93,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void networksChanged(); diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp new file mode 100644 index 0000000..8865f4d --- /dev/null +++ b/src/plugins/bearer/symbian/main.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "symbianengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QSymbianEnginePlugin : public QBearerEnginePlugin +{ +public: + QSymbianEnginePlugin(); + ~QSymbianEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QSymbianEnginePlugin::QSymbianEnginePlugin() +{ +} + +QSymbianEnginePlugin::~QSymbianEnginePlugin() +{ +} + +QStringList QSymbianEnginePlugin::keys() const +{ + return QStringList() << QLatin1String("symbian"); +} + +QBearerEngine *QSymbianEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("symbian")) + return new SymbianEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QSymbianEnginePlugin) +Q_EXPORT_PLUGIN2(qsymbianbearer, QSymbianEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro new file mode 100644 index 0000000..d3ffb37 --- /dev/null +++ b/src/plugins/bearer/symbian/symbian.pro @@ -0,0 +1,33 @@ +TARGET = qsymbianbearer +include(../../qpluginbase.pri) + +QT += network + +HEADERS += symbianengine.h +SOURCES += symbianengine.cpp main.cpp + +exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ +exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + message("Building with SNAP support") + DEFINES += SNAP_FUNCTIONALITY_AVAILABLE + LIBS += -lcmmanager +} else { + message("Building without SNAP support") + LIBS += -lapengine +} + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lcommdb \ + -lapsettingshandlerui \ + -lconnmon \ + -lcentralrepository \ + -lesock \ + -linsock \ + -lecom \ + -lefsrv \ + -lnetmeta + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp new file mode 100644 index 0000000..8c31990 --- /dev/null +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -0,0 +1,931 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "symbianengine.h" + +#include +#include +#include + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include +#endif + +QT_BEGIN_NAMESPACE + +static const int KValueThatWillBeAddedToSNAPId = 1000; +static const int KUserChoiceIAPId = 0; + +SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() +: bearer(BearerUnknown), numericId(0), connectionId(0), manager(0) +{ +} + +SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() +{ +} + +inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + +SymbianEngine::SymbianEngine(QObject *parent) +: QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) +{ + qDebug() << Q_FUNC_INFO; + + CActiveScheduler::Add(this); + + TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); + if (error != KErrNone) { + iInitOk = false; + return; + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + TRAP(error, iCmManager.OpenL()); + if (error != KErrNone) { + iInitOk = false; + return; + } +#endif + + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + cpPriv->name = "UserChoice"; + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); + cpPriv->numericId = KUserChoiceIAPId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::UserChoice; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + userChoiceConfigurations.insert(ptr->id, ptr); + + updateConfigurations(); + updateStatesToSnaps(); + + // Start monitoring IAP and/or SNAP changes in Symbian CommsDB + startCommsDatabaseNotifications(); +} + +SymbianEngine::~SymbianEngine() +{ + Cancel(); + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iCmManager.Close(); +#endif + + delete ipAccessPointsAvailabilityScanner; + delete ipCommsDB; +} + + +QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const +{ + QNetworkConfigurationManager::Capabilities capFlags; + + capFlags = QNetworkConfigurationManager::CanStartAndStopInterfaces | + QNetworkConfigurationManager::DirectConnectionRouting | + QNetworkConfigurationManager::SystemSessionSupport | + QNetworkConfigurationManager::DataStatistics; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming | + QNetworkConfigurationManager::ForcedRoaming; +#endif + + return capFlags; +} + +void SymbianEngine::requestUpdate() +{ + if (!iInitOk || iUpdateGoingOn) { + return; + } + iUpdateGoingOn = true; + + stopCommsDatabaseNotifications(); + updateConfigurations(); // Synchronous call + updateAvailableAccessPoints(); // Asynchronous call +} + +void SymbianEngine::updateConfigurations() +{ + if (!iInitOk) { + return; + } + + TRAP_IGNORE(updateConfigurationsL()); +} + +void SymbianEngine::updateConfigurationsL() +{ + QList knownConfigs = accessPointConfigurations.keys(); + QList knownSnapConfigs = snapConfigurations.keys(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // S60 version is >= Series60 3rd Edition Feature Pack 2 + TInt error = KErrNone; + + // Loop through all IAPs + RArray connectionMethods; // IAPs + CleanupClosePushL(connectionMethods); + iCmManager.ConnectionMethodL(connectionMethods); + for(int i = 0; i < connectionMethods.Count(); i++) { + RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); + CleanupClosePushL(connectionMethod); + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate* cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + } + CleanupStack::PopAndDestroy(&connectionMethod); + } + CleanupStack::PopAndDestroy(&connectionMethods); + + // Loop through all SNAPs + RArray destinations; + CleanupClosePushL(destinations); + iCmManager.AllDestinationsL(destinations); + for(int i = 0; i < destinations.Count(); i++) { + RCmDestination destination; + destination = iCmManager.DestinationL(destinations[i]); + CleanupClosePushL(destination); + QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids + if (snapConfigurations.contains(ident)) { + knownSnapConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + CleanupStack::PushL(cpPriv); + + HBufC *pName = destination.NameLC(); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = destination.Id(); + cpPriv->connectionId = 0; + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->type = QNetworkConfiguration::ServiceNetwork; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + snapConfigurations.insert(ident, ptr); + emit configurationAdded(ptr); + + CleanupStack::Pop(cpPriv); + } + QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident); + + for (int j=0; j < destination.ConnectionMethodCount(); j++) { + RCmConnectionMethod connectionMethod = destination.ConnectionMethodL(j); + CleanupClosePushL(connectionMethod); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString iface = QString::number(qHash(iapId)); + // Check that IAP can be found from accessPointConfigurations list + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.value(iface); + if (!priv) { + SymbianNetworkConfigurationPrivate *cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + toSymbianConfig(ptr)->serviceNetworkPtr = privSNAP; + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + privSNAP->serviceNetworkMembers.append(ptr); + } + } else { + knownConfigs.removeOne(iface); + // Check that IAP can be found from related SNAP's configuration list + bool iapFound = false; + for (int i = 0; i < privSNAP->serviceNetworkMembers.count(); i++) { + if (toSymbianConfig(privSNAP->serviceNetworkMembers[i])->numericId == iapId) { + iapFound = true; + break; + } + } + if (!iapFound) { + toSymbianConfig(priv)->serviceNetworkPtr = privSNAP; + privSNAP->serviceNetworkMembers.append(priv); + } + } + + CleanupStack::PopAndDestroy(&connectionMethod); + } + + if (privSNAP->serviceNetworkMembers.count() > 1) { + // Roaming is supported only if SNAP contains more than one IAP + privSNAP->roamingSupported = true; + } + + CleanupStack::PopAndDestroy(&destination); + } + CleanupStack::PopAndDestroy(&destinations); + +#else + // S60 version is < Series60 3rd Edition Feature Pack 2 + CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); + + // Loop through all IAPs + TUint32 apId = 0; + TInt retVal = pDbTView->GotoFirstRecord(); + while (retVal == KErrNone) { + pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); + QString ident = QString::number(qHash(apId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ident, ptr); + + emit configurationAdded(ptr); + } else { + delete cpPriv; + } + } + retVal = pDbTView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy(pDbTView); +#endif + updateActiveAccessPoints(); + + foreach (const QString &oldIface, knownConfigs) { + //remove non existing IAP + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface); + emit configurationRemoved(ptr); + + // Remove non existing IAP from SNAPs + foreach (const QString &iface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr2 = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is active + for (int i = 0; i < ptr2->serviceNetworkMembers.count(); ++i) { + if (toSymbianConfig(ptr2->serviceNetworkMembers[i])->numericId == + toSymbianConfig(ptr)->numericId) { + ptr2->serviceNetworkMembers.removeAt(i); + break; + } + } + } + } + + foreach (const QString &oldIface, knownSnapConfigs) { + //remove non existing SNAPs + QNetworkConfigurationPrivatePointer ptr = snapConfigurations.take(oldIface); + emit configurationRemoved(ptr); + } +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( + RCmConnectionMethod& connectionMethod) +{ + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + CleanupStack::PushL(cpPriv); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + + HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); + CleanupStack::PushL(pName); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); + switch (bearerId) { + case KCommDbBearerCSD: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case KCommDbBearerWcdma: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + break; + case KCommDbBearerLAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + case KCommDbBearerVirtual: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerPAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerWLAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + break; + default: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + } + + TInt error = KErrNone; + TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType); + switch (bearerType) { + case KUidPacketDataBearerType: + // "Packet data" Bearer => Mapping is done using "Access point name" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EPacketDataAPName)); + break; + case KUidWlanBearerType: + // "Wireless LAN" Bearer => Mapping is done using "WLAN network name" = SSID + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EWlanSSID)); + break; + } + if (!pName) { + // "Data call" Bearer or "High Speed (GSM)" Bearer => Mapping is done using "Dial-up number" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EDialDefaultTelNum)); + } + + if (error == KErrNone && pName) { + CleanupStack::PushL(pName); + cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + } + + cpPriv->state = QNetworkConfiguration::Defined; + TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected); + if (isConnected) { + cpPriv->state = QNetworkConfiguration::Active; + } + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = iapId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + CleanupStack::Pop(cpPriv); + return cpPriv; +} +#else +bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) +{ + TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); + if (error != KErrNone) { + return false; + } + return true; +} + +void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) +{ + CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); + CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); + TBuf name; + + CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB); + TUint32 apId = pApUtils->WapIdFromIapIdL(aApId); + + pDataHandler->AccessPointDataL(apId,*pAPItem); + pAPItem->ReadTextL(EApIapName, name); + if (name.Compare(_L("Easy WLAN")) == 0) { + // "Easy WLAN" won't be accepted to the Configurations list + User::Leave(KErrNotFound); + } + + QString ident = QString::number(qHash(aApId)); + + apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); + apNetworkConfiguration->isValid = true; + apNetworkConfiguration->id = ident; + apNetworkConfiguration->numericId = aApId; + apNetworkConfiguration->connectionId = 0; + apNetworkConfiguration->state = (QNetworkConfiguration::Defined); + apNetworkConfiguration->type = QNetworkConfiguration::InternetAccessPoint; + apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose; + apNetworkConfiguration->roamingSupported = false; + switch (pAPItem->BearerTypeL()) { + case EApBearerTypeCSD: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeGPRS: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeHSCSD: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + break; + case EApBearerTypeCDMA: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + break; + case EApBearerTypeWLAN: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + break; + case EApBearerTypeLAN: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + case EApBearerTypeLANModem: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + default: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + } + apNetworkConfiguration->manager = this; + + CleanupStack::PopAndDestroy(pApUtils); + CleanupStack::PopAndDestroy(pAPItem); + CleanupStack::PopAndDestroy(pDataHandler); +} +#endif + +QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration() +{ + QNetworkConfigurationPrivatePointer ptr; + + if (iInitOk) { + stopCommsDatabaseNotifications(); + TRAP_IGNORE(ptr = defaultConfigurationL()); + startCommsDatabaseNotifications(); + } + + return ptr; +} + +QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() +{ + QNetworkConfigurationPrivatePointer ptr; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // Check Default Connection (SNAP or IAP) + TCmDefConnValue defaultConnectionValue; + iCmManager.ReadDefConnL(defaultConnectionValue); + if (defaultConnectionValue.iType == ECmDefConnDestination) { + QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); + ptr = snapConfigurations.value(iface); + } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { + QString iface = QString::number(qHash(defaultConnectionValue.iId)); + ptr = accessPointConfigurations.value(iface); + } +#endif + + if (!ptr->isValid) { + QString iface = QString::number(qHash(KUserChoiceIAPId)); + ptr = userChoiceConfigurations.value(iface); + } + + return ptr; +} + +void SymbianEngine::updateActiveAccessPoints() +{ + bool online = false; + QList inactiveConfigs = accessPointConfigurations.keys(); + + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + + // Go through all connections and set state of related IAPs to Active + TUint connectionId; + TUint subConnectionCount; + TUint apId; + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + online = true; + inactiveConfigs.removeOne(ident); + + toSymbianConfig(ptr)->connectionId = connectionId; + + // Configuration is Active + changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + } + } + } + + // Make sure that state of rest of the IAPs won't be Active + foreach (const QString &iface, inactiveConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is either Defined or Discovered + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered); + } + } + + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } +} + +void SymbianEngine::updateAvailableAccessPoints() +{ + if (!ipAccessPointsAvailabilityScanner) { + ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); + } + if (ipAccessPointsAvailabilityScanner) { + // Scanning may take a while because WLAN scanning will be done (if device supports WLAN). + ipAccessPointsAvailabilityScanner->StartScanning(); + } +} + +void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) +{ + iUpdateGoingOn = false; + if (scanSuccessful) { + QList unavailableConfigs = accessPointConfigurations.keys(); + + // Set state of returned IAPs to Discovered + // if state is not already Active + for(TUint i=0; istate < QNetworkConfiguration::Active) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered); + } + } + } + + // Make sure that state of rest of the IAPs won't be Discovered or Active + foreach (const QString &iface, unavailableConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + } + } + } + + updateStatesToSnaps(); + + startCommsDatabaseNotifications(); + + qDebug() << Q_FUNC_INFO << "updateCompleted()"; + emit updateCompleted(); +} + +void SymbianEngine::updateStatesToSnaps() +{ + // Go through SNAPs and set correct state to SNAPs + QList snapConfigIdents = snapConfigurations.keys(); + foreach (QString iface, snapConfigIdents) { + bool discovered = false; + bool active = false; + QNetworkConfigurationPrivatePointer ptr = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is discovered or active + // => If one of IAPs is active, also SNAP is active + // => If one of IAPs is discovered but none of the IAPs is active, SNAP is discovered + for (int i=0; iserviceNetworkMembers.count(); i++) { + if ((ptr->serviceNetworkMembers[i]->state & QNetworkConfiguration::Active) + == QNetworkConfiguration::Active) { + active = true; + break; + } else if ((ptr->serviceNetworkMembers[i]->state & QNetworkConfiguration::Discovered) + == QNetworkConfiguration::Discovered) { + discovered = true; + } + } + if (active) { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + } else if (discovered) { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Discovered); + } else { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Defined); + } + } +} + +bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if (newState != ptr->state) { + ptr->state = newState; + emit configurationChanged(ptr); + return true; + } + return false; +} + +/* changeConfigurationStateAtMinTo function does not overwrite possible better + * state (e.g. Discovered state does not overwrite Active state) but + * makes sure that state is at minimum given state. +*/ +bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState | ptr->state) != ptr->state) { + ptr->state = (ptr->state | newState); + emit configurationChanged(ptr); + return true; + } + return false; +} + +/* changeConfigurationStateAtMaxTo function overwrites possible better + * state (e.g. Discovered state overwrites Active state) and + * makes sure that state is at maximum given state (e.g. Discovered state + * does not overwrite Defined state). +*/ +bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState & ptr->state) != ptr->state) { + ptr->state = (newState & ptr->state); + emit configurationChanged(ptr); + return true; + } + return false; +} + +void SymbianEngine::startCommsDatabaseNotifications() +{ + if (!iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = ETrue; + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void SymbianEngine::stopCommsDatabaseNotifications() +{ + if (iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = EFalse; + if (!IsActive()) { + SetActive(); + // Make sure that notifier recorded events will not be returned + // as soon as the client issues the next RequestNotification() request. + ipCommsDB->RequestNotification(iStatus); + ipCommsDB->CancelRequestNotification(); + } else { + ipCommsDB->CancelRequestNotification(); + } + } +} + +void SymbianEngine::RunL() +{ + if (iStatus != KErrCancel) { + RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); + switch (event) { + case RDbNotifier::EUnlock: /** All read locks have been removed. */ + case RDbNotifier::ECommit: /** A transaction has been committed. */ + case RDbNotifier::ERollback: /** A transaction has been rolled back */ + case RDbNotifier::ERecover: /** The database has been recovered */ + // Note that if further database events occur while a client is handling + // a request completion, the notifier records the most significant database + // event and this is signalled as soon as the client issues the next + // RequestNotification() request. + // => Stop recording notifications + stopCommsDatabaseNotifications(); + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + iWaitingCommsDatabaseNotifications = true; + break; + default: + // Do nothing + break; + } + } + + if (iWaitingCommsDatabaseNotifications) { + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void SymbianEngine::DoCancel() +{ + ipCommsDB->CancelRequestNotification(); +} + + +void SymbianEngine::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) { + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint subConnectionCount = 0; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + toSymbianConfig(ptr)->connectionId = connectionId; + // Configuration is Active + if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) + updateStatesToSnaps(); + + if (!iOnline) { + iOnline = true; + emit this->onlineStateChanged(iOnline); + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + + QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); + if (ptr) { + toSymbianConfig(ptr)->connectionId = 0; + // Configuration is either Defined or Discovered + if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) + updateStatesToSnaps(); + } + + bool online = false; + foreach (const QString &iface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr->state == QNetworkConfiguration::Active) { + online = true; + break; + } + } + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } + } + break; + + case EConnMonIapAvailabilityChange: + { + CConnMonIapAvailabilityChange* realEvent; + realEvent = (CConnMonIapAvailabilityChange*) &aEvent; + TConnMonIapInfo iaps = realEvent->IapAvailability(); + QList unDiscoveredConfigs = accessPointConfigurations.keys(); + for ( TUint i = 0; i < iaps.Count(); i++ ) { + QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered); + unDiscoveredConfigs.removeOne(ident); + } + } + foreach (const QString &iface, unDiscoveredConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) +{ + QNetworkConfiguration item; + + QHash::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer ptr = i.value(); + if (toSymbianConfig(ptr)->connectionId == aConnectionId) + return ptr; + + ++i; + } + + return QNetworkConfigurationPrivatePointer(); +} + +AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine& owner, + RConnectionMonitor& connectionMonitor) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) +{ + CActiveScheduler::Add(this); +} + +AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() +{ + Cancel(); +} + +void AccessPointsAvailabilityScanner::DoCancel() +{ + iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); +} + +void AccessPointsAvailabilityScanner::StartScanning() +{ + iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); + if (!IsActive()) { + SetActive(); + } +} + +void AccessPointsAvailabilityScanner::RunL() +{ + if (iStatus.Int() != KErrNone) { + iIapBuf().iCount = 0; + iOwner.accessPointScanningReady(false,iIapBuf()); + } else { + iOwner.accessPointScanningReady(true,iIapBuf()); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h new file mode 100644 index 0000000..0ca30da --- /dev/null +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMBIANENGINE_H +#define SYMBIANENGINE_H + +#include +#include + +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +class CCommsDatabase; + +QT_BEGIN_NAMESPACE +class QTimer; +QT_END_NAMESPACE + +QT_BEGIN_NAMESPACE + +class QNetworkSessionPrivate; +class AccessPointsAvailabilityScanner; + +class SymbianNetworkConfigurationPrivate : public QNetworkConfigurationPrivate +{ +public: + enum Bearer { + BearerEthernet, + BearerWLAN, + Bearer2G, + BearerCDMA2000, + BearerWCDMA, + BearerHSPA, + BearerBluetooth, + BearerWiMAX, + BearerUnknown = -1 + }; + + SymbianNetworkConfigurationPrivate(); + ~SymbianNetworkConfigurationPrivate(); + + Bearer bearer; + + TUint32 numericId; + TUint connectionId; + + TAny *manager; + + QNetworkConfigurationPrivatePointer serviceNetworkPtr; + + QString mappingName; +}; + +class SymbianEngine : public QNetworkSessionEngine, public CActive, + public MConnectionMonitorObserver +{ + Q_OBJECT + +public: + SymbianEngine(QObject *parent = 0); + virtual ~SymbianEngine(); + + QString getInterfaceFromId(const QString &id) { return QString(); } + bool hasIdentifier(const QString &id) { return false; } + + void connectToId(const QString &id) { } + void disconnectFromId(const QString &id) { } + + void requestUpdate(); + + QNetworkSession::State sessionStateForId(const QString &id) { return QNetworkSession::Invalid; } + + QNetworkConfigurationManager::Capabilities capabilities() const; + + QNetworkConfigurationPrivatePointer defaultConfiguration(); + +Q_SIGNALS: + void onlineStateChanged(bool isOnline); + +public Q_SLOTS: + void updateConfigurations(); + +private: + void updateStatesToSnaps(); + bool changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + SymbianNetworkConfigurationPrivate *configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); +#else + bool readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration); + void readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration); +#endif + + void updateConfigurationsL(); + void updateActiveAccessPoints(); + void updateAvailableAccessPoints(); + void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); + void startCommsDatabaseNotifications(); + void stopCommsDatabaseNotifications(); + + QNetworkConfigurationPrivatePointer defaultConfigurationL(); + TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; + void startMonitoringIAPData(TUint32 aIapId); + QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: // Data + CCommsDatabase* ipCommsDB; + RConnectionMonitor iConnectionMonitor; + + TBool iWaitingCommsDatabaseNotifications; + TBool iOnline; + TBool iInitOk; + TBool iUpdateGoingOn; + + + AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; + + friend class QNetworkSessionPrivate; + friend class AccessPointsAvailabilityScanner; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + RCmManager iCmManager; +#endif +}; + +class AccessPointsAvailabilityScanner : public CActive +{ +public: + AccessPointsAvailabilityScanner(SymbianEngine& owner, + RConnectionMonitor& connectionMonitor); + ~AccessPointsAvailabilityScanner(); + + void StartScanning(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + SymbianEngine& iOwner; + RConnectionMonitor& iConnectionMonitor; + TConnMonIapInfoBuf iIapBuf; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 2d9c489..57df601 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -79,7 +79,12 @@ symbian: { DEPLOYMENT += phonon_backend_plugins } - DEPLOYMENT += qtresources qtlibraries imageformats_plugins codecs_plugins graphicssystems_plugins + DEPLOYMENT += qtresources \ + qtlibraries \ + imageformats_plugins \ + codecs_plugins \ + graphicssystems_plugins \ + bearer_plugins contains(QT_CONFIG, svg): { qtlibraries.sources += QtSvg.dll @@ -115,6 +120,9 @@ symbian: { graphicssystems_plugins.sources += qvggraphicssystem.dll } + bearer_plugins.path = c:$$QT_PLUGINS_BASE_DIR/bearer + bearer_plugins.sources += qgenericbearer.dll qsymbianbearer.dll + BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } -- cgit v0.12 From b840dbe4ddd6937cd76c9c41baa16a8077224acd Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 14:26:49 +1000 Subject: Port session functionality. --- src/network/bearer/bearer.pri | 8 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworkconfiguration_p.h | 8 +- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 59 - src/network/bearer/qnetworksession.cpp | 143 ++- src/network/bearer/qnetworksession_p.cpp | 484 --------- src/network/bearer/qnetworksession_p.h | 93 +- src/network/bearer/qnetworksession_s60_p.cpp | 1134 -------------------- src/network/bearer/qnetworksession_s60_p.h | 212 ---- src/network/bearer/qnetworksessionengine_p.h | 2 + src/plugins/bearer/generic/generic.pro | 5 +- src/plugins/bearer/generic/qgenericengine.cpp | 8 +- src/plugins/bearer/generic/qgenericengine.h | 3 + src/plugins/bearer/qnetworksession_impl.cpp | 485 +++++++++ src/plugins/bearer/qnetworksession_impl.h | 136 +++ src/plugins/bearer/symbian/main.cpp | 2 - .../bearer/symbian/qnetworksession_impl.cpp | 1125 +++++++++++++++++++ src/plugins/bearer/symbian/qnetworksession_impl.h | 196 ++++ src/plugins/bearer/symbian/symbian.pro | 8 +- src/plugins/bearer/symbian/symbianengine.cpp | 67 +- src/plugins/bearer/symbian/symbianengine.h | 21 +- .../tst_qnetworksession/tst_qnetworksession.cpp | 16 +- 22 files changed, 2152 insertions(+), 2065 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.cpp delete mode 100644 src/network/bearer/qnetworksession_p.cpp delete mode 100644 src/network/bearer/qnetworksession_s60_p.cpp delete mode 100644 src/network/bearer/qnetworksession_s60_p.h create mode 100644 src/plugins/bearer/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/qnetworksession_impl.h create mode 100644 src/plugins/bearer/symbian/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/symbian/qnetworksession_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 169c8b7..0450961 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -10,12 +10,7 @@ SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ bearer/qnetworkconfiguration.cpp -symbian_disabled { - HEADERS += bearer/qnetworksession_s60_p.h - - SOURCES += bearer/qnetworkconfiguration_s60_p.cpp \ - bearer/qnetworksession_s60_p.cpp -} else:maemo { +maemo { QT += dbus CONFIG += link_pkgconfig @@ -50,7 +45,6 @@ symbian_disabled { bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qnetworksession_p.cpp \ bearer/qnetworksessionengine.cpp \ bearer/qbearerplugin.cpp diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index d7a813b..4ef1f09 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -110,7 +110,7 @@ private Q_SLOTS: void configurationChanged(QNetworkConfigurationPrivatePointer ptr); }; -QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); +Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index bfc42f5..40aea8b 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -75,13 +75,15 @@ public: serviceNetworkMembers.clear(); } - QString name; - QString bearer; - inline QString bearerName() const + virtual QString bearerName() const { return bearer; } + QString bearer; + + QString name; + bool isValid; QString id; QNetworkConfiguration::StateFlags state; diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp deleted file mode 100644 index 142415a..0000000 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -QT_BEGIN_NAMESPACE - -QString QNetworkConfigurationPrivate::bearerName() const -{ - switch (bearer) { - case QNetworkConfigurationPrivate::BearerEthernet: return QLatin1String("Ethernet"); - case QNetworkConfigurationPrivate::BearerWLAN: return QLatin1String("WLAN"); - case QNetworkConfigurationPrivate::Bearer2G: return QLatin1String("2G"); - case QNetworkConfigurationPrivate::BearerCDMA2000: return QLatin1String("CDMA2000"); - case QNetworkConfigurationPrivate::BearerWCDMA: return QLatin1String("WCDMA"); - case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); - case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); - case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QString(); - } -} - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 5f87d95..6b0ccaf 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -43,6 +43,8 @@ #include #include "qnetworksession.h" +#include "qnetworksessionengine_p.h" +#include "qnetworkconfigmanager_p.h" #if Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" @@ -224,14 +226,25 @@ QT_BEGIN_NAMESPACE \sa QNetworkConfiguration */ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) - : QObject(parent) +: QObject(parent), d(0) { - d = new QNetworkSessionPrivate; - d->q = this; - d->publicConfig = connectionConfig; - d->syncStateWithInterface(); - QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), - this, SIGNAL(opened())); + foreach (QNetworkSessionEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { + if (engine->hasIdentifier(connectionConfig.identifier())) { + d = engine->createSessionBackend(); + d->q = this; + d->publicConfig = connectionConfig; + d->syncStateWithInterface(); + connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened())); + connect(d, SIGNAL(error(QNetworkSession::SessionError)), + this, SIGNAL(error(QNetworkSession::SessionError))); + connect(d, SIGNAL(stateChanged(QNetworkSession::State)), + this, SIGNAL(stateChanged(QNetworkSession::State))); + connect(d, SIGNAL(closed()), this, SIGNAL(closed())); + connect(d, SIGNAL(newConfigurationActivated()), + this, SIGNAL(newConfigurationActivated())); + break; + } + } } /*! @@ -261,7 +274,8 @@ QNetworkSession::~QNetworkSession() */ void QNetworkSession::open() { - d->open(); + if (d) + d->open(); } /*! @@ -283,6 +297,9 @@ void QNetworkSession::open() */ bool QNetworkSession::waitForOpened(int msecs) { + if (!d) + return false; + if (d->isOpen) return true; @@ -320,7 +337,8 @@ bool QNetworkSession::waitForOpened(int msecs) */ void QNetworkSession::close() { - d->close(); + if (d) + d->close(); } /*! @@ -332,7 +350,8 @@ void QNetworkSession::close() */ void QNetworkSession::stop() { - d->stop(); + if (d) + d->stop(); } /*! @@ -342,61 +361,9 @@ void QNetworkSession::stop() */ QNetworkConfiguration QNetworkSession::configuration() const { - return d->publicConfig; + return d ? d->publicConfig : QNetworkConfiguration(); } -/* - Returns the type of bearer currently used by this session. The string is not translated and - therefore can not be shown to the user. The subsequent table presents the currently known - bearer types: - - \table - \header - \o Value - \o Description - \row - \o Unknown - \o The session is based on an unknown or unspecified bearer type. - \row - \o Ethernet - \o The session is based on Ethernet. - \row - \o WLAN - \o The session is based on Wireless LAN. - \row - \o 2G - \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. - \row - \o CDMA2000 - \o The session uses CDMA. - \row - \o WCDMA - \o The session uses W-CDMA/UMTS. - \row - \o HSPA - \o The session uses High Speed Packet Access. - \row - \o Bluetooth - \o The session uses Bluetooth. - \row - \o WiMAX - \o The session uses WiMAX. - \endtable - - If the session is based on a network configuration of type - \l QNetworkConfiguration::ServiceNetwork the type of the preferred or currently - active configuration is returned. Therefore the bearer type may change - over time. - - This function returns an empty string if this session is based on an invalid configuration, or - a network configuration of type \l QNetworkConfiguration::ServiceNetwork with no - \l {QNetworkConfiguration::children()}{children}. -*/ -/*QString QNetworkSession::bearerName() const -{ - return d->bearerName(); -}*/ - /*! Returns the network interface that is used by this session. @@ -408,7 +375,7 @@ QNetworkConfiguration QNetworkSession::configuration() const */ QNetworkInterface QNetworkSession::interface() const { - return d->currentInterface(); + return d ? d->currentInterface() : QNetworkInterface(); } /*! @@ -419,7 +386,7 @@ QNetworkInterface QNetworkSession::interface() const */ bool QNetworkSession::isOpen() const { - return d->isOpen; + return d ? d->isOpen : false; } /*! @@ -441,7 +408,7 @@ bool QNetworkSession::isOpen() const */ QNetworkSession::State QNetworkSession::state() const { - return d->state; + return d ? d->state : QNetworkSession::Invalid; } /*! @@ -451,7 +418,7 @@ QNetworkSession::State QNetworkSession::state() const */ QNetworkSession::SessionError QNetworkSession::error() const { - return d->error(); + return d ? d->error() : InvalidConfigurationError; } /*! @@ -462,7 +429,7 @@ QNetworkSession::SessionError QNetworkSession::error() const */ QString QNetworkSession::errorString() const { - return d->errorString(); + return d ? d->errorString() : tr("Invalid configuration."); } /*! @@ -520,6 +487,9 @@ QString QNetworkSession::errorString() const */ QVariant QNetworkSession::sessionProperty(const QString& key) const { + if (!d) + return QVariant(); + if (!d->publicConfig.isValid()) return QVariant(); @@ -553,6 +523,9 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) { + if (!d) + return; + if (key == QLatin1String("ActiveConfiguration") || key == QLatin1String("UserChoiceConfiguration")) { return; @@ -571,7 +544,8 @@ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& val */ void QNetworkSession::migrate() { - d->migrate(); + if (d) + d->migrate(); } /*! @@ -583,7 +557,8 @@ void QNetworkSession::ignore() { // Needed on at least Symbian platform: the roaming must be explicitly // ignore()'d or migrate()'d - d->ignore(); + if (d) + d->ignore(); } /*! @@ -596,7 +571,8 @@ void QNetworkSession::ignore() */ void QNetworkSession::accept() { - d->accept(); + if (d) + d->accept(); } /*! @@ -608,7 +584,8 @@ void QNetworkSession::accept() */ void QNetworkSession::reject() { - d->reject(); + if (d) + d->reject(); } @@ -626,7 +603,7 @@ void QNetworkSession::reject() */ quint64 QNetworkSession::bytesWritten() const { - return d->bytesWritten(); + return d ? d->bytesWritten() : Q_UINT64_C(0); } /*! @@ -643,7 +620,7 @@ quint64 QNetworkSession::bytesWritten() const */ quint64 QNetworkSession::bytesReceived() const { - return d->bytesReceived(); + return d ? d->bytesReceived() : Q_UINT64_C(0); } /*! @@ -651,7 +628,7 @@ quint64 QNetworkSession::bytesReceived() const */ quint64 QNetworkSession::activeTime() const { - return d->activeTime(); + return d ? d->activeTime() : Q_UINT64_C(0); } /*! @@ -670,11 +647,11 @@ void QNetworkSession::connectNotify(const char *signal) QObject::connectNotify(signal); //check for preferredConfigurationChanged() signal connect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN_disabled - if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + if (!d) + return; + + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) d->setALREnabled(true); - } -#endif } /*! @@ -690,11 +667,11 @@ void QNetworkSession::disconnectNotify(const char *signal) QObject::disconnectNotify(signal); //check for preferredConfigurationChanged() signal disconnect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN_disabled - if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + if (!d) + return; + + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) d->setALREnabled(false); - } -#endif } #include "moc_qnetworksession.cpp" diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp deleted file mode 100644 index b615797..0000000 --- a/src/network/bearer/qnetworksession_p.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworksession_p.h" -#include "qnetworksession.h" -#include "qnetworksessionengine_p.h" -#include "qnetworkconfigmanager_p.h" - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -static QNetworkSessionEngine *getEngineFromId(const QString &id) -{ - QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - - foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - if (engine->hasIdentifier(id)) - return engine; - } - - return 0; -} - -class QNetworkSessionManagerPrivate : public QObject -{ - Q_OBJECT - -public: - QNetworkSessionManagerPrivate(QObject *parent = 0); - ~QNetworkSessionManagerPrivate(); - - void forceSessionClose(const QNetworkConfiguration &config); - -Q_SIGNALS: - void forcedSessionClose(const QNetworkConfiguration &config); -}; - -#include "qnetworksession_p.moc" - -Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); - -QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() -{ -} - -void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) -{ - emit forcedSessionClose(config); -} - -void QNetworkSessionPrivate::syncStateWithInterface() -{ - connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); - connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), - this, SLOT(configurationChanged(QNetworkConfiguration))); - connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), - this, SLOT(forcedSessionClose(QNetworkConfiguration))); - - opened = false; - isOpen = false; - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - - qRegisterMetaType - ("QNetworkSessionEngine::ConnectionError"); - - switch (publicConfig.type()) { - case QNetworkConfiguration::InternetAccessPoint: - activeConfig = publicConfig; - engine = getEngineFromId(activeConfig.identifier()); - if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - Qt::QueuedConnection); - } - break; - case QNetworkConfiguration::ServiceNetwork: - serviceConfig = publicConfig; - // Defer setting engine and signals until open(). - // fall through - case QNetworkConfiguration::UserChoice: - // Defer setting serviceConfig and activeConfig until open(). - // fall through - default: - engine = 0; - } - - networkConfigurationsChanged(); -} - -void QNetworkSessionPrivate::open() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (!isOpen) { - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; - emit q->error(lastError); - return; - } - opened = true; - - if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && - (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - - engine->connectToId(activeConfig.identifier()); - } - - isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isOpen) - emit quitPendingWaitsForOpened(); - } -} - -void QNetworkSessionPrivate::close() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (isOpen) { - opened = false; - isOpen = false; - emit q->closed(); - } -} - -void QNetworkSessionPrivate::stop() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else { - if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Closing; - emit q->stateChanged(state); - - engine->disconnectFromId(activeConfig.identifier()); - - sessionManager()->forceSessionClose(activeConfig); - } - - opened = false; - isOpen = false; - emit q->closed(); - } -} - -void QNetworkSessionPrivate::migrate() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::accept() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::ignore() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::reject() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) - return QNetworkInterface(); - - QString interface = engine->getInterfaceFromId(activeConfig.identifier()); - - if (interface.isEmpty()) - return QNetworkInterface(); - return QNetworkInterface::interfaceFromName(interface); -} - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const -{ - return QVariant(); -} - -void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) -{ -} - -/*QString QNetworkSessionPrivate::bearerName() const -{ - if (!publicConfig.isValid() || !engine) - return QString(); - - return engine->bearerName(activeConfig.identifier()); -}*/ - -QString QNetworkSessionPrivate::errorString() const -{ - switch (lastError) { - case QNetworkSession::UnknownSessionError: - return tr("Unknown session error."); - case QNetworkSession::SessionAbortedError: - return tr("The session was aborted by the user or system."); - case QNetworkSession::OperationNotSupportedError: - return tr("The requested operation is not supported by the system."); - case QNetworkSession::InvalidConfigurationError: - return tr("The specified configuration cannot be used."); - case QNetworkSession::RoamingError: - return tr("Roaming was aborted or is not possible."); - - } - - return QString(); -} - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return lastError; -} - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); - } - } -#endif - return tx_data; -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); - } - } -#endif - return rx_data; -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ -#if defined(BACKEND_NM) - if (startTime.isNull()) { - return 0; - } - if(state == QNetworkSession::Connected ) - return startTime.secsTo(QDateTime::currentDateTime()); -#endif - return m_activeTime; -} - -void QNetworkSessionPrivate::updateStateFromServiceNetwork() -{ - QNetworkSession::State oldState = state; - - foreach (const QNetworkConfiguration &config, serviceConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) - continue; - - if (activeConfig != config) { - if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); - } - - activeConfig = config; - engine = getEngineFromId(activeConfig.identifier()); - if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - Qt::QueuedConnection); - } - emit q->newConfigurationActivated(); - } - - state = QNetworkSession::Connected; - qDebug() << oldState << "->" << state; - if (state != oldState) - emit q->stateChanged(state); - - return; - } - - if (serviceConfig.children().isEmpty()) - state = QNetworkSession::NotAvailable; - else - state = QNetworkSession::Disconnected; - - qDebug() << oldState << "->" << state; - if (state != oldState) - emit q->stateChanged(state); -} - -void QNetworkSessionPrivate::updateStateFromActiveConfig() -{ - if (!engine) - return; - - QNetworkSession::State oldState = state; - - state = engine->sessionStateForId(activeConfig.identifier()); - - bool oldActive = isOpen; - isOpen = (state == QNetworkSession::Connected) ? opened : false; - - if (!oldActive && isOpen) - emit quitPendingWaitsForOpened(); - if (oldActive && !isOpen) - emit q->closed(); - - if (oldState != state) - emit q->stateChanged(state); -} - -void QNetworkSessionPrivate::networkConfigurationsChanged() -{ - if (serviceConfig.isValid()) - updateStateFromServiceNetwork(); - else - updateStateFromActiveConfig(); -#if defined(BACKEND_NM) && 0 - setActiveTimeStamp(); -#endif -} - -void QNetworkSessionPrivate::configurationChanged(const QNetworkConfiguration &config) -{ - if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig)) - updateStateFromServiceNetwork(); - else if (config == activeConfig) - updateStateFromActiveConfig(); -} - -void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &config) -{ - if (activeConfig == config) { - opened = false; - isOpen = false; - - emit q->closed(); - - lastError = QNetworkSession::SessionAbortedError; - emit q->error(lastError); - } -} - -void QNetworkSessionPrivate::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) -{ - if (activeConfig.identifier() == id) { - networkConfigurationsChanged(); - switch (error) { - case QNetworkSessionEngine::OperationNotSupported: - lastError = QNetworkSession::OperationNotSupportedError; - opened = false; - break; - case QNetworkSessionEngine::InterfaceLookupError: - case QNetworkSessionEngine::ConnectError: - case QNetworkSessionEngine::DisconnectionError: - default: - lastError = QNetworkSession::UnknownSessionError; - } - - emit quitPendingWaitsForOpened(); - emit q->error(lastError); - } -} - -#if defined(BACKEND_NM) && 0 -void QNetworkSessionPrivate::setActiveTimeStamp() -{ - if(NetworkManagerAvailable()) { - startTime = QDateTime(); - return; - } - QString connectionIdent = q->configuration().identifier(); - QString interface = currentInterface().hardwareAddress().toLower(); - QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); - - QString path; - QString serviceName; - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - QNetworkManagerConnectionActive *conDetails; - conDetails = new QNetworkManagerConnectionActive(conpath.path()); - QDBusObjectPath connection = conDetails->connection(); - serviceName = conDetails->serviceName(); - QList so = conDetails->devices(); - foreach(QDBusObjectPath device, so) { - - if(device.path() == devicePath) { - path = connection.path(); - } - break; - } - } -if(serviceName.isEmpty()) - return; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(serviceName); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); - startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - } - if(startTime.isNull()) - startTime = QDateTime::currentDateTime(); -} -#endif - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index cd73c9a..6395250 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -53,28 +53,26 @@ // We mean it. // -#include "qnetworkconfigmanager_p.h" #include "qnetworksession.h" -#include "qnetworksessionengine_p.h" +#include "qnetworkconfiguration_p.h" -#include "qnetworksession.h" #include -#include QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; - -class QNetworkSessionPrivate : public QObject +class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject { Q_OBJECT + + friend class QNetworkSession; + public: - QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false) + QNetworkSessionPrivate() + : state(QNetworkSession::Invalid), isOpen(false) { } - ~QNetworkSessionPrivate() + virtual ~QNetworkSessionPrivate() { } @@ -82,49 +80,46 @@ public: //that the state is immediately updated (w/o actually opening //a session). Also this function should take care of //notification hooks to discover future state changes. - void syncStateWithInterface(); + virtual void syncStateWithInterface() = 0; + + virtual QNetworkInterface currentInterface() const = 0; + virtual QVariant sessionProperty(const QString& key) const = 0; + virtual void setSessionProperty(const QString& key, const QVariant& value) = 0; - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; + virtual void open() = 0; + virtual void close() = 0; + virtual void stop() = 0; - void open(); - void close(); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); + virtual void setALREnabled(bool enabled) { } + virtual void migrate() = 0; + virtual void accept() = 0; + virtual void ignore() = 0; + virtual void reject() = 0; - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; + virtual QString errorString() const = 0; //must return translated string + virtual QNetworkSession::SessionError error() const = 0; - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; + virtual quint64 bytesWritten() const = 0; + virtual quint64 bytesReceived() const = 0; + virtual quint64 activeTime() const = 0; -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); +protected: + inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const + { + return config.d; + } Q_SIGNALS: //releases any pending waitForOpened() calls void quitPendingWaitsForOpened(); -private Q_SLOTS: - void networkConfigurationsChanged(); - void configurationChanged(const QNetworkConfiguration &config); - void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); - -private: - QNetworkConfigurationManager manager; - - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; + void error(QNetworkSession::SessionError error); + void stateChanged(QNetworkSession::State state); + void closed(); + void newConfigurationActivated(); + void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); +protected: // The config set on QNetworkSession. QNetworkConfiguration publicConfig; @@ -140,19 +135,7 @@ private: QNetworkSession::State state; bool isOpen; - bool opened; - - QNetworkSessionEngine *engine; - - QNetworkSession::SessionError lastError; - - QNetworkSession* q; - friend class QNetworkSession; - -#if defined(BACKEND_NM) - QDateTime startTime; - void setActiveTimeStamp(); -#endif + QNetworkSession *q; }; QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp deleted file mode 100644 index 4d427c8..0000000 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ /dev/null @@ -1,1134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qnetworksession_s60_p.h" -#include "qnetworkconfiguration_s60_p.h" -#include "qnetworkconfigmanager_s60_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QNetworkSessionPrivate::QNetworkSessionPrivate() - : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), - isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), - iALREnabled(0) -{ - CActiveScheduler::Add(this); - - // Try to load "Open C" dll dynamically and - // try to attach to setdefaultif function dynamically. - if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { - iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564); - } - - TRAP_IGNORE(iConnectionMonitor.ConnectL()); -} - -QNetworkSessionPrivate::~QNetworkSessionPrivate() -{ - isOpen = false; - - // Cancel Connection Progress Notifications first. - // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() - // => deleting ipConnectionNotifier results RConnection::CancelProgressNotification() - delete ipConnectionNotifier; - ipConnectionNotifier = NULL; - - // Cancel possible RConnection::Start() - Cancel(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (iMobility) { - delete iMobility; - iMobility = NULL; - } -#endif - - iConnection.Close(); - iSocketServ.Close(); - if (iDynamicSetdefaultif) { - iDynamicSetdefaultif(0); - } - - iConnectionMonitor.CancelNotifications(); - iConnectionMonitor.Close(); - - iOpenCLibrary.Close(); -} - -void QNetworkSessionPrivate::syncStateWithInterface() -{ - if (!publicConfig.d) { - return; - } - - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - - // Check open connections to see if there is already - // an open connection to selected IAP or SNAP - TUint count; - TRequestStatus status; - iConnectionMonitor.GetConnectionCount(count, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) { - return; - } - - TUint numSubConnections; - TUint connectionId; - for (TUint i = 1; i <= count; i++) { - TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); - if (ret == KErrNone) { - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - TInt connectionStatus; - iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status); - User::WaitForRequest(status); - if (connectionStatus == KLinkLayerOpen) { - if (state != QNetworkSession::Closing) { - if (newState(QNetworkSession::Connected, apId)) { - return; - } - } - } - } - } - } - - if (state != QNetworkSession::Connected) { - // There were no open connections to used IAP or SNAP - if ((publicConfig.d.data()->state & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::NotAvailable); - } - } -} - -QNetworkInterface QNetworkSessionPrivate::interface(TUint iapId) const -{ - QString interfaceName; - - TSoInetInterfaceInfo ifinfo; - TPckg ifinfopkg(ifinfo); - TSoInetIfQuery ifquery; - TPckg ifquerypkg(ifquery); - - // Open dummy socket for interface queries - RSocket socket; - TInt retVal = socket.Open(iSocketServ, _L("udp")); - if (retVal != KErrNone) { - return QNetworkInterface(); - } - - // Start enumerating interfaces - socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); - while(socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) { - ifquery.iName = ifinfo.iName; - TInt err = socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg); - if(err == KErrNone && ifquery.iZone[1] == iapId) { // IAP ID is index 1 of iZone - if(ifinfo.iAddress.Address() > 0) { - interfaceName = QString::fromUtf16(ifinfo.iName.Ptr(),ifinfo.iName.Length()); - break; - } - } - } - - socket.Close(); - - if (interfaceName.isEmpty()) { - return QNetworkInterface(); - } - - return QNetworkInterface::interfaceFromName(interfaceName); -} - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || state != QNetworkSession::Connected) { - return QNetworkInterface(); - } - - return activeInterface; -} - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const -{ - return QVariant(); -} - -void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) -{ -} - -QString QNetworkSessionPrivate::errorString() const -{ - switch (iError) { - case QNetworkSession::UnknownSessionError: - return tr("Unknown session error."); - case QNetworkSession::SessionAbortedError: - return tr("The session was aborted by the user or system."); - case QNetworkSession::OperationNotSupportedError: - return tr("The requested operation is not supported by the system."); - case QNetworkSession::InvalidConfigurationError: - return tr("The specified configuration cannot be used."); - case QNetworkSession::RoamingError: - return tr("Roaming was aborted or is not possible."); - } - - return QString(); -} - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return iError; -} - -void QNetworkSessionPrivate::open() -{ - if (isOpen || !publicConfig.d || (state == QNetworkSession::Connecting)) { - return; - } - - // Cancel notifications from RConnectionMonitor - // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring - iConnectionMonitor.CancelNotifications(); - - TInt error = iSocketServ.Connect(); - if (error != KErrNone) { - // Could not open RSocketServ - newState(QNetworkSession::Invalid); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - syncStateWithInterface(); - return; - } - - error = iConnection.Open(iSocketServ); - if (error != KErrNone) { - // Could not open RConnection - iSocketServ.Close(); - newState(QNetworkSession::Invalid); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - syncStateWithInterface(); - return; - } - - // Use RConnection::ProgressNotification for IAP/SNAP monitoring - // (<=> ConnectionProgressNotifier uses RConnection::ProgressNotification) - if (!ipConnectionNotifier) { - ipConnectionNotifier = new ConnectionProgressNotifier(*this,iConnection); - } - if (ipConnectionNotifier) { - ipConnectionNotifier->StartNotifications(); - } - - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - // Search through existing connections. - // If there is already connection which matches to given IAP - // try to attach to existing connection. - TBool connected(EFalse); - TConnectionInfoBuf connInfo; - TUint count; - if (iConnection.EnumerateConnections(count) == KErrNone) { - for (TUint i=1; i<=count; i++) { - // Note: GetConnectionInfo expects 1-based index. - if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { - if (connInfo().iIapId == publicConfig.d.data()->numericId) { - if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { - activeConfig = publicConfig; - activeInterface = interface(activeConfig.d.data()->numericId); - connected = ETrue; - startTime = QDateTime::currentDateTime(); - if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = publicConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - error = iDynamicSetdefaultif(&ifr); - } - isOpen = true; - // Make sure that state will be Connected - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - break; - } - } - } - } - } - if (!connected) { - TCommDbConnPref pref; - pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); - pref.SetIapId(publicConfig.d.data()->numericId); - iConnection.Start(pref, iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - TConnSnapPref snapPref(publicConfig.d.data()->numericId); - iConnection.Start(snapPref, iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - iKnownConfigsBeforeConnectionStart = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); - iConnection.Start(iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } - - if (error != KErrNone) { - isOpen = false; - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - } -} - -TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const -{ - TRequestStatus status; - TUint connectionCount; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - for (TUint i = 1; i <= connectionCount; i++) { - TUint connectionId; - TUint subConnectionCount; - iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - if (apId == aIAPId) { - TConnMonClientEnumBuf buf; - iConnectionMonitor.GetPckgAttribute(connectionId, 0, KClientInfo, buf, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - return buf().iCount; - } - } - } - } - return 0; -} - -void QNetworkSessionPrivate::close(bool allowSignals) -{ - if (!isOpen) { - return; - } - - TUint activeIap = activeConfig.d.data()->numericId; - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - - Cancel(); -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (iMobility) { - delete iMobility; - iMobility = NULL; - } -#endif - - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - - iConnection.Close(); - iSocketServ.Close(); - if (iDynamicSetdefaultif) { - iDynamicSetdefaultif(0); - } - -#ifdef Q_CC_NOKIAX86 - if ((allowSignals && iapClientCount(activeIap) <= 0) || -#else - if ((allowSignals && iapClientCount(activeIap) <= 1) || -#endif - (publicConfig.type() == QNetworkConfiguration::UserChoice)) { - newState(QNetworkSession::Closing); - } - - syncStateWithInterface(); - if (allowSignals) { - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - newState(QNetworkSession::Disconnected); - } - emit q->closed(); - } -} - -void QNetworkSessionPrivate::stop() -{ - if (!isOpen) { - return; - } - isOpen = false; - newState(QNetworkSession::Closing); - iConnection.Stop(RConnection::EStopAuthoritative); - isOpen = true; - close(false); - emit q->closed(); -} - -void QNetworkSessionPrivate::migrate() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->MigrateToPreferredCarrier(); -#endif -} - -void QNetworkSessionPrivate::ignore() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->IgnorePreferredCarrier(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::Connected,iOldRoamingIap); - } -#endif -} - -void QNetworkSessionPrivate::accept() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierAccepted(); - if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = activeConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - iDynamicSetdefaultif(&ifr); - } - newState(QNetworkSession::Connected, iNewRoamingIap); -#endif -} - -void QNetworkSessionPrivate::reject() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierRejected(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::Connected, iOldRoamingIap); - } -#endif -} - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -void QNetworkSessionPrivate::PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, - TAccessPointInfo aNewAPInfo, - TBool aIsUpgrade, - TBool aIsSeamless) -{ - iOldRoamingIap = aOldAPInfo.AccessPoint(); - iNewRoamingIap = aNewAPInfo.AccessPoint(); - newState(QNetworkSession::Roaming); - if (iALREnabled > 0) { - iALRUpgradingConnection = aIsUpgrade; - QList configs = publicConfig.children(); - for (int i=0; i < configs.count(); i++) { - if (configs[i].d.data()->numericId == aNewAPInfo.AccessPoint()) { - emit q->preferredConfigurationChanged(configs[i],aIsSeamless); - } - } - } else { - migrate(); - } -} - -void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) -{ - if (iALREnabled > 0) { - emit q->newConfigurationActivated(); - } else { - accept(); - } -} - -void QNetworkSessionPrivate::Error(TInt /*aError*/) -{ - if (isOpen) { - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::RoamingError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - // In some cases IAP is still in Connected state when - // syncStateWithInterface(); is called - // => Following call makes sure that Session state - // changes immediately to Disconnected. - newState(QNetworkSession::Disconnected); - emit q->closed(); - } -} -#endif - -void QNetworkSessionPrivate::setALREnabled(bool enabled) -{ - if (enabled) { - iALREnabled++; - } else { - iALREnabled--; - } -} - -QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const -{ - QNetworkConfiguration config; - QList subConfigurations = snapConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].state() == QNetworkConfiguration::Active) { - config = subConfigurations[i]; - break; - } else if (!config.isValid() && subConfigurations[i].state() == QNetworkConfiguration::Discovered) { - config = subConfigurations[i]; - } - } - if (!config.isValid() && subConfigurations.count() > 0) { - config = subConfigurations[0]; - } - return config; -} - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ - return transferredData(KUplinkData); -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ - return transferredData(KDownlinkData); -} - -quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const -{ - if (!publicConfig.isValid()) { - return 0; - } - - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (serviceConfig.isValid()) { - config = serviceConfig; - } else { - if (activeConfig.isValid()) { - config = activeConfig; - } - } - } else { - config = publicConfig; - } - - if (!config.isValid()) { - return 0; - } - - TUint count; - TRequestStatus status; - iConnectionMonitor.GetConnectionCount(count, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) { - return 0; - } - - TUint transferredData = 0; - TUint numSubConnections; - TUint connectionId; - bool configFound; - for (TUint i = 1; i <= count; i++) { - TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); - if (ret == KErrNone) { - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - configFound = false; - if (config.type() == QNetworkConfiguration::ServiceNetwork) { - QList configs = config.children(); - for (int i=0; i < configs.count(); i++) { - if (configs[i].d.data()->numericId == apId) { - configFound = true; - break; - } - } - } else if (config.d.data()->numericId == apId) { - configFound = true; - } - if (configFound) { - TUint tData; - iConnectionMonitor.GetUintAttribute(connectionId, 0, dataType, tData, status ); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - transferredData += tData; - } - } - } - } - } - - return transferredData; -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ - if (!isOpen || startTime.isNull()) { - return 0; - } - return startTime.secsTo(QDateTime::currentDateTime()); -} - -QNetworkConfiguration QNetworkSessionPrivate::activeConfiguration(TUint32 iapId) const -{ - if (iapId == 0) { - _LIT(KSetting, "IAP\\Id"); - iConnection.GetIntSetting(KSetting, iapId); - } - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - // Try to search IAP from the used SNAP using IAP Id - QList children = publicConfig.children(); - for (int i=0; i < children.count(); i++) { - if (children[i].d.data()->numericId == iapId) { - return children[i]; - } - } - - // Given IAP Id was not found from the used SNAP - // => Try to search matching IAP using mappingName - // mappingName contains: - // 1. "Access point name" for "Packet data" Bearer - // 2. "WLAN network name" (= SSID) for "Wireless LAN" Bearer - // 3. "Dial-up number" for "Data call Bearer" or "High Speed (GSM)" Bearer - // <=> Note: It's possible that in this case reported IAP is - // clone of the one of the IAPs of the used SNAP - // => If mappingName matches, clone has been found - QNetworkConfiguration pt; - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); - if (pt.d) { - for (int i=0; i < children.count(); i++) { - if (children[i].d.data()->mappingName == pt.d.data()->mappingName) { - return children[i]; - } - } - } else { - // Given IAP Id was not found from known IAPs array - return QNetworkConfiguration(); - } - - // Matching IAP was not found from used SNAP - // => IAP from another SNAP is returned - // (Note: Returned IAP matches to given IAP Id) - return pt; - } -#endif - - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (publicConfig.d.data()->manager) { - QNetworkConfiguration pt; - // Try to found User Selected IAP from known IAPs (accessPointConfigurations) - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); - if (pt.d) { - return pt; - } else { - // Check if new (WLAN) IAP was created in IAP/SNAP dialog - // 1. Sync internal configurations array to commsdb first - ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->updateConfigurations(); - // 2. Check if new configuration was created during connection creation - QList knownConfigs = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); - if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { - // Configuration count increased => new configuration was created - // => Search new, created configuration - QString newIapId; - for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { - if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { - newIapId = knownConfigs[i]; - break; - } - } - if (newIapId.isEmpty()) { - newIapId = knownConfigs[knownConfigs.count()-1]; - } - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(newIapId); - if (pt.d) { - return pt; - } - } - } - } - return QNetworkConfiguration(); - } - - return publicConfig; -} - -void QNetworkSessionPrivate::RunL() -{ - TInt statusCode = iStatus.Int(); - - switch (statusCode) { - case KErrNone: // Connection created succesfully - { - TInt error = KErrNone; - QNetworkConfiguration newActiveConfig = activeConfiguration(); - if (!newActiveConfig.isValid()) { - error = KErrGeneral; - } else if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - error = iDynamicSetdefaultif(&ifr); - } - - if (error != KErrNone) { - isOpen = false; - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - return; - } - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - // Activate ALR monitoring - iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); - } -#endif - isOpen = true; - activeConfig = newActiveConfig; - activeInterface = interface(activeConfig.d.data()->numericId); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - QNetworkConfiguration pt; - pt.d = activeConfig.d.data()->serviceNetworkPtr; - serviceConfig = pt; - } - - startTime = QDateTime::currentDateTime(); - - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - } - break; - case KErrNotFound: // Connection failed - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::InvalidConfigurationError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - break; - case KErrCancel: // Connection attempt cancelled - case KErrAlreadyExists: // Connection already exists - default: - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - break; - } -} - -void QNetworkSessionPrivate::DoCancel() -{ - iConnection.Close(); -} - -bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint accessPointId) -{ - // Make sure that activeConfig is always updated when SNAP is signaled to be - // connected. - if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && - newState == QNetworkSession::Connected) { - activeConfig = activeConfiguration(accessPointId); - activeInterface = interface(activeConfig.d.data()->numericId); - } - - // Make sure that same state is not signaled twice in a row. - if (state == newState) { - return true; - } - - // Make sure that Connecting state does not overwrite Roaming state - if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { - return false; - } - - bool emitSessionClosed = false; - if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { - // Active & Connected state should change directly to Disconnected state - // only when something forces connection to close (eg. when another - // application or session stops connection or when network drops - // unexpectedly). - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::SessionAbortedError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - emitSessionClosed = true; // Emit SessionClosed after state change has been reported - } - - bool retVal = false; - if (accessPointId == 0) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } else { - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->numericId == accessPointId) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { - if (activeConfig.d.data()->numericId == accessPointId) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++) { - if (subConfigurations[i].d.data()->numericId == accessPointId) { - if (newState == QNetworkSession::Connected) { - // Make sure that when AccessPoint is reported to be Connected - // also state of the related configuration changes to Active. - subConfigurations[i].d.data()->state = QNetworkConfiguration::Active; - - state = newState; - emit q->stateChanged(state); - retVal = true; - } else { - if (newState == QNetworkSession::Disconnected) { - // Make sure that when AccessPoint is reported to be disconnected - // also state of the related configuration changes from Active to Defined. - subConfigurations[i].d.data()->state = QNetworkConfiguration::Defined; - } - QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); - if ((config.state() == QNetworkConfiguration::Defined) || - (config.state() == QNetworkConfiguration::Discovered)) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } - } - } - } - } - - if (emitSessionClosed) { - emit q->closed(); - } - - return retVal; -} - -void QNetworkSessionPrivate::handleSymbianConnectionStatusChange(TInt aConnectionStatus, - TInt aError, - TUint accessPointId) -{ - switch (aConnectionStatus) - { - // Connection unitialised - case KConnectionUninitialised: - break; - - // Starting connetion selection - case KStartingSelection: - break; - - // Selection finished - case KFinishedSelection: - if (aError == KErrNone) - { - // The user successfully selected an IAP to be used - break; - } - else - { - // The user pressed e.g. "Cancel" and did not select an IAP - newState(QNetworkSession::Disconnected,accessPointId); - } - break; - - // Connection failure - case KConnectionFailure: - newState(QNetworkSession::NotAvailable); - break; - - // Prepearing connection (e.g. dialing) - case KPsdStartingConfiguration: - case KPsdFinishedConfiguration: - case KCsdFinishedDialling: - case KCsdScanningScript: - case KCsdGettingLoginInfo: - case KCsdGotLoginInfo: - break; - - // Creating connection (e.g. GPRS activation) - case KCsdStartingConnect: - case KCsdFinishedConnect: - newState(QNetworkSession::Connecting,accessPointId); - break; - - // Starting log in - case KCsdStartingLogIn: - break; - - // Finished login - case KCsdFinishedLogIn: - break; - - // Connection open - case KConnectionOpen: - break; - - case KLinkLayerOpen: - newState(QNetworkSession::Connected,accessPointId); - break; - - // Connection blocked or suspended - case KDataTransferTemporarilyBlocked: - break; - - // Hangup or GRPS deactivation - case KConnectionStartingClose: - newState(QNetworkSession::Closing,accessPointId); - break; - - // Connection closed - case KConnectionClosed: - break; - - case KLinkLayerClosed: - newState(QNetworkSession::Disconnected,accessPointId); - break; - - // Unhandled state - default: - break; - } -} - -void QNetworkSessionPrivate::EventL(const CConnMonEventBase& aEvent) -{ - switch (aEvent.EventType()) - { - case EConnMonConnectionStatusChange: - { - CConnMonConnectionStatusChange* realEvent; - realEvent = (CConnMonConnectionStatusChange*) &aEvent; - - TUint connectionId = realEvent->ConnectionId(); - TInt connectionStatus = realEvent->ConnectionStatus(); - - // Try to Find IAP Id using connection Id - TUint apId = 0; - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->connectionId == connectionId) { - apId = subConfigurations[i].d.data()->numericId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->connectionId == connectionId) { - apId = publicConfig.d.data()->numericId; - } - } - - if (apId > 0) { - handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); - } - } - break; - - case EConnMonCreateConnection: - { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - // Store connection id to related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->numericId == apId) { - subConfigurations[i].d.data()->connectionId = connectionId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->numericId == apId) { - publicConfig.d.data()->connectionId = connectionId; - } - } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - // Remove connection id from related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->connectionId == connectionId) { - subConfigurations[i].d.data()->connectionId = 0; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->connectionId == connectionId) { - publicConfig.d.data()->connectionId = 0; - } - } - } - break; - - default: - // For unrecognized events - break; - } -} - -ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) -{ - CActiveScheduler::Add(this); -} - -ConnectionProgressNotifier::~ConnectionProgressNotifier() -{ - Cancel(); -} - -void ConnectionProgressNotifier::StartNotifications() -{ - if (!IsActive()) { - SetActive(); - } - iConnection.ProgressNotification(iProgress, iStatus); -} - -void ConnectionProgressNotifier::StopNotifications() -{ - Cancel(); -} - -void ConnectionProgressNotifier::DoCancel() -{ - iConnection.CancelProgressNotification(); -} - -void ConnectionProgressNotifier::RunL() -{ - if (iStatus == KErrNone) { - iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); - - SetActive(); - iConnection.ProgressNotification(iProgress, iStatus); - } -} - -#include "moc_qnetworksession_s60_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h deleted file mode 100644 index 9ac5ed8..0000000 --- a/src/network/bearer/qnetworksession_s60_p.h +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONPRIVATE_H -#define QNETWORKSESSIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksession.h" - -#include - -#include -#include -#include -#include -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include -#endif - -typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); - -QT_BEGIN_NAMESPACE - -class ConnectionProgressNotifier; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -class QNetworkSessionPrivate : public QObject, public CActive, public MMobilityProtocolResp, - public MConnectionMonitorObserver -#else -class QNetworkSessionPrivate : public QObject, public CActive, public MConnectionMonitorObserver -#endif -{ - Q_OBJECT -public: - QNetworkSessionPrivate(); - ~QNetworkSessionPrivate(); - - //called by QNetworkSession constructor and ensures - //that the state is immediately updated (w/o actually opening - //a session). Also this function should take care of - //notification hooks to discover future state changes. - void syncStateWithInterface(); - - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - - void setALREnabled(bool enabled); - - void open(); - void close(bool allowSignals = true); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); - - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -public: // From MMobilityProtocolResp - void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, - TAccessPointInfo aNewAPInfo, - TBool aIsUpgrade, - TBool aIsSeamless); - - void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless); - - void Error(TInt aError); -#endif - -Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // MConnectionMonitorObserver - void EventL(const CConnMonEventBase& aEvent); - -private: - TUint iapClientCount(TUint aIAPId) const; - quint64 transferredData(TUint dataType) const; - bool newState(QNetworkSession::State newState, TUint accessPointId = 0); - void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); - QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; - QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; - QNetworkInterface interface(TUint iapId) const; - -private: // data - // The config set on QNetworkSession - mutable QNetworkConfiguration publicConfig; - - // If publicConfig is a ServiceNetwork this is a copy of publicConfig. - // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual - // ServiceNetwork configuration. - mutable QNetworkConfiguration serviceConfig; - - // This is the actual active configuration currently in use by the session. - // Either a copy of publicConfig or one of serviceConfig.children(). - mutable QNetworkConfiguration activeConfig; - - mutable QNetworkInterface activeInterface; - - QNetworkSession::State state; - bool isOpen; - - QNetworkSession* q; - QDateTime startTime; - - RLibrary iOpenCLibrary; - TOpenCSetdefaultifFunction iDynamicSetdefaultif; - - mutable RSocketServ iSocketServ; - mutable RConnection iConnection; - mutable RConnectionMonitor iConnectionMonitor; - ConnectionProgressNotifier* ipConnectionNotifier; -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - CActiveCommsMobilityApiExt* iMobility; -#endif - - QNetworkSession::SessionError iError; - TInt iALREnabled; - TBool iALRUpgradingConnection; - - QList iKnownConfigsBeforeConnectionStart; - - TUint32 iOldRoamingIap; - TUint32 iNewRoamingIap; - - friend class QNetworkSession; - friend class ConnectionProgressNotifier; -}; - -class ConnectionProgressNotifier : public CActive -{ -public: - ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection); - ~ConnectionProgressNotifier(); - - void StartNotifications(); - void StopNotifications(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // Data - QNetworkSessionPrivate& iOwner; - RConnection& iConnection; - TNifProgressBuf iProgress; - -}; - -QT_END_NAMESPACE - -#endif //QNETWORKSESSIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index a1a3370..02772cb 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -97,6 +97,8 @@ public: virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + virtual QNetworkSessionPrivate *createSessionBackend() = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 0015041..d039731 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -4,8 +4,11 @@ include(../../qpluginbase.pri) QT += network HEADERS += qgenericengine.h \ + ../qnetworksession_impl.h \ ../platformdefs_win.h -SOURCES += qgenericengine.cpp main.cpp +SOURCES += qgenericengine.cpp \ + ../qnetworksession_impl.cpp \ + main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d50aa75..e9770e1 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qgenericengine.h" +#include "../qnetworksession_impl.h" #include @@ -142,8 +143,6 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { - qDebug() << Q_FUNC_INFO; - connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); doRequestUpdate(); @@ -321,5 +320,10 @@ QNetworkConfigurationManager::Capabilities QGenericEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QGenericEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 730301b..04b845e 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; +class QNetworkSessionPrivate; class QGenericEngine : public QNetworkSessionEngine { @@ -73,6 +74,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp new file mode 100644 index 0000000..49a2d72 --- /dev/null +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -0,0 +1,485 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworksession_impl.h" + +#include +#include +#include + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +static QNetworkSessionEngine *getEngineFromId(const QString &id) +{ + QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); + + foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { + if (engine->hasIdentifier(id)) + return engine; + } + + return 0; +} + +class QNetworkSessionManagerPrivate : public QObject +{ + Q_OBJECT + +public: + QNetworkSessionManagerPrivate(QObject *parent = 0); + ~QNetworkSessionManagerPrivate(); + + void forceSessionClose(const QNetworkConfiguration &config); + +Q_SIGNALS: + void forcedSessionClose(const QNetworkConfiguration &config); +}; + +#include "qnetworksession_p.moc" + +Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); + +QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) +: QObject(parent) +{ +} + +QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() +{ +} + +void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) +{ + emit forcedSessionClose(config); +} + +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), + this, SLOT(forcedSessionClose(QNetworkConfiguration))); + + opened = false; + isOpen = false; + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + qRegisterMetaType + ("QNetworkSessionEngine::ConnectionError"); + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + // Defer setting engine and signals until open(). + // fall through + case QNetworkConfiguration::UserChoice: + // Defer setting serviceConfig and activeConfig until open(). + // fall through + default: + engine = 0; + } + + networkConfigurationsChanged(); +} + +void QNetworkSessionPrivateImpl::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (!isOpen) { + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && + (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Connecting; + emit stateChanged(state); + + engine->connectToId(activeConfig.identifier()); + } + + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) + emit quitPendingWaitsForOpened(); + } +} + +void QNetworkSessionPrivateImpl::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (isOpen) { + opened = false; + isOpen = false; + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit stateChanged(state); + + engine->disconnectFromId(activeConfig.identifier()); + + sessionManager()->forceSessionClose(activeConfig); + } + + opened = false; + isOpen = false; + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) + return QNetworkInterface(); + + QString interface = engine->getInterfaceFromId(activeConfig.identifier()); + + if (interface.isEmpty()) + return QNetworkInterface(); + return QNetworkInterface::interfaceFromName(interface); +} + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +/*QString QNetworkSessionPrivateImpl::bearerName() const +{ + if (!publicConfig.isValid() || !engine) + return QString(); + + return engine->bearerName(activeConfig.identifier()); +}*/ + +QString QNetworkSessionPrivateImpl::errorString() const +{ + switch (lastError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return lastError; +} + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ +#if defined(BACKEND_NM) && 0 + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); + } + } +#endif + return tx_data; +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ +#if defined(BACKEND_NM) && 0 + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); + } + } +#endif + return rx_data; +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ +#if defined(BACKEND_NM) + if (startTime.isNull()) { + return 0; + } + if(state == QNetworkSession::Connected ) + return startTime.secsTo(QDateTime::currentDateTime()); +#endif + return m_activeTime; +} + +void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + if (engine) { + disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); + } + + activeConfig = config; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + emit newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + qDebug() << oldState << "->" << state; + if (state != oldState) + emit stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + qDebug() << oldState << "->" << state; + if (state != oldState) + emit stateChanged(state); +} + +void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() +{ + if (!engine) + return; + + QNetworkSession::State oldState = state; + + state = engine->sessionStateForId(activeConfig.identifier()); + + bool oldActive = isOpen; + isOpen = (state == QNetworkSession::Connected) ? opened : false; + + if (!oldActive && isOpen) + emit quitPendingWaitsForOpened(); + if (oldActive && !isOpen) + emit closed(); + + if (oldState != state) + emit stateChanged(state); +} + +void QNetworkSessionPrivateImpl::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +#if defined(BACKEND_NM) && 0 + setActiveTimeStamp(); +#endif +} + +void QNetworkSessionPrivateImpl::configurationChanged(const QNetworkConfiguration &config) +{ + if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig)) + updateStateFromServiceNetwork(); + else if (config == activeConfig) + updateStateFromActiveConfig(); +} + +void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config) +{ + if (activeConfig == config) { + opened = false; + isOpen = false; + + emit closed(); + + lastError = QNetworkSession::SessionAbortedError; + emit QNetworkSessionPrivate::error(lastError); + } +} + +void QNetworkSessionPrivateImpl::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) +{ + if (activeConfig.identifier() == id) { + networkConfigurationsChanged(); + switch (error) { + case QNetworkSessionEngine::OperationNotSupported: + lastError = QNetworkSession::OperationNotSupportedError; + opened = false; + break; + case QNetworkSessionEngine::InterfaceLookupError: + case QNetworkSessionEngine::ConnectError: + case QNetworkSessionEngine::DisconnectionError: + default: + lastError = QNetworkSession::UnknownSessionError; + } + + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(lastError); + } +} + +#if defined(BACKEND_NM) && 0 +void QNetworkSessionPrivateImpl::setActiveTimeStamp() +{ + if(NetworkManagerAvailable()) { + startTime = QDateTime(); + return; + } + QString connectionIdent = q->configuration().identifier(); + QString interface = currentInterface().hardwareAddress().toLower(); + QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); + + QString path; + QString serviceName; + QNetworkManagerInterface * ifaceD; + ifaceD = new QNetworkManagerInterface(); + + QList connections = ifaceD->activeConnections(); + foreach(QDBusObjectPath conpath, connections) { + QNetworkManagerConnectionActive *conDetails; + conDetails = new QNetworkManagerConnectionActive(conpath.path()); + QDBusObjectPath connection = conDetails->connection(); + serviceName = conDetails->serviceName(); + QList so = conDetails->devices(); + foreach(QDBusObjectPath device, so) { + + if(device.path() == devicePath) { + path = connection.path(); + } + break; + } + } +if(serviceName.isEmpty()) + return; + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(serviceName); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); + startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); + // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + } + if(startTime.isNull()) + startTime = QDateTime::currentDateTime(); +} +#endif + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h new file mode 100644 index 0000000..104d1f0 --- /dev/null +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkSessionEngine; + +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate +{ + Q_OBJECT +public: + QNetworkSessionPrivateImpl() : + tx_data(0), rx_data(0), m_activeTime(0) + { + } + + ~QNetworkSessionPrivateImpl() + { + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void open(); + void close(); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private Q_SLOTS: + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + void forcedSessionClose(const QNetworkConfiguration &config); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); + +private: + QNetworkConfigurationManager manager; + + quint64 tx_data; + quint64 rx_data; + quint64 m_activeTime; + + bool opened; + + QNetworkSessionEngine *engine; + + QNetworkSession::SessionError lastError; + +#if defined(BACKEND_NM) + QDateTime startTime; + void setActiveTimeStamp(); +#endif +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSION_IMPL_H + diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 8865f4d..22d654a 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -72,8 +72,6 @@ QStringList QSymbianEnginePlugin::keys() const QBearerEngine *QSymbianEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("symbian")) return new SymbianEngine; else diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp new file mode 100644 index 0000000..24948cf --- /dev/null +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -0,0 +1,1125 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworksession_impl.h" +#include "symbianengine.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) + : CActive(CActive::EPriorityStandard), engine(engine), ipConnectionNotifier(0), + iError(QNetworkSession::UnknownSessionError), + iALREnabled(0) +{ + CActiveScheduler::Add(this); + + // Try to load "Open C" dll dynamically and + // try to attach to setdefaultif function dynamically. + if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { + iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564); + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); +} + +QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() +{ + isOpen = false; + + // Cancel Connection Progress Notifications first. + // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() + // => deleting ipConnectionNotifier results RConnection::CancelProgressNotification() + delete ipConnectionNotifier; + ipConnectionNotifier = NULL; + + // Cancel possible RConnection::Start() + Cancel(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + + iOpenCLibrary.Close(); +} + +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + if (!privateConfiguration(publicConfig)) + return; + + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + + // Check open connections to see if there is already + // an open connection to selected IAP or SNAP + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return; + } + + TUint numSubConnections; + TUint connectionId; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + TInt connectionStatus; + iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status); + User::WaitForRequest(status); + if (connectionStatus == KLinkLayerOpen) { + if (state != QNetworkSession::Closing) { + if (newState(QNetworkSession::Connected, apId)) { + return; + } + } + } + } + } + } + + if (state != QNetworkSession::Connected) { + // There were no open connections to used IAP or SNAP + if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::NotAvailable); + } + } +} + +QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const +{ + QString interfaceName; + + TSoInetInterfaceInfo ifinfo; + TPckg ifinfopkg(ifinfo); + TSoInetIfQuery ifquery; + TPckg ifquerypkg(ifquery); + + // Open dummy socket for interface queries + RSocket socket; + TInt retVal = socket.Open(iSocketServ, _L("udp")); + if (retVal != KErrNone) { + return QNetworkInterface(); + } + + // Start enumerating interfaces + socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); + while(socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) { + ifquery.iName = ifinfo.iName; + TInt err = socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg); + if(err == KErrNone && ifquery.iZone[1] == iapId) { // IAP ID is index 1 of iZone + if(ifinfo.iAddress.Address() > 0) { + interfaceName = QString::fromUtf16(ifinfo.iName.Ptr(),ifinfo.iName.Length()); + break; + } + } + } + + socket.Close(); + + if (interfaceName.isEmpty()) { + return QNetworkInterface(); + } + + return QNetworkInterface::interfaceFromName(interfaceName); +} + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) { + return QNetworkInterface(); + } + + return activeInterface; +} + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +QString QNetworkSessionPrivateImpl::errorString() const +{ + switch (iError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return iError; +} + +void QNetworkSessionPrivateImpl::open() +{ + if (isOpen || !privateConfiguration(publicConfig) || (state == QNetworkSession::Connecting)) { + return; + } + + // Cancel notifications from RConnectionMonitor + // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring + iConnectionMonitor.CancelNotifications(); + + TInt error = iSocketServ.Connect(); + if (error != KErrNone) { + // Could not open RSocketServ + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + syncStateWithInterface(); + return; + } + + error = iConnection.Open(iSocketServ); + if (error != KErrNone) { + // Could not open RConnection + iSocketServ.Close(); + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + syncStateWithInterface(); + return; + } + + // Use RConnection::ProgressNotification for IAP/SNAP monitoring + // (<=> ConnectionProgressNotifier uses RConnection::ProgressNotification) + if (!ipConnectionNotifier) { + ipConnectionNotifier = new ConnectionProgressNotifier(*this,iConnection); + } + if (ipConnectionNotifier) { + ipConnectionNotifier->StartNotifications(); + } + + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + // Search through existing connections. + // If there is already connection which matches to given IAP + // try to attach to existing connection. + TBool connected(EFalse); + TConnectionInfoBuf connInfo; + TUint count; + if (iConnection.EnumerateConnections(count) == KErrNone) { + for (TUint i=1; i<=count; i++) { + // Note: GetConnectionInfo expects 1-based index. + if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { + if (connInfo().iIapId == toSymbianConfig(privateConfiguration(publicConfig))->numericId) { + if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { + activeConfig = publicConfig; + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + connected = ETrue; + startTime = QDateTime::currentDateTime(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = publicConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + isOpen = true; + // Make sure that state will be Connected + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + break; + } + } + } + } + } + if (!connected) { + TCommDbConnPref pref; + pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); + pref.SetIapId(toSymbianConfig(privateConfiguration(publicConfig))->numericId); + iConnection.Start(pref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + TConnSnapPref snapPref(toSymbianConfig(privateConfiguration(publicConfig))->numericId); + iConnection.Start(snapPref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurations.keys(); + iConnection.Start(iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + + if (error != KErrNone) { + isOpen = false; + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + } +} + +TUint QNetworkSessionPrivateImpl::iapClientCount(TUint aIAPId) const +{ + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + TUint connectionId; + TUint subConnectionCount; + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + if (apId == aIAPId) { + TConnMonClientEnumBuf buf; + iConnectionMonitor.GetPckgAttribute(connectionId, 0, KClientInfo, buf, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + return buf().iCount; + } + } + } + } + return 0; +} + +void QNetworkSessionPrivateImpl::close(bool allowSignals) +{ + if (!isOpen) { + return; + } + + TUint activeIap = toSymbianConfig(privateConfiguration(activeConfig))->numericId; + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + + Cancel(); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + +#ifdef Q_CC_NOKIAX86 + if ((allowSignals && iapClientCount(activeIap) <= 0) || +#else + if ((allowSignals && iapClientCount(activeIap) <= 1) || +#endif + (publicConfig.type() == QNetworkConfiguration::UserChoice)) { + newState(QNetworkSession::Closing); + } + + syncStateWithInterface(); + if (allowSignals) { + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + newState(QNetworkSession::Disconnected); + } + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::stop() +{ + if (!isOpen) { + return; + } + isOpen = false; + newState(QNetworkSession::Closing); + iConnection.Stop(RConnection::EStopAuthoritative); + isOpen = true; + close(false); + emit closed(); +} + +void QNetworkSessionPrivateImpl::migrate() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->MigrateToPreferredCarrier(); +#endif +} + +void QNetworkSessionPrivateImpl::ignore() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->IgnorePreferredCarrier(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected,iOldRoamingIap); + } +#endif +} + +void QNetworkSessionPrivateImpl::accept() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierAccepted(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = activeConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + iDynamicSetdefaultif(&ifr); + } + newState(QNetworkSession::Connected, iNewRoamingIap); +#endif +} + +void QNetworkSessionPrivateImpl::reject() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierRejected(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected, iOldRoamingIap); + } +#endif +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless) +{ + iOldRoamingIap = aOldAPInfo.AccessPoint(); + iNewRoamingIap = aNewAPInfo.AccessPoint(); + newState(QNetworkSession::Roaming); + if (iALREnabled > 0) { + iALRUpgradingConnection = aIsUpgrade; + QList configs = publicConfig.children(); + for (int i=0; i < configs.count(); i++) { + if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == aNewAPInfo.AccessPoint()) { + emit preferredConfigurationChanged(configs[i], aIsSeamless); + } + } + } else { + migrate(); + } +} + +void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) +{ + if (iALREnabled > 0) { + emit newConfigurationActivated(); + } else { + accept(); + } +} + +void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) +{ + if (isOpen) { + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::RoamingError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + // In some cases IAP is still in Connected state when + // syncStateWithInterface(); is called + // => Following call makes sure that Session state + // changes immediately to Disconnected. + newState(QNetworkSession::Disconnected); + emit closed(); + } +} +#endif + +void QNetworkSessionPrivateImpl::setALREnabled(bool enabled) +{ + if (enabled) { + iALREnabled++; + } else { + iALREnabled--; + } +} + +QNetworkConfiguration QNetworkSessionPrivateImpl::bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const +{ + QNetworkConfiguration config; + QList subConfigurations = snapConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].state() == QNetworkConfiguration::Active) { + config = subConfigurations[i]; + break; + } else if (!config.isValid() && subConfigurations[i].state() == QNetworkConfiguration::Discovered) { + config = subConfigurations[i]; + } + } + if (!config.isValid() && subConfigurations.count() > 0) { + config = subConfigurations[0]; + } + return config; +} + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ + return transferredData(KUplinkData); +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ + return transferredData(KDownlinkData); +} + +quint64 QNetworkSessionPrivateImpl::transferredData(TUint dataType) const +{ + if (!publicConfig.isValid()) { + return 0; + } + + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (serviceConfig.isValid()) { + config = serviceConfig; + } else { + if (activeConfig.isValid()) { + config = activeConfig; + } + } + } else { + config = publicConfig; + } + + if (!config.isValid()) { + return 0; + } + + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return 0; + } + + TUint transferredData = 0; + TUint numSubConnections; + TUint connectionId; + bool configFound; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + configFound = false; + if (config.type() == QNetworkConfiguration::ServiceNetwork) { + QList configs = config.children(); + for (int i=0; i < configs.count(); i++) { + if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == apId) { + configFound = true; + break; + } + } + } else if (toSymbianConfig(privateConfiguration(config))->numericId == apId) { + configFound = true; + } + if (configFound) { + TUint tData; + iConnectionMonitor.GetUintAttribute(connectionId, 0, dataType, tData, status ); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + transferredData += tData; + } + } + } + } + } + + return transferredData; +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ + if (!isOpen || startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + +QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 iapId) const +{ + if (iapId == 0) { + _LIT(KSetting, "IAP\\Id"); + iConnection.GetIntSetting(KSetting, iapId); + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Try to search IAP from the used SNAP using IAP Id + QList children = publicConfig.children(); + for (int i=0; i < children.count(); i++) { + if (toSymbianConfig(privateConfiguration(children[i]))->numericId == iapId) { + return children[i]; + } + } + + // Given IAP Id was not found from the used SNAP + // => Try to search matching IAP using mappingName + // mappingName contains: + // 1. "Access point name" for "Packet data" Bearer + // 2. "WLAN network name" (= SSID) for "Wireless LAN" Bearer + // 3. "Dial-up number" for "Data call Bearer" or "High Speed (GSM)" Bearer + // <=> Note: It's possible that in this case reported IAP is + // clone of the one of the IAPs of the used SNAP + // => If mappingName matches, clone has been found + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId))); + if (privateConfiguration(pt)) { + for (int i=0; i < children.count(); i++) { + if (toSymbianConfig(privateConfiguration(children[i]))->mappingName == toSymbianConfig(privateConfiguration(pt))->mappingName) { + return children[i]; + } + } + } else { + // Given IAP Id was not found from known IAPs array + return QNetworkConfiguration(); + } + + // Matching IAP was not found from used SNAP + // => IAP from another SNAP is returned + // (Note: Returned IAP matches to given IAP Id) + return pt; + } +#endif + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (engine) { + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId))); + // Try to found User Selected IAP from known IAPs (accessPointConfigurations) + if (pt.isValid()) { + return pt; + } else { + // Check if new (WLAN) IAP was created in IAP/SNAP dialog + // 1. Sync internal configurations array to commsdb first + engine->updateConfigurations(); + // 2. Check if new configuration was created during connection creation + QList knownConfigs = engine->accessPointConfigurations.keys(); + if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { + // Configuration count increased => new configuration was created + // => Search new, created configuration + QString newIapId; + for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { + if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { + newIapId = knownConfigs[i]; + break; + } + } + if (newIapId.isEmpty()) { + newIapId = knownConfigs[knownConfigs.count()-1]; + } + pt = QNetworkConfigurationManager().configurationFromIdentifier(newIapId); + if (pt.isValid()) + return pt; + } + } + } + return QNetworkConfiguration(); + } + + return publicConfig; +} + +void QNetworkSessionPrivateImpl::RunL() +{ + TInt statusCode = iStatus.Int(); + + switch (statusCode) { + case KErrNone: // Connection created succesfully + { + TInt error = KErrNone; + QNetworkConfiguration newActiveConfig = activeConfiguration(); + if (!newActiveConfig.isValid()) { + error = KErrGeneral; + } else if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + + if (error != KErrNone) { + isOpen = false; + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + return; + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Activate ALR monitoring + iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); + } +#endif + isOpen = true; + activeConfig = newActiveConfig; + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + serviceConfig = QNetworkConfigurationManager().configurationFromIdentifier(toSymbianConfig(privateConfiguration(activeConfig))->serviceNetworkPtr->id); + } + + startTime = QDateTime::currentDateTime(); + + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + } + break; + case KErrNotFound: // Connection failed + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + case KErrCancel: // Connection attempt cancelled + case KErrAlreadyExists: // Connection already exists + default: + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + } +} + +void QNetworkSessionPrivateImpl::DoCancel() +{ + iConnection.Close(); +} + +bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint accessPointId) +{ + // Make sure that activeConfig is always updated when SNAP is signaled to be + // connected. + if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && + newState == QNetworkSession::Connected) { + activeConfig = activeConfiguration(accessPointId); + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + } + + // Make sure that same state is not signaled twice in a row. + if (state == newState) { + return true; + } + + // Make sure that Connecting state does not overwrite Roaming state + if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { + return false; + } + + bool emitSessionClosed = false; + if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + // Active & Connected state should change directly to Disconnected state + // only when something forces connection to close (eg. when another + // application or session stops connection or when network drops + // unexpectedly). + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::SessionAbortedError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + emitSessionClosed = true; // Emit SessionClosed after state change has been reported + } + + bool retVal = false; + if (accessPointId == 0) { + state = newState; + emit stateChanged(state); + retVal = true; + } else { + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == accessPointId) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { + if (toSymbianConfig(privateConfiguration(activeConfig))->numericId == accessPointId) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == accessPointId) { + if (newState == QNetworkSession::Connected) { + // Make sure that when AccessPoint is reported to be Connected + // also state of the related configuration changes to Active. + privateConfiguration(subConfigurations[i])->state = QNetworkConfiguration::Active; + + state = newState; + emit stateChanged(state); + retVal = true; + } else { + if (newState == QNetworkSession::Disconnected) { + // Make sure that when AccessPoint is reported to be disconnected + // also state of the related configuration changes from Active to Defined. + privateConfiguration(subConfigurations[i])->state = QNetworkConfiguration::Defined; + } + QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); + if ((config.state() == QNetworkConfiguration::Defined) || + (config.state() == QNetworkConfiguration::Discovered)) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } + } + } + } + } + + if (emitSessionClosed) { + emit closed(); + } + + return retVal; +} + +void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConnectionStatus, + TInt aError, + TUint accessPointId) +{ + switch (aConnectionStatus) + { + // Connection unitialised + case KConnectionUninitialised: + break; + + // Starting connetion selection + case KStartingSelection: + break; + + // Selection finished + case KFinishedSelection: + if (aError == KErrNone) + { + // The user successfully selected an IAP to be used + break; + } + else + { + // The user pressed e.g. "Cancel" and did not select an IAP + newState(QNetworkSession::Disconnected,accessPointId); + } + break; + + // Connection failure + case KConnectionFailure: + newState(QNetworkSession::NotAvailable); + break; + + // Prepearing connection (e.g. dialing) + case KPsdStartingConfiguration: + case KPsdFinishedConfiguration: + case KCsdFinishedDialling: + case KCsdScanningScript: + case KCsdGettingLoginInfo: + case KCsdGotLoginInfo: + break; + + // Creating connection (e.g. GPRS activation) + case KCsdStartingConnect: + case KCsdFinishedConnect: + newState(QNetworkSession::Connecting,accessPointId); + break; + + // Starting log in + case KCsdStartingLogIn: + break; + + // Finished login + case KCsdFinishedLogIn: + break; + + // Connection open + case KConnectionOpen: + break; + + case KLinkLayerOpen: + newState(QNetworkSession::Connected,accessPointId); + break; + + // Connection blocked or suspended + case KDataTransferTemporarilyBlocked: + break; + + // Hangup or GRPS deactivation + case KConnectionStartingClose: + newState(QNetworkSession::Closing,accessPointId); + break; + + // Connection closed + case KConnectionClosed: + break; + + case KLinkLayerClosed: + newState(QNetworkSession::Disconnected,accessPointId); + break; + + // Unhandled state + default: + break; + } +} + +void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) + { + case EConnMonConnectionStatusChange: + { + CConnMonConnectionStatusChange* realEvent; + realEvent = (CConnMonConnectionStatusChange*) &aEvent; + + TUint connectionId = realEvent->ConnectionId(); + TInt connectionStatus = realEvent->ConnectionStatus(); + + // Try to Find IAP Id using connection Id + TUint apId = 0; + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) { + apId = toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) { + apId = toSymbianConfig(privateConfiguration(publicConfig))->numericId; + } + } + + if (apId > 0) { + handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); + } + } + break; + + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + // Store connection id to related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == apId) { + toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = connectionId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == apId) { + toSymbianConfig(privateConfiguration(publicConfig))->connectionId = connectionId; + } + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + // Remove connection id from related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) { + toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = 0; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) { + toSymbianConfig(privateConfiguration(publicConfig))->connectionId = 0; + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) +{ + CActiveScheduler::Add(this); +} + +ConnectionProgressNotifier::~ConnectionProgressNotifier() +{ + Cancel(); +} + +void ConnectionProgressNotifier::StartNotifications() +{ + if (!IsActive()) { + SetActive(); + } + iConnection.ProgressNotification(iProgress, iStatus); +} + +void ConnectionProgressNotifier::StopNotifications() +{ + Cancel(); +} + +void ConnectionProgressNotifier::DoCancel() +{ + iConnection.CancelProgressNotification(); +} + +void ConnectionProgressNotifier::RunL() +{ + if (iStatus == KErrNone) { + iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); + + SetActive(); + iConnection.ProgressNotification(iProgress, iStatus); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h new file mode 100644 index 0000000..2e75d96 --- /dev/null +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#include +#include +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); + +QT_BEGIN_NAMESPACE + +class ConnectionProgressNotifier; +class SymbianEngine; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MMobilityProtocolResp, + public MConnectionMonitorObserver +#else +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MConnectionMonitorObserver +#endif +{ + Q_OBJECT +public: + QNetworkSessionPrivateImpl(SymbianEngine *engine); + ~QNetworkSessionPrivateImpl(); + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void setALREnabled(bool enabled); + + void open(); + inline void close() { close(true); } + void close(bool allowSignals); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +public: // From MMobilityProtocolResp + void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless); + + void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless); + + void Error(TInt aError); +#endif + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: + TUint iapClientCount(TUint aIAPId) const; + quint64 transferredData(TUint dataType) const; + bool newState(QNetworkSession::State newState, TUint accessPointId = 0); + void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); + QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; + QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; + QNetworkInterface interface(TUint iapId) const; + +private: // data + SymbianEngine *engine; + + mutable QNetworkInterface activeInterface; + + QDateTime startTime; + + RLibrary iOpenCLibrary; + TOpenCSetdefaultifFunction iDynamicSetdefaultif; + + mutable RSocketServ iSocketServ; + mutable RConnection iConnection; + mutable RConnectionMonitor iConnectionMonitor; + ConnectionProgressNotifier* ipConnectionNotifier; +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + CActiveCommsMobilityApiExt* iMobility; +#endif + + QNetworkSession::SessionError iError; + TInt iALREnabled; + TBool iALRUpgradingConnection; + + QList iKnownConfigsBeforeConnectionStart; + + TUint32 iOldRoamingIap; + TUint32 iNewRoamingIap; + + friend class ConnectionProgressNotifier; +}; + +class ConnectionProgressNotifier : public CActive +{ +public: + ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection); + ~ConnectionProgressNotifier(); + + void StartNotifications(); + void StopNotifications(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + QNetworkSessionPrivateImpl &iOwner; + RConnection& iConnection; + TNifProgressBuf iProgress; + +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSION_IMPL_H + diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro index d3ffb37..9fd1a74 100644 --- a/src/plugins/bearer/symbian/symbian.pro +++ b/src/plugins/bearer/symbian/symbian.pro @@ -3,8 +3,12 @@ include(../../qpluginbase.pri) QT += network -HEADERS += symbianengine.h -SOURCES += symbianengine.cpp main.cpp +HEADERS += symbianengine.h \ + qnetworksession_impl.h + +SOURCES += symbianengine.cpp \ + qnetworksession_impl.cpp \ + main.cpp exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 8c31990..f5c5007 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "symbianengine.h" +#include "qnetworksession_impl.h" #include #include @@ -64,7 +65,7 @@ static const int KValueThatWillBeAddedToSNAPId = 1000; static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() -: bearer(BearerUnknown), numericId(0), connectionId(0), manager(0) +: bearer(BearerUnknown), numericId(0), connectionId(0) { } @@ -72,16 +73,33 @@ SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() { } -inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) -{ - return static_cast(ptr.data()); +QString SymbianNetworkConfigurationPrivate::bearerName() const +{ + switch (bearer) { + case BearerEthernet: + return QLatin1String("Ethernet"); + case BearerWLAN: + return QLatin1String("WLAN"); + case Bearer2G: + return QLatin1String("2G"); + case BearerCDMA2000: + return QLatin1String("CDMA2000"); + case BearerWCDMA: + return QLatin1String("WCDMA"); + case BearerHSPA: + return QLatin1String("HSPA"); + case BearerBluetooth: + return QLatin1String("Bluetooth"); + case BearerWiMAX: + return QLatin1String("WiMAX"); + default: + return QString(); + } } SymbianEngine::SymbianEngine(QObject *parent) : QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) { - qDebug() << Q_FUNC_INFO; - CActiveScheduler::Add(this); TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); @@ -112,7 +130,6 @@ SymbianEngine::SymbianEngine(QObject *parent) cpPriv->type = QNetworkConfiguration::UserChoice; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; QNetworkConfigurationPrivatePointer ptr(cpPriv); userChoiceConfigurations.insert(ptr->id, ptr); @@ -139,6 +156,34 @@ SymbianEngine::~SymbianEngine() delete ipCommsDB; } +QString SymbianEngine::getInterfaceFromId(const QString &id) +{ + qFatal("getInterfaceFromId(%s) not implemented\n", qPrintable(id)); + return QString(); +} + +bool SymbianEngine::hasIdentifier(const QString &id) +{ + return accessPointConfigurations.contains(id) || + snapConfigurations.contains(id) || + userChoiceConfigurations.contains(id); +} + +void SymbianEngine::connectToId(const QString &id) +{ + qFatal("connectToId(%s) not implemented\n", qPrintable(id)); +} + +void SymbianEngine::disconnectFromId(const QString &id) +{ + qFatal("disconnectFromId(%s) not implemented\n", qPrintable(id)); +} + +QNetworkSession::State SymbianEngine::sessionStateForId(const QString &id) +{ + qFatal("sessionStateForId(%s) not implemented\n", qPrintable(id)); + return QNetworkSession::Invalid; +} QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const { @@ -157,6 +202,11 @@ QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const return capFlags; } +QNetworkSessionPrivate *SymbianEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl(this); +} + void SymbianEngine::requestUpdate() { if (!iInitOk || iUpdateGoingOn) { @@ -239,7 +289,6 @@ void SymbianEngine::updateConfigurationsL() cpPriv->type = QNetworkConfiguration::ServiceNetwork; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; QNetworkConfigurationPrivatePointer ptr(cpPriv); snapConfigurations.insert(ident, ptr); @@ -428,7 +477,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( cpPriv->type = QNetworkConfiguration::InternetAccessPoint; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; CleanupStack::Pop(cpPriv); return cpPriv; @@ -498,7 +546,6 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; break; } - apNetworkConfiguration->manager = this; CleanupStack::PopAndDestroy(pApUtils); CleanupStack::PopAndDestroy(pAPItem); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 0ca30da..cd5aa43 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -80,18 +80,23 @@ public: SymbianNetworkConfigurationPrivate(); ~SymbianNetworkConfigurationPrivate(); + QString bearerName() const; + Bearer bearer; TUint32 numericId; TUint connectionId; - TAny *manager; - QNetworkConfigurationPrivatePointer serviceNetworkPtr; QString mappingName; }; +inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + class SymbianEngine : public QNetworkSessionEngine, public CActive, public MConnectionMonitorObserver { @@ -101,18 +106,20 @@ public: SymbianEngine(QObject *parent = 0); virtual ~SymbianEngine(); - QString getInterfaceFromId(const QString &id) { return QString(); } - bool hasIdentifier(const QString &id) { return false; } + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); - void connectToId(const QString &id) { } - void disconnectFromId(const QString &id) { } + void connectToId(const QString &id); + void disconnectFromId(const QString &id); void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id) { return QNetworkSession::Invalid; } + QNetworkSession::State sessionStateForId(const QString &id); QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); Q_SIGNALS: diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 061108a..d3923e9 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -82,7 +82,7 @@ private slots: private: QNetworkConfigurationManager manager; - uint inProcessSessionManagementCount; + int inProcessSessionManagementCount; #ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; @@ -249,6 +249,9 @@ void tst_QNetworkSession::sessionProperties() if (!configuration.isValid()) { QVERIFY(configuration.bearerName().isEmpty()); } else { + qDebug() << "Type:" << configuration.type() + << "Bearer:" << configuration.bearerName(); + switch (configuration.type()) { case QNetworkConfiguration::ServiceNetwork: @@ -264,6 +267,8 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. + qDebug() << "Session state:" << session.state(); + qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); if (!configuration.isValid()) { @@ -790,6 +795,8 @@ QDebug operator<<(QDebug debug, const QList &list) void tst_QNetworkSession::outOfProcessSession() { + qDebug() << "START"; + QNetworkConfigurationManager manager; QList before = manager.allConfigurations(QNetworkConfiguration::Active); @@ -805,13 +812,16 @@ void tst_QNetworkSession::outOfProcessSession() QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); + qDebug() << "starting lackey"; QProcess lackey; lackey.start("qnetworksessionlackey"); + qDebug() << lackey.error() << lackey.errorString(); QVERIFY(lackey.waitForStarted()); + qDebug() << "waiting for connection"; QVERIFY(oopServer.waitForNewConnection(-1)); QLocalSocket *oopSocket = oopServer.nextPendingConnection(); - + qDebug() << "got connection"; do { QByteArray output; @@ -875,12 +885,12 @@ void tst_QNetworkSession::outOfProcessSession() break; case 1: QSKIP("No discovered configurations found.", SkipAll); - break; case 2: QSKIP("Lackey could not start session.", SkipAll); default: QSKIP("Lackey failed", SkipAll); } + qDebug("STOP"); } QTEST_MAIN(tst_QNetworkSession) -- cgit v0.12 From 35c7808149558d9798d158605fbd835ea167ca53 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 15:20:33 +1000 Subject: Make compile on Unix. --- src/network/bearer/qnetworksession_p.h | 2 +- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 18 ++++++++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/qnetworksession_impl.cpp | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 6395250..a6bb7cb 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -90,7 +90,7 @@ public: virtual void close() = 0; virtual void stop() = 0; - virtual void setALREnabled(bool enabled) { } + virtual void setALREnabled(bool /*enabled*/) { } virtual void migrate() = 0; virtual void accept() = 0; virtual void ignore() = 0; diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index e1fcd46..9064005 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -41,6 +41,7 @@ #include "qnetworkmanagerengine.h" #include "qnetworkmanagerservice.h" +#include "../qnetworksession_impl.h" #include @@ -238,6 +239,8 @@ void QNetworkManagerEngine::requestUpdate() void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(path) + QMapIterator i(properties); while (i.hasNext()) { i.next(); @@ -302,6 +305,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(properties) + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); if (!activeConnection) @@ -396,6 +401,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, void QNetworkManagerEngine::removeConnection(const QString &path) { + Q_UNUSED(path) + QNetworkManagerSettingsConnection *connection = qobject_cast(sender()); if (!connection) @@ -473,6 +480,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + QNetworkManagerInterfaceAccessPoint *accessPoint = new QNetworkManagerInterfaceAccessPoint(objectPath.path()); accessPoints.append(accessPoint); @@ -524,6 +533,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec void QNetworkManagerEngine::removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + for (int i = 0; i < accessPoints.count(); ++i) { QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); @@ -546,6 +557,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, void QNetworkManagerEngine::updateAccessPoint(const QMap &map) { + Q_UNUSED(map) + QNetworkManagerInterfaceAccessPoint *accessPoint = qobject_cast(sender()); if (!accessPoint) @@ -673,5 +686,10 @@ QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 3752dce..11255fc 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 49a2d72..a826fd6 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -79,7 +79,7 @@ Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); }; -#include "qnetworksession_p.moc" +#include "qnetworksession_impl.moc" Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -- cgit v0.12 From a30021ded7501bb122c8f3c37cc9ced96e00e7d2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 15:20:33 +1000 Subject: Make compile on Unix. --- src/network/bearer/qnetworksession_p.h | 2 +- src/plugins/bearer/networkmanager/networkmanager.pro | 6 ++++-- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 18 ++++++++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/qnetworksession_impl.cpp | 2 +- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 6395250..a6bb7cb 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -90,7 +90,7 @@ public: virtual void close() = 0; virtual void stop() = 0; - virtual void setALREnabled(bool enabled) { } + virtual void setALREnabled(bool /*enabled*/) { } virtual void migrate() = 0; virtual void accept() = 0; virtual void ignore() = 0; diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 57f7ca7..2050125 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -7,12 +7,14 @@ DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ - qnetworkmanagerengine.h + qnetworkmanagerengine.h \ + ../qnetworksession_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ qnetworkmanagerservice.cpp \ - qnetworkmanagerengine.cpp + qnetworkmanagerengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index e1fcd46..9064005 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -41,6 +41,7 @@ #include "qnetworkmanagerengine.h" #include "qnetworkmanagerservice.h" +#include "../qnetworksession_impl.h" #include @@ -238,6 +239,8 @@ void QNetworkManagerEngine::requestUpdate() void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(path) + QMapIterator i(properties); while (i.hasNext()) { i.next(); @@ -302,6 +305,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(properties) + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); if (!activeConnection) @@ -396,6 +401,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, void QNetworkManagerEngine::removeConnection(const QString &path) { + Q_UNUSED(path) + QNetworkManagerSettingsConnection *connection = qobject_cast(sender()); if (!connection) @@ -473,6 +480,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + QNetworkManagerInterfaceAccessPoint *accessPoint = new QNetworkManagerInterfaceAccessPoint(objectPath.path()); accessPoints.append(accessPoint); @@ -524,6 +533,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec void QNetworkManagerEngine::removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + for (int i = 0; i < accessPoints.count(); ++i) { QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); @@ -546,6 +557,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, void QNetworkManagerEngine::updateAccessPoint(const QMap &map) { + Q_UNUSED(map) + QNetworkManagerInterfaceAccessPoint *accessPoint = qobject_cast(sender()); if (!accessPoint) @@ -673,5 +686,10 @@ QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 3752dce..11255fc 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 49a2d72..a826fd6 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -79,7 +79,7 @@ Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); }; -#include "qnetworksession_p.moc" +#include "qnetworksession_impl.moc" Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -- cgit v0.12 From a82fbee158bb117e5746fe097505d0a8035bb7d1 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 16:01:05 +1000 Subject: Make compile on Windows. --- src/plugins/bearer/nativewifi/nativewifi.pro | 8 ++++++-- src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 6 ++++++ src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 ++ src/plugins/bearer/nla/nla.pro | 7 +++++-- src/plugins/bearer/nla/qnlaengine.cpp | 7 +++++++ src/plugins/bearer/nla/qnlaengine.h | 2 ++ 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 583edd4..6e99c62 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -3,8 +3,12 @@ include(../../qpluginbase.pri) QT += network -HEADERS += qnativewifiengine.h platformdefs.h -SOURCES += qnativewifiengine.cpp main.cpp +HEADERS += qnativewifiengine.h \ + platformdefs.h \ + ../qnetworksession_impl.h +SOURCES += main.cpp \ + qnativewifiengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 82ddaf9..1cd419b 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -41,6 +41,7 @@ #include "qnativewifiengine.h" #include "platformdefs.h" +#include "../qnetworksession_impl.h" #include @@ -467,4 +468,9 @@ QNetworkConfigurationManager::Capabilities QNativeWifiEngine::capabilities() con QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNativeWifiEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 9d92562..39b6ea4 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 62a920a..9bd3526 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -10,8 +10,11 @@ QT += network } HEADERS += qnlaengine.h \ - ../platformdefs_win.h -SOURCES += qnlaengine.cpp main.cpp + ../platformdefs_win.h \ + ../qnetworksession_impl.h +SOURCES += main.cpp \ + qnlaengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index d3e3fd2..6c90429 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qnlaengine.h" +#include "../qnetworksession_impl.h" + #include #include @@ -636,6 +638,11 @@ QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QNlaEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 5e80db1..5f0c294 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -95,6 +95,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void networksChanged(); -- cgit v0.12 From ce1f282a5b061e4800735b2a39abfad1ee441e18 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 20 Jan 2010 11:01:04 +1000 Subject: Make compile on Mac OS X. --- src/plugins/bearer/corewlan/corewlan.pro | 8 ++++++-- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 ++ src/plugins/bearer/corewlan/qcorewlanengine.mm | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index ac04e95..1660215 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -11,8 +11,12 @@ contains(QT_CONFIG, corewlan) { } } -HEADERS += qcorewlanengine.h -SOURCES += qcorewlanengine.mm main.cpp +HEADERS += qcorewlanengine.h \ + ../qnetworksession_impl.h + +SOURCES += main.cpp \ + qcorewlanengine.mm \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index dd07d83..8fedf4b 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -73,6 +73,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 7ee0723..404edb4 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcorewlanengine.h" +#include "../qnetworksession_impl.h" #include @@ -517,4 +518,9 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE -- cgit v0.12 From 084c9659719ac310630ac0c1a81d013176f9c350 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 22 Jan 2010 14:22:40 +1000 Subject: Connect up preferredConfigurationChanged() signal. --- src/network/bearer/qnetworksession.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 6b0ccaf..78e38ba 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -240,6 +240,8 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, connect(d, SIGNAL(stateChanged(QNetworkSession::State)), this, SIGNAL(stateChanged(QNetworkSession::State))); connect(d, SIGNAL(closed()), this, SIGNAL(closed())); + connect(d, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + this, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))); connect(d, SIGNAL(newConfigurationActivated()), this, SIGNAL(newConfigurationActivated())); break; -- cgit v0.12 From d3b580fe8b2b0c185f0eadbf794156058496eff3 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 25 Jan 2010 09:53:12 +1000 Subject: Return default configuration from engines. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 34 ++++++-------------------- src/network/bearer/qnetworksessionengine_p.h | 2 ++ src/plugins/bearer/generic/qgenericengine.cpp | 5 ++++ src/plugins/bearer/generic/qgenericengine.h | 2 ++ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c00d6d3..bc3cfbd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -212,42 +212,24 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } /*! - Returns the first active configuration found, if one exists; otherwise returns the first - discovered configuration found, if one exists; otherwise returns an empty configuration. + Returns the default configuration of the first plugin, if one exists; otherwise returns an + invalid configuration. \internal */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - QNetworkConfigurationPrivatePointer firstActive; - QNetworkConfigurationPrivatePointer firstDiscovered; - foreach (QNetworkSessionEngine *engine, sessionEngines) { - QHash::const_iterator i = - engine->accessPointConfigurations.constBegin(); - - while (i != engine->accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivatePointer priv = i.value(); - - if (!firstActive && priv->isValid && - (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) - firstActive = priv; - if (!firstDiscovered && priv->isValid && - (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) - firstDiscovered = priv; + QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); - ++i; + if (ptr) { + QNetworkConfiguration config; + config.d = ptr; + return config; } } - QNetworkConfiguration item; - - if (firstActive) - item.d = firstActive; - else if (firstDiscovered) - item.d = firstDiscovered; - - return item; + return QNetworkConfiguration(); } void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 02772cb..029c2c5 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -99,6 +99,8 @@ public: virtual QNetworkSessionPrivate *createSessionBackend() = 0; + virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index e9770e1..55d1ae4 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -325,5 +325,10 @@ QNetworkSessionPrivate *QGenericEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QGenericEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 04b845e..b44685b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -76,6 +76,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void doRequestUpdate(); -- cgit v0.12 From 1e06b5e995c6df715da8db53c8375d458277144d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 29 Jan 2010 10:30:42 +1000 Subject: Bearer Management Integration 4. --- config.tests/unix/networkmanager/main.cpp | 4 +- .../unix/networkmanager/networkmanager.pro | 3 + examples/network/bearercloud/bearercloud.pro | 2 +- examples/network/bearermonitor/bearermonitor.pro | 2 +- examples/network/bearermonitor/sessionwidget.ui | 426 +++++++++++---------- src/network/bearer/bearer.pro | 9 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 1 - src/network/bearer/qnetworkconfiguration_s60_p.cpp | 2 +- src/network/bearer/qnetworksession.cpp | 7 +- src/network/bearer/qnetworksession_maemo_p.h | 11 +- .../qnetworkconfigmanager.pro | 6 + .../qnetworkconfiguration.pro | 6 + .../tst_qnetworksession/tst_qnetworksession.pro | 6 + 13 files changed, 258 insertions(+), 227 deletions(-) diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp index 6f2bae6..60c6dfc 100644 --- a/config.tests/unix/networkmanager/main.cpp +++ b/config.tests/unix/networkmanager/main.cpp @@ -38,7 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#if defined(QT_NO_DBUS) +sjkp //error is no QtDBus +#endif #include int main(int argc, char** argv) diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro index 554f513..3af4fcb 100644 --- a/config.tests/unix/networkmanager/networkmanager.pro +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -9,3 +9,6 @@ INCLUDEPATH += . # Input SOURCES += main.cpp +!contains(QT_CONFIG,dbus): { + DEFINES += QT_NO_DBUS +} diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 75e3049..856d3f7 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -20,4 +20,4 @@ MOBILITY = bearer CONFIG += console -symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index acbee71..046021a 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -25,4 +25,4 @@ wince*:LIBS += -lWs2 CONFIG += console -symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index f02f306..65ca43b 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -7,240 +7,248 @@ 0 0 340 - 220 + 286 Form - + - + - - - Session ID: - - + + + + + Session ID: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - - - - - - - - - - - 0 - 0 - - - - Session State: - - - - - - - - 0 - 0 - - - - Invalid - - - - - - - - - - - Configuration: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Bearer: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Interface Name: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Interface GUID: - - + + + + + + 0 + 0 + + + + Session State: + + + + + + + + 0 + 0 + + + + Invalid + + + + - - - - 0 - 0 - - - - - - + + + + + Configuration: + + + + + + + + 0 + 0 + + + + + + + + - - - - - - - Last Error: - - + + + + + Bearer: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - + + + + + Interface Name: + + + + + + + + 0 + 0 + + + + + + + + - - - - - - - Error String - - + + + + + Interface GUID: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - - - - - - - - - - Open - - + + + + + Last Error: + + + + + + + + 0 + 0 + + + + + + + + - - - Blocking Open - - + + + + + Error String + + + + + + + + 0 + 0 + + + + + + + + - - - Close - - + + + + + Open + + + + + + + Blocking Open + + + + - - - Stop - - + + + + + Close + + + + + + + Stop + + + + diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro index ce39db6..b8e4d06 100644 --- a/src/network/bearer/bearer.pro +++ b/src/network/bearer/bearer.pro @@ -50,19 +50,11 @@ symbian: { TARGET.CAPABILITY = ALL -TCB TARGET.UID3 = 0x2002AC81 - deploy.path = $${EPOCROOT} - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - for(header, exportheaders.sources) { - BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" - } - QtBearerManagement.sources = QtBearer.dll QtBearerManagement.path = /sys/bin DEPLOYMENT += QtBearerManagement } else { maemo6 { - QT += dbus CONFIG += link_pkgconfig exists(../debug) { @@ -159,4 +151,5 @@ symbian: { } } +CONFIG += middleware include(../../features/deploy.pri) diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp index 795b054..1482fa7 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ b/src/network/bearer/qnetworkconfigmanager_maemo.cpp @@ -44,7 +44,6 @@ #include "qnetworkconfigmanager_maemo_p.h" #include -#include #include #include diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 02115d9..ee50bd5 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -68,7 +68,7 @@ QString QNetworkConfigurationPrivate::bearerName() const case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QLatin1String("Unknown"); + default: return QString(); } } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 6171350..28afcfe 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -141,7 +141,7 @@ QTM_BEGIN_NAMESPACE \value UnknownSessionError An unidentified error occurred. \value SessionAbortedError The session was aborted by the user or system. - \value RoamingError The session cannot roam to the new configuration. + \value RoamingError The session cannot roam to a new configuration. \value OperationNotSupportedError The operation is not supported for current configuration. \value InvalidConfigurationError The operation cannot currently be performed for the current configuration. @@ -328,7 +328,10 @@ void QNetworkSession::close() /*! Invalidates all open sessions against the network interface and therefore stops the underlying network interface. This function always changes the session's state() flag to - \l Disconnected. + \l Disconnected. + + On Symbian platform, a 'NetworkControl' capability is required for + full interface-level stop (without the capability, only the current session is stopped). \sa open(), close() */ diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index 892262d..e3b7ffb 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -52,7 +52,6 @@ // // We mean it. // - #include "qnetworkconfigmanager_maemo_p.h" #include "qnetworksession.h" @@ -60,7 +59,9 @@ #include #include +#ifdef Q_WS_MAEMO_6 #include +#endif QTM_BEGIN_NAMESPACE @@ -69,8 +70,12 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), - connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), +#ifdef Q_WS_MAEMO_6 + connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) +#else + connectFlags(0) +#endif { } diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index bdd4926..4b60a55 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -14,3 +14,9 @@ MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index c5a08b3..3cdb113 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -14,3 +14,9 @@ MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index ccc405e..18b5c23 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -20,3 +20,9 @@ wince* { symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} -- cgit v0.12 From 0a903bf4995ed65367eb17c024af3f16aef57510 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 1 Feb 2010 15:28:32 +1000 Subject: Add defaultConfiguration() function to all bearer management engines. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 ++ src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 +++++ src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 5 +++++ src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 ++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 5 +++++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/nla/qnlaengine.cpp | 5 +++++ src/plugins/bearer/nla/qnlaengine.h | 2 ++ 8 files changed, 28 insertions(+) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 8fedf4b..61d80cf 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -75,6 +75,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 404edb4..2cbccb5 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -523,4 +523,9 @@ QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QCoreWlanEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 1cd419b..af538a8 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -473,4 +473,9 @@ QNetworkSessionPrivate *QNativeWifiEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 39b6ea4..83d9e2c 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -86,6 +86,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 9064005..439772a 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -691,5 +691,10 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 11255fc..5f8110c 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -86,6 +86,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 6c90429..0ed62e3 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -643,6 +643,11 @@ QNetworkSessionPrivate *QNlaEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNlaEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 5f0c294..515a13c 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -97,6 +97,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void networksChanged(); -- cgit v0.12 From 29f24e41b91c05d551c7ac16625a2961744c8339 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 14:52:45 +1000 Subject: Bearer Management Integration 5. --- src/network/bearer/qnetworksession.cpp | 3 ++ tests/auto/qnetworksession/lackey/lackey.pro | 5 +++ tests/auto/qnetworksession/lackey/main.cpp | 19 ++++++--- .../tst_qnetworksession/tst_qnetworksession.cpp | 46 ++++++++++++++++------ .../tst_qnetworksession/tst_qnetworksession.pro | 2 +- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 28afcfe..0ea773a 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -408,6 +408,9 @@ QNetworkConfiguration QNetworkSession::configuration() const This function only returns a valid QNetworkInterface when this session is \l Connected. The returned interface may change as a result of a roaming process. + + Note: this function does not work in Symbian emulator due to the way the + connectivity is emulated on Windows. \sa state() */ diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index b8a006b..96edf99f 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -9,5 +9,10 @@ CONFIG+= testcase include(../../../../common.pri) +symbian { + # Needed for interprocess communication and opening QNetworkSession + TARGET.CAPABILITY = NetworkControl NetworkServices +} + CONFIG += mobility MOBILITY = bearer diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index f3a7a07..cc155f2 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -54,16 +54,23 @@ QTM_USE_NAMESPACE #define NO_DISCOVERED_CONFIGURATIONS_ERROR 1 #define SESSION_OPEN_ERROR 2 + int main(int argc, char** argv) { QCoreApplication app(argc, argv); QNetworkConfigurationManager manager; QList discovered = +#if defined (Q_OS_SYMBIAN) + // On Symbian, on the first query (before updateConfigurations() call + // the discovered-states are not correct, so defined-state will do. + manager.allConfigurations(QNetworkConfiguration::Defined); +#else manager.allConfigurations(QNetworkConfiguration::Discovered); - - if (discovered.isEmpty()) +#endif + if (discovered.isEmpty()) { return NO_DISCOVERED_CONFIGURATIONS_ERROR; + } // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. @@ -85,15 +92,16 @@ int main(int argc, char** argv) qDebug() << "Discovered configurations:" << discovered.count(); if (discovered.isEmpty()) { - qDebug() << "No more configurations"; + qDebug() << "No more discovered configurations"; break; } qDebug() << "Taking first configuration"; QNetworkConfiguration config = discovered.takeFirst(); + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - qDebug() << config.name() << "is active"; + qDebug() << config.name() << " is active, therefore skipping it (looking for configs in 'discovered' state)."; continue; } @@ -104,12 +112,11 @@ int main(int argc, char** argv) QString output = QString("Starting session for %1\n").arg(config.identifier()); oopSocket.write(output.toAscii()); oopSocket.waitForBytesWritten(); - session->open(); session->waitForOpened(); } while (!(session && session->isOpen())); - qDebug() << "loop done"; + qDebug() << "lackey: loop done"; if (!session) { qDebug() << "Could not start session"; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 86b3e46..adb8edd 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -66,6 +66,8 @@ public slots: void cleanupTestCase(); private slots: + + void outOfProcessSession(); void invalidSession(); void sessionProperties_data(); @@ -77,8 +79,6 @@ private slots: void sessionOpenCloseStop_data(); void sessionOpenCloseStop(); - void outOfProcessSession(); - private: QNetworkConfigurationManager manager; @@ -264,7 +264,10 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); +#endif if (!configuration.isValid()) { QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && @@ -311,13 +314,14 @@ void tst_QNetworkSession::userChoiceSession() QNetworkSession session(configuration); + // Check that configuration was really set QVERIFY(session.configuration() == configuration); QVERIFY(!session.isOpen()); + // Check that session is not active QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); - // The remaining tests require the session to be not NotAvailable. if (session.state() == QNetworkSession::NotAvailable) QSKIP("Network is not available.", SkipSingle); @@ -367,7 +371,10 @@ void tst_QNetworkSession::userChoiceSession() QTRY_VERIFY(!stateChangedSpy.isEmpty()); QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif const QString userChoiceIdentifier = session.sessionProperty("UserChoiceConfiguration").toString(); @@ -507,7 +514,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() } QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif } else { QFAIL("Timeout waiting for session to open."); } @@ -540,7 +550,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); } @@ -713,7 +726,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); } @@ -786,17 +802,23 @@ QDebug operator<<(QDebug debug, const QList &list) return debug; } +// Note: outOfProcessSession requires that at least one configuration is +// at Discovered -state (Defined is ok for symbian as well, as long as it is possible to open). void tst_QNetworkSession::outOfProcessSession() { +#if defined(Q_OS_SYMBIAN) && defined(__WINS__) + QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); +#endif QNetworkConfigurationManager manager; - + // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This + // is actually the essence of this testcase - to check that platform mediates/reflects changes + // regardless of process boundaries. The interprocess communication is more like a way to get + // this test-case act correctly and timely. QList before = manager.allConfigurations(QNetworkConfiguration::Active); + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. - QLocalServer oopServer; // First remove possible earlier listening address which would cause listen to fail // (e.g. previously abruptly ended unit test might cause this) @@ -813,19 +835,17 @@ void tst_QNetworkSession::outOfProcessSession() do { QByteArray output; - if(oopSocket->waitForReadyRead()) + if(oopSocket->waitForReadyRead()) { output = oopSocket->readLine().trimmed(); + } if (output.startsWith("Started session ")) { - QString identifier = QString::fromLocal8Bit(output.mid(16).constData()); - + QString identifier = QString::fromLocal8Bit(output.mid(20).constData()); QNetworkConfiguration changed; do { QTRY_VERIFY(!spy.isEmpty()); - changed = qvariant_cast(spy.takeFirst().at(0)); - } while (changed.identifier() != identifier); QVERIFY((changed.state() & QNetworkConfiguration::Active) == @@ -870,10 +890,10 @@ void tst_QNetworkSession::outOfProcessSession() switch (lackey.exitCode()) { case 0: + qDebug("Lackey returned exit success (0)"); break; case 1: QSKIP("No discovered configurations found.", SkipAll); - break; case 2: QSKIP("Lackey could not start session.", SkipAll); default: diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index 18b5c23..f04a8fb 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -18,7 +18,7 @@ wince* { } symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData PowerMgmt } maemo6 { -- cgit v0.12 From 28f95681f4a6fc2e95180f573b658637a82c4c12 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 13:58:47 +1000 Subject: Start adding network session support into QNetworkAccessManager. --- src/network/access/qnetworkaccessbackend.cpp | 30 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessbackend_p.h | 4 ++++ src/network/access/qnetworkaccessmanager.cpp | 30 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 4 ++++ src/network/access/qnetworkaccessmanager_p.h | 5 ++++- src/network/access/qnetworkreplyimpl.cpp | 4 +++- 6 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 8ac64d2..54d9dbd 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -49,6 +49,8 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" +#include "qnetworksession.h" +#include "qhostinfo.h" #include "private/qnoncontiguousbytedevice_p.h" @@ -341,4 +343,32 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) #endif } +void QNetworkAccessBackend::start() +{ + qDebug() << "Checking for localhost"; + QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); + foreach (const QHostAddress &address, hostInfo.addresses()) { + if (address == QHostAddress::LocalHost || + address == QHostAddress::LocalHostIPv6) { + // Don't need session for local host access. + qDebug() << "Access is to localhost"; + open(); + return; + } + } + + qDebug() << "Connecting session signals"; + connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + + qDebug() << "Open session if required"; + if (!manager->session->isOpen()) + manager->session->open(); +} + +void QNetworkAccessBackend::sessionOpened() +{ + qDebug() << "Session opened, calling open()"; + open(); +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 43d993c..04cc5b0 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -111,6 +111,7 @@ public: // socket). virtual void open() = 0; + virtual void start(); virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; @@ -186,6 +187,9 @@ protected slots: void sslErrors(const QList &errors); void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); +private slots: + void sessionOpened(); + private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e16aedc..38ab1c6 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -59,6 +59,8 @@ #include "QtCore/qvector.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" +#include "QtNetwork/qnetworkconfigmanager.h" +#include "QtNetwork/qnetworksession.h" QT_BEGIN_NAMESPACE @@ -346,6 +348,9 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) : QObject(*new QNetworkAccessManagerPrivate, parent) { ensureInitialized(); + + d_func()->session = + new QNetworkSession(QNetworkConfigurationManager().defaultConfiguration(), this); } /*! @@ -665,6 +670,31 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ } /*! + \since 4.7 + + Sets the network configuration that will be used to \a config. + + \sa configuration() +*/ +void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) +{ + delete d_func()->session; + d_func()->session = new QNetworkSession(config, this); +} + +/*! + \since 4.7 + + Returns the network configuration. + + \sa setConfiguration() +*/ +QNetworkConfiguration QNetworkAccessManager::configuration() const +{ + return d_func()->session->configuration(); +} + +/*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index d2fe527..8e1c3b6 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -62,6 +62,7 @@ class QNetworkReply; class QNetworkProxy; class QNetworkProxyFactory; class QSslError; +class QNetworkConfiguration; class QNetworkReplyImplPrivate; class QNetworkAccessManagerPrivate; @@ -103,6 +104,9 @@ public: QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data); QNetworkReply *deleteResource(const QNetworkRequest &request); + void setConfiguration(const QNetworkConfiguration &config); + QNetworkConfiguration configuration() const; + Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 1749373..4eeff4b 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -65,6 +65,7 @@ class QAuthenticator; class QAbstractNetworkCache; class QNetworkAuthenticationCredential; class QNetworkCookieJar; +class QNetworkSession; class QNetworkAccessManagerPrivate: public QObjectPrivate { @@ -74,7 +75,8 @@ public: #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif - cookieJarCreated(false) + cookieJarCreated(false), + session(0) { } ~QNetworkAccessManagerPrivate(); @@ -112,6 +114,7 @@ public: bool cookieJarCreated; + QNetworkSession *session; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 59c7d76..f097a2b 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -82,7 +82,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } - backend->open(); + backend->start(); + + //backend->open(); if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); -- cgit v0.12 From 2149a313e671b22382828b58d2520807a5a061e1 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 19 Jan 2010 10:59:57 +1000 Subject: Progress. --- src/network/access/qnetworkaccessbackend.cpp | 19 +++++++++++++++++++ src/network/access/qnetworkaccessbackend_p.h | 2 ++ src/network/access/qnetworkaccessmanager.cpp | 22 +++++++++++++++++++--- src/network/access/qnetworkaccessmanager.h | 3 +++ src/network/access/qnetworkaccessmanager_p.h | 6 ++++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 54d9dbd..c712fff 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -363,12 +363,31 @@ void QNetworkAccessBackend::start() qDebug() << "Open session if required"; if (!manager->session->isOpen()) manager->session->open(); + else + sessionOpened(); } void QNetworkAccessBackend::sessionOpened() { + manager->sendDebugMessage(QLatin1String("Session opened")); qDebug() << "Session opened, calling open()"; open(); } +void QNetworkAccessBackend::preferredConfigurationChanged(const QNetworkConfiguration &config, + bool isSeamless) +{ + QString message = QString::fromLatin1("preferredConfiguirationChanged %1 %2") + .arg(config.name()) .arg(isSeamless); + + manager->sendDebugMessage(message); + manager->session->ignore(); +} + +void QNetworkAccessBackend::newConfigurationActivated() +{ + manager->sendDebugMessage(QLatin1String("newConfigurationActivated")); + manager->session->reject(); +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 04cc5b0..62ac736 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -189,6 +189,8 @@ protected slots: private slots: void sessionOpened(); + void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void newConfigurationActivated(); private: friend class QNetworkAccessManager; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 38ab1c6..b8edefa 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -349,8 +349,8 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) { ensureInitialized(); - d_func()->session = - new QNetworkSession(QNetworkConfigurationManager().defaultConfiguration(), this); + QNetworkConfigurationManager manager; + d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); } /*! @@ -672,7 +672,7 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ /*! \since 4.7 - Sets the network configuration that will be used to \a config. + Sets the network configuration that will be used when creating a network session to \a config. \sa configuration() */ @@ -695,6 +695,22 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const } /*! + \since 4.7 + + Returns the current active network configuration. + + \sa configuration() +*/ +QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const +{ + QNetworkConfigurationManager manager; + + return manager.configurationFromIdentifier( + d_func()->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + +} + +/*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 8e1c3b6..82bbd03 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -106,6 +106,7 @@ public: void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; + QNetworkConfiguration activeConfiguration() const; Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -117,6 +118,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void debugMessage(const QString &message); + protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 4eeff4b..b6a266c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -101,6 +101,12 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); + void sendDebugMessage(const QString &message) + { + Q_Q(QNetworkAccessManager); + emit q->debugMessage(message); + } + // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; -- cgit v0.12 From df551752b7f430ab44bb1dd2ad0aa8c2a5187ef8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 28 Jan 2010 11:27:49 +1000 Subject: Bearer Management Integration. Perform application level roaming when all pending QNetworkReplys have completed. Emit temporary network failure error when connection to network is lost but is possibly recovering due to roaming. Don't save downloads in cache if they are not complete. --- src/network/access/qnetworkaccessbackend.cpp | 24 ++------- src/network/access/qnetworkaccessbackend_p.h | 4 +- src/network/access/qnetworkaccessmanager.cpp | 79 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 6 +++ src/network/access/qnetworkaccessmanager_p.h | 11 +++- src/network/access/qnetworkreply.cpp | 4 ++ src/network/access/qnetworkreply.h | 1 + src/network/access/qnetworkreplyimpl.cpp | 29 +++++++++- 8 files changed, 134 insertions(+), 24 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index c712fff..22df248 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -49,7 +49,6 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" -#include "qnetworksession.h" #include "qhostinfo.h" #include "private/qnoncontiguousbytedevice_p.h" @@ -345,22 +344,20 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) void QNetworkAccessBackend::start() { - qDebug() << "Checking for localhost"; QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); foreach (const QHostAddress &address, hostInfo.addresses()) { if (address == QHostAddress::LocalHost || address == QHostAddress::LocalHostIPv6) { // Don't need session for local host access. - qDebug() << "Access is to localhost"; open(); return; } } - qDebug() << "Connecting session signals"; connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(sessionError(QNetworkSession::SessionError))); - qDebug() << "Open session if required"; if (!manager->session->isOpen()) manager->session->open(); else @@ -369,25 +366,12 @@ void QNetworkAccessBackend::start() void QNetworkAccessBackend::sessionOpened() { - manager->sendDebugMessage(QLatin1String("Session opened")); - qDebug() << "Session opened, calling open()"; open(); } -void QNetworkAccessBackend::preferredConfigurationChanged(const QNetworkConfiguration &config, - bool isSeamless) +void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) { - QString message = QString::fromLatin1("preferredConfiguirationChanged %1 %2") - .arg(config.name()) .arg(isSeamless); - - manager->sendDebugMessage(message); - manager->session->ignore(); -} - -void QNetworkAccessBackend::newConfigurationActivated() -{ - manager->sendDebugMessage(QLatin1String("newConfigurationActivated")); - manager->session->reject(); + manager->sendDebugMessage(QString::fromLatin1("Session error %1").arg(error)); } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 62ac736..08a8a2a 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -54,6 +54,7 @@ // #include "qnetworkreplyimpl_p.h" +#include "QtNetwork/qnetworksession.h" #include "QtCore/qobject.h" QT_BEGIN_NAMESPACE @@ -189,8 +190,7 @@ protected slots: private slots: void sessionOpened(); - void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); - void newConfigurationActivated(); + void sessionError(QNetworkSession::SessionError error); private: friend class QNetworkAccessManager; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b8edefa..3f8ef01 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -351,6 +351,17 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) QNetworkConfigurationManager manager; d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); + + connect(d_func()->session, SIGNAL(opened()), this, SLOT(_q_sessionOpened())); + connect(d_func()->session, SIGNAL(closed()), this, SLOT(_q_sessionClosed())); + connect(d_func()->session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(_q_sessionStateChanged(QNetworkSession::State))); + connect(d_func()->session, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(_q_sessionError(QNetworkSession::SessionError))); + connect(d_func()->session, SIGNAL(newConfigurationActivated()), + this, SLOT(_q_sessionNewConfigurationActivated())); + connect(d_func()->session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + this, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); } /*! @@ -792,6 +803,20 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); + + if (deferredMigration) { + bool repliesPending = false; + foreach (QObject *child, q->children()) { + if (child != reply && child->inherits("QNetworkReply")) { + repliesPending = true; + break; + } + } + if (!repliesPending) { + emit q->debugMessage(QLatin1String("Migrating as there are no pending replies.")); + session->migrate(); + } + } } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList &errors) @@ -1044,6 +1069,60 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +void QNetworkAccessManagerPrivate::_q_sessionOpened() +{ + Q_Q(QNetworkAccessManager); +} + +void QNetworkAccessManagerPrivate::_q_sessionClosed() +{ + Q_Q(QNetworkAccessManager); + + emit q->debugMessage(QLatin1String("Session Closed")); +} + +void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError error) +{ + Q_Q(QNetworkAccessManager); + + emit q->debugMessage(QString::fromLatin1("Session error %1").arg(error)); +} + +void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) +{ + Q_Q(QNetworkAccessManager); +} + +void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() +{ + Q_Q(QNetworkAccessManager); + + foreach (QObject *child, q->children()) { + QNetworkReply *reply = qobject_cast(child); + if (reply) { + emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1").arg(reply->url().toString())); + } + } + + session->accept(); +} + +void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) +{ + Q_Q(QNetworkAccessManager); + + deferredMigration = false; + foreach (QObject *child, q->children()) { + if (child->inherits("QNetworkReply")) { + deferredMigration = true; + break; + } + } + + if (!deferredMigration) + session->migrate(); +} + QT_END_NAMESPACE #include "moc_qnetworkaccessmanager.cpp" diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 82bbd03..14aaf78 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -129,6 +129,12 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionOpened()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionClosed()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionError(QNetworkSession::SessionError)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionStateChanged(QNetworkSession::State)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionNewConfigurationActivated()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index b6a266c..b9e3964 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,8 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0) + session(0), + deferredMigration(false) { } ~QNetworkAccessManagerPrivate(); @@ -107,6 +108,13 @@ public: emit q->debugMessage(message); } + void _q_sessionOpened(); + void _q_sessionClosed(); + void _q_sessionError(QNetworkSession::SessionError error); + void _q_sessionStateChanged(QNetworkSession::State state); + void _q_sessionNewConfigurationActivated(); + void _q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -121,6 +129,7 @@ public: bool cookieJarCreated; QNetworkSession *session; + bool deferredMigration; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 0a8ea5d..e299b5b 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -125,6 +125,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() encrypted channel could not be established. The sslErrors() signal should have been emitted. + \value TemporaryNetworkFailureError the connection was broken due + to disconnection from the network, however the system has initiated + roaming to another access point. The request should be resubmitted. + \value ProxyConnectionRefusedError the connection to the proxy server was refused (the proxy server is not accepting requests) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 5be4cce..b39557a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -77,6 +77,7 @@ public: TimeoutError, OperationCanceledError, SslHandshakeFailedError, + TemporaryNetworkFailureError, UnknownNetworkError = 99, // proxy errors (101-199): diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index f097a2b..7eca323 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -47,6 +47,7 @@ #include "QtCore/qdatetime.h" #include "QtNetwork/qsslconfiguration.h" #include "qnetworkaccesshttpbackend_p.h" +#include "qnetworkaccessmanager_p.h" #include @@ -516,7 +517,33 @@ void QNetworkReplyImplPrivate::finished() emit q->uploadProgress(0, 0); resumeNotificationHandling(); - completeCacheSave(); + if (manager->d_func()->session->state() == QNetworkSession::Roaming) { + // only content with a known size will fail with a temporary network failure error + if (!totalSize.isNull()) { + qDebug() << "Connection broke during download."; + qDebug() << "Don't worry, we've already started roaming :)"; + + if (bytesDownloaded == totalSize) { + qDebug() << "Luckily download has already finished."; + } else { + qDebug() << "Download hasn't finished"; + + if (q->bytesAvailable() == bytesDownloaded) { + qDebug() << "User hasn't read data from reply, we could continue after reconnect."; + error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + } else if (q->bytesAvailable() < bytesDownloaded) { + qDebug() << "User has already read data from reply."; + error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + } + } + } + } + + // if we don't know the total size of or we received everything save the cache + if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) + completeCacheSave(); + else + qDebug() << "Not saving cache."; // note: might not be a good idea, since users could decide to delete us // which would delete the backend too... -- cgit v0.12 From 75a0b3e5526b0a6cf01deb60f0dc37b61928206a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 28 Jan 2010 13:15:50 +1000 Subject: Wait until session is in the connected state before starting transfer. --- src/network/access/qnetworkaccessbackend.cpp | 19 +++++++++++++------ src/network/access/qnetworkaccessbackend_p.h | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 22df248..d9bce9d 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -354,19 +354,26 @@ void QNetworkAccessBackend::start() } } - connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + connect(manager->session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(sessionStateChanged(QNetworkSession::State))); connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(sessionError(QNetworkSession::SessionError))); - if (!manager->session->isOpen()) + switch (manager->session->state()) { + case QNetworkSession::Roaming: + break; + case QNetworkSession::Connected: + open(); + break; + default: manager->session->open(); - else - sessionOpened(); + } } -void QNetworkAccessBackend::sessionOpened() +void QNetworkAccessBackend::sessionStateChanged(QNetworkSession::State state) { - open(); + if (state == QNetworkSession::Connected) + open(); } void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 08a8a2a..7b7821e 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -189,7 +189,7 @@ protected slots: void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); private slots: - void sessionOpened(); + void sessionStateChanged(QNetworkSession::State state); void sessionError(QNetworkSession::SessionError error); private: -- cgit v0.12 From 72f9a360c5f378092884654257266b4569932336 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 1 Feb 2010 13:25:03 +1000 Subject: Progress. --- src/network/access/qnetworkaccessbackend.cpp | 43 +++++++---------- src/network/access/qnetworkaccessbackend_p.h | 6 +-- src/network/access/qnetworkaccessmanager.cpp | 71 ++++++++++++++++++++++++---- src/network/access/qnetworkreplyimpl.cpp | 40 +++++++++++----- src/network/access/qnetworkreplyimpl_p.h | 3 +- 5 files changed, 109 insertions(+), 54 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index d9bce9d..f35cb59 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -342,7 +342,12 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) #endif } -void QNetworkAccessBackend::start() +/*! + Starts the backend. Returns true if the backend is started. Returns false if the backend + could not be started due to an unopened or roaming session. The caller should recall this + function once the session has been opened or the roaming process has finished. +*/ +bool QNetworkAccessBackend::start() { QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); foreach (const QHostAddress &address, hostInfo.addresses()) { @@ -350,35 +355,23 @@ void QNetworkAccessBackend::start() address == QHostAddress::LocalHostIPv6) { // Don't need session for local host access. open(); - return; + return true; } } - connect(manager->session, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(sessionStateChanged(QNetworkSession::State))); - connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(sessionError(QNetworkSession::SessionError))); - - switch (manager->session->state()) { - case QNetworkSession::Roaming: - break; - case QNetworkSession::Connected: - open(); - break; - default: - manager->session->open(); + if (manager->session->isOpen()) { + if (manager->session->state() == QNetworkSession::Connected) { + qDebug() << "Session is open and state is connected"; + open(); + return true; + } else { + qDebug() << "we are roaming, connecting, etc. delay until roaming completes"; + } + } else { + qDebug() << "session not open"; } -} -void QNetworkAccessBackend::sessionStateChanged(QNetworkSession::State state) -{ - if (state == QNetworkSession::Connected) - open(); -} - -void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) -{ - manager->sendDebugMessage(QString::fromLatin1("Session error %1").arg(error)); + return false; } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 7b7821e..b8b369f 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -112,7 +112,7 @@ public: // socket). virtual void open() = 0; - virtual void start(); + virtual bool start(); virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; @@ -188,10 +188,6 @@ protected slots: void sslErrors(const QList &errors); void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); -private slots: - void sessionStateChanged(QNetworkSession::State state); - void sessionError(QNetworkSession::SessionError error); - private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 3f8ef01..a7a81f8 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -807,13 +807,24 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() if (deferredMigration) { bool repliesPending = false; foreach (QObject *child, q->children()) { - if (child != reply && child->inherits("QNetworkReply")) { - repliesPending = true; - break; + if (child != reply && child->inherits("QNetworkReplyImpl")) { + QNetworkReplyImpl *replyImpl = qobject_cast(child); + qDebug() << "reply state is" << replyImpl->d_func()->state; + switch (replyImpl->d_func()->state) { + case QNetworkReplyImplPrivate::Idle: + case QNetworkReplyImplPrivate::Finished: + case QNetworkReplyImplPrivate::Aborted: + break; + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + repliesPending = true; + break; + } } } if (!repliesPending) { - emit q->debugMessage(QLatin1String("Migrating as there are no pending replies.")); + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; session->migrate(); } } @@ -1072,6 +1083,15 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); + + qDebug() << "Session Opened"; + + // start waiting children + foreach (QObject *child, q->children()) { + QNetworkReplyImpl *reply = qobject_cast(child); + if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + } } void QNetworkAccessManagerPrivate::_q_sessionClosed() @@ -1091,6 +1111,8 @@ void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) { Q_Q(QNetworkAccessManager); + + qDebug() << "session state changed to" << state; } void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() @@ -1098,13 +1120,30 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() Q_Q(QNetworkAccessManager); foreach (QObject *child, q->children()) { - QNetworkReply *reply = qobject_cast(child); + QNetworkReplyImpl *reply = qobject_cast(child); if (reply) { - emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1").arg(reply->url().toString())); + switch (reply->d_func()->state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1") + .arg(reply->url().toString())); + break; + default: + qDebug() << "Testing new interface for" << reply->url(); + ; + } } } + qDebug() << "Accepting new configuration."; session->accept(); + + // start waiting children + foreach (QObject *child, q->children()) { + QNetworkReplyImpl *reply = qobject_cast(child); + if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + } } void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) @@ -1113,14 +1152,26 @@ void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const deferredMigration = false; foreach (QObject *child, q->children()) { - if (child->inherits("QNetworkReply")) { - deferredMigration = true; - break; + if (child->inherits("QNetworkReplyImpl")) { + QNetworkReplyImpl *replyImpl = qobject_cast(child); + qDebug() << "reply state is" << replyImpl->d_func()->state; + switch (replyImpl->d_func()->state) { + case QNetworkReplyImplPrivate::Idle: + case QNetworkReplyImplPrivate::Finished: + case QNetworkReplyImplPrivate::Aborted: + break; + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + deferredMigration = true; + break; + } } } - if (!deferredMigration) + if (!deferredMigration) { + qDebug() << "Migrating as there are no pending replies."; session->migrate(); + } } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7eca323..5d52913 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -83,7 +83,18 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } - backend->start(); + if (!backend->start()) { + // backend failed to start because the session state is not Connected. + // QNetworkAccessManager will call reply->backend->start() again for us when the session + // state changes. + qDebug() << "Waiting for session for" << url; + state = WaitingForSession; + + if (!manager->d_func()->session->isOpen()) + manager->d_func()->session->open(); + + return; + } //backend->open(); if (state != Finished) { @@ -504,20 +515,10 @@ void QNetworkReplyImplPrivate::finished() if (state == Finished || state == Aborted) return; - state = Finished; - pendingNotifications.clear(); - pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (totalSize.isNull() || totalSize == -1) { - emit q->downloadProgress(bytesDownloaded, bytesDownloaded); - } - - if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) - emit q->uploadProgress(0, 0); - resumeNotificationHandling(); - - if (manager->d_func()->session->state() == QNetworkSession::Roaming) { + if (state == Working && errorCode != QNetworkReply::OperationCanceledError && + manager->d_func()->session->state() == QNetworkSession::Roaming) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { qDebug() << "Connection broke during download."; @@ -538,6 +539,19 @@ void QNetworkReplyImplPrivate::finished() } } } + resumeNotificationHandling(); + + state = Finished; + pendingNotifications.clear(); + + pauseNotificationHandling(); + if (totalSize.isNull() || totalSize == -1) { + emit q->downloadProgress(bytesDownloaded, bytesDownloaded); + } + + if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) + emit q->uploadProgress(0, 0); + resumeNotificationHandling(); // if we don't know the total size of or we received everything save the cache if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 168e5cf..861b2b2 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -114,7 +114,8 @@ public: Buffering, Working, Finished, - Aborted + Aborted, + WaitingForSession }; typedef QQueue NotificationQueue; -- cgit v0.12 From 280a68446c1f96ae9d19134e4201bc78ee0b072a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 2 Feb 2010 14:04:15 +1000 Subject: Ensure that default network interface is set appropriately. Default network interface was not always being set when the active network configuration changed. --- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 24948cf..619fd9f 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -818,6 +818,16 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint newState == QNetworkSession::Connected) { activeConfig = activeConfiguration(accessPointId); activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = activeConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + iDynamicSetdefaultif(&ifr); + } +#endif } // Make sure that same state is not signaled twice in a row. -- cgit v0.12 From 130a461c07ed35d1aeb27c8110efca773773c614 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 10:59:12 +1000 Subject: Don't try to resolve names to determine if dest is localhost. --- src/network/access/qnetworkaccessbackend.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index f35cb59..2eebcf9 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,14 +349,14 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { - QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); - foreach (const QHostAddress &address, hostInfo.addresses()) { - if (address == QHostAddress::LocalHost || - address == QHostAddress::LocalHostIPv6) { - // Don't need session for local host access. - open(); - return true; - } + // This is not ideal. + const QString host = reply->url.host(); + if (host == QLatin1String("localhost") || + QHostAddress(host) == QHostAddress::LocalHost || + QHostAddress(host) == QHostAddress::LocalHostIPv6) { + // Don't need an open session for localhost access. + open(); + return true; } if (manager->session->isOpen()) { -- cgit v0.12 From 8f5c1dd293b046e7f51d12b767464345c253943f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 11:02:23 +1000 Subject: Don't build generic bearer engine on Symbian. --- src/plugins/bearer/bearer.pro | 7 +++---- src/s60installs/s60installs.pro | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index ab0a816..7347735 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,10 +1,9 @@ TEMPLATE = subdirs -!maemo { -SUBDIRS += generic -contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager +!maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan symbian:SUBDIRS += symbian -} + +isEmpty(SUBDIRS):SUBDIRS += generic diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index b763786..d0bd59e 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -121,7 +121,7 @@ symbian: { } bearer_plugins.path = c:$$QT_PLUGINS_BASE_DIR/bearer - bearer_plugins.sources += qgenericbearer.dll qsymbianbearer.dll + bearer_plugins.sources += qsymbianbearer.dll BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" -- cgit v0.12 From 038e81412918dafaf50eaf7f9d6757e2677e4bb6 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 11:58:27 +1000 Subject: Remove debug. --- src/network/access/qnetworkaccessbackend.cpp | 13 +++---------- src/network/access/qnetworkaccessmanager.cpp | 2 -- src/network/access/qnetworkreplyimpl.cpp | 3 --- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 2eebcf9..bab6d14 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -359,16 +359,9 @@ bool QNetworkAccessBackend::start() return true; } - if (manager->session->isOpen()) { - if (manager->session->state() == QNetworkSession::Connected) { - qDebug() << "Session is open and state is connected"; - open(); - return true; - } else { - qDebug() << "we are roaming, connecting, etc. delay until roaming completes"; - } - } else { - qDebug() << "session not open"; + if (manager->session->isOpen() && manager->session->state() == QNetworkSession::Connected) { + open(); + return true; } return false; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index a7a81f8..dbcdddf 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1084,8 +1084,6 @@ void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); - qDebug() << "Session Opened"; - // start waiting children foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 5d52913..fbe90ef 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -87,7 +87,6 @@ void QNetworkReplyImplPrivate::_q_startOperation() // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. - qDebug() << "Waiting for session for" << url; state = WaitingForSession; if (!manager->d_func()->session->isOpen()) @@ -556,8 +555,6 @@ void QNetworkReplyImplPrivate::finished() // if we don't know the total size of or we received everything save the cache if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) completeCacheSave(); - else - qDebug() << "Not saving cache."; // note: might not be a good idea, since users could decide to delete us // which would delete the backend too... -- cgit v0.12 From 92eac408783fd4b1e2db2759c3212b580ff24205 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 15:48:32 +1000 Subject: Fix compile warnings. --- src/network/access/qnetworkaccessmanager.cpp | 63 +++++++++++----------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index dbcdddf..4e28641 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -805,28 +805,24 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() emit q->finished(reply); if (deferredMigration) { - bool repliesPending = false; foreach (QObject *child, q->children()) { - if (child != reply && child->inherits("QNetworkReplyImpl")) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - qDebug() << "reply state is" << replyImpl->d_func()->state; - switch (replyImpl->d_func()->state) { - case QNetworkReplyImplPrivate::Idle: - case QNetworkReplyImplPrivate::Finished: - case QNetworkReplyImplPrivate::Aborted: - break; - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - repliesPending = true; - break; - } + if (child == reply) + continue; + + QNetworkReplyImpl *replyImpl = qobject_cast(child); + if (!replyImpl) + continue; + + QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; + if (state == QNetworkReplyImplPrivate::Buffering || + state == QNetworkReplyImplPrivate::Working) { + return; } } - if (!repliesPending) { - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } + + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; + session->migrate(); } } @@ -1108,8 +1104,6 @@ void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) { - Q_Q(QNetworkAccessManager); - qDebug() << "session state changed to" << state; } @@ -1144,32 +1138,25 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() } } -void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) +void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); - deferredMigration = false; foreach (QObject *child, q->children()) { - if (child->inherits("QNetworkReplyImpl")) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - qDebug() << "reply state is" << replyImpl->d_func()->state; - switch (replyImpl->d_func()->state) { - case QNetworkReplyImplPrivate::Idle: - case QNetworkReplyImplPrivate::Finished: - case QNetworkReplyImplPrivate::Aborted: - break; - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: + QNetworkReplyImpl *replyImpl = qobject_cast(child); + if (replyImpl) { + QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; + if (state == QNetworkReplyImplPrivate::Buffering || + state == QNetworkReplyImplPrivate::Working) { deferredMigration = true; - break; + return; } } } - if (!deferredMigration) { - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; + session->migrate(); } QT_END_NAMESPACE -- cgit v0.12 From 68d510148615b5fb4d3b6ce5faa516c110c53d58 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 09:16:19 +1000 Subject: Only create session when valid configuration is available. Only create a network session when a valid configuration is available. Don't execute session code if a network session has not been created. --- src/network/access/qnetworkaccessbackend.cpp | 5 +++ src/network/access/qnetworkaccessmanager.cpp | 63 +++++++++++++++++++--------- src/network/access/qnetworkaccessmanager_p.h | 2 + src/network/access/qnetworkreplyimpl.cpp | 16 ++++--- 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index bab6d14..0bfeb3b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,6 +349,11 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { + if (!manager->session) { + open(); + return true; + } + // This is not ideal. const QString host = reply->url.host(); if (host == QLatin1String("localhost") || diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 4e28641..e17beb9 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -350,18 +350,7 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) ensureInitialized(); QNetworkConfigurationManager manager; - d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); - - connect(d_func()->session, SIGNAL(opened()), this, SLOT(_q_sessionOpened())); - connect(d_func()->session, SIGNAL(closed()), this, SLOT(_q_sessionClosed())); - connect(d_func()->session, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(_q_sessionStateChanged(QNetworkSession::State))); - connect(d_func()->session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(_q_sessionError(QNetworkSession::SessionError))); - connect(d_func()->session, SIGNAL(newConfigurationActivated()), - this, SLOT(_q_sessionNewConfigurationActivated())); - connect(d_func()->session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), - this, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); + d_func()->createSession(manager.defaultConfiguration()); } /*! @@ -689,8 +678,7 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ */ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) { - delete d_func()->session; - d_func()->session = new QNetworkSession(config, this); + d_func()->createSession(config); } /*! @@ -702,7 +690,12 @@ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config */ QNetworkConfiguration QNetworkAccessManager::configuration() const { - return d_func()->session->configuration(); + Q_D(const QNetworkAccessManager); + + if (d->session) + return d->session->configuration(); + else + return QNetworkConfiguration(); } /*! @@ -714,11 +707,16 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const */ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const { - QNetworkConfigurationManager manager; + Q_D(const QNetworkAccessManager); - return manager.configurationFromIdentifier( - d_func()->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + if (d->session) { + QNetworkConfigurationManager manager; + return manager.configurationFromIdentifier( + d->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + } else { + return QNetworkConfiguration(); + } } /*! @@ -800,11 +798,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera void QNetworkAccessManagerPrivate::_q_replyFinished() { Q_Q(QNetworkAccessManager); + QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); - if (deferredMigration) { + if (session && deferredMigration) { foreach (QObject *child, q->children()) { if (child == reply) continue; @@ -1076,6 +1075,32 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) +{ + Q_Q(QNetworkAccessManager); + + if (session) + delete session; + + if (!config.isValid()) { + session = 0; + return; + } + + session = new QNetworkSession(config, q); + + QObject::connect(session, SIGNAL(opened()), q, SLOT(_q_sessionOpened())); + QObject::connect(session, SIGNAL(closed()), q, SLOT(_q_sessionClosed())); + QObject::connect(session, SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_sessionStateChanged(QNetworkSession::State))); + QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), + q, SLOT(_q_sessionError(QNetworkSession::SessionError))); + QObject::connect(session, SIGNAL(newConfigurationActivated()), + q, SLOT(_q_sessionNewConfigurationActivated())); + QObject::connect(session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + q, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); +} + void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index b9e3964..92b2782 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -108,6 +108,8 @@ public: emit q->debugMessage(message); } + void createSession(const QNetworkConfiguration &config); + void _q_sessionOpened(); void _q_sessionClosed(); void _q_sessionError(QNetworkSession::SessionError error); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index fbe90ef..72c378a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -89,13 +89,18 @@ void QNetworkReplyImplPrivate::_q_startOperation() // state changes. state = WaitingForSession; - if (!manager->d_func()->session->isOpen()) - manager->d_func()->session->open(); + QNetworkSession *session = manager->d_func()->session; + + if (session) { + if (!session->isOpen()) + session->open(); + } else { + qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); + } return; } - //backend->open(); if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); @@ -516,8 +521,9 @@ void QNetworkReplyImplPrivate::finished() pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (state == Working && errorCode != QNetworkReply::OperationCanceledError && - manager->d_func()->session->state() == QNetworkSession::Roaming) { + QNetworkSession *session = manager->d_func()->session; + if (session && session->state() == QNetworkSession::Roaming && + state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { qDebug() << "Connection broke during download."; -- cgit v0.12 From dc5350f9325eb0daef6550e7a6ff14a82d030d63 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 16:55:05 +1000 Subject: Migrate in progress http downloads. --- src/network/access/qnetworkaccessbackend_p.h | 1 + src/network/access/qnetworkaccessmanager.cpp | 18 ++++++- src/network/access/qnetworkreplyimpl.cpp | 70 +++++++++++++++++++++++++++- src/network/access/qnetworkreplyimpl_p.h | 6 ++- 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index b8b369f..830ec7e 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -192,6 +192,7 @@ private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; friend class QNetworkAccessBackendUploadIODevice; + friend class QNetworkReplyImplPrivate; QNetworkAccessManagerPrivate *manager; QNetworkReplyImplPrivate *reply; }; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e17beb9..617e398 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1155,11 +1155,25 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() qDebug() << "Accepting new configuration."; session->accept(); - // start waiting children foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); - if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + if (!reply) + continue; + + switch (reply->d_func()->state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + case QNetworkReplyImplPrivate::Reconnecting: + // Migrate existing downloads to new configuration. + reply->d_func()->migrateBackend(); + break; + case QNetworkReplyImplPrivate::WaitingForSession: + // Start waiting requests. QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + break; + default: + qDebug() << "How do we handle replies in state" << reply->d_func()->state; + } } } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 72c378a..932d81a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -58,7 +58,7 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() copyDevice(0), cacheEnabled(false), cacheSaveDevice(0), notificationHandlingPaused(false), - bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), + bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), preMigrationDownloaded(-1), httpStatusCode(0), state(Idle) { @@ -152,6 +152,8 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() lastBytesDownloaded = bytesDownloaded; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); @@ -475,6 +477,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); @@ -521,6 +525,8 @@ void QNetworkReplyImplPrivate::finished() pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; QNetworkSession *session = manager->d_func()->session; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { @@ -768,6 +774,68 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +void QNetworkReplyImplPrivate::migrateBackend() +{ + Q_Q(QNetworkReplyImpl); + + if (state == QNetworkReplyImplPrivate::Finished || + state == QNetworkReplyImplPrivate::Aborted) { + qDebug() << "Network reply is already finished/aborted."; + return; + } + + if (!qobject_cast(backend)) { + qDebug() << "Resume only support by http backend, not migrating."; + return; + } + + if (outgoingData) { + qDebug() << "Request has outgoing data, not migrating."; + return; + } + + qDebug() << "Need to check for only cacheable content."; + + // stop both upload and download + if (outgoingData) + outgoingData->disconnect(q); + if (copyDevice) + copyDevice->disconnect(q); + + state = QNetworkReplyImplPrivate::Reconnecting; + + if (backend) { + backend->deleteLater(); + backend = 0; + } + + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); + if (it == rawHeaders.constEnd() || it->second == "none") { + qDebug() << "Range header not supported by server/resource."; + qFatal("Should fail with TemporaryNetworkFailure."); + } + + cookedHeaders.clear(); + rawHeaders.clear(); + + preMigrationDownloaded = bytesDownloaded; + + request.setRawHeader("Range", "bytes=" + QByteArray::number(preMigrationDownloaded) + '-'); + + backend = manager->d_func()->findBackend(operation, request); + + if (backend) { + backend->setParent(q); + backend->reply = this; + } + + if (qobject_cast(backend)) { + _q_startOperation(); + } else { + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } +} + QT_END_NAMESPACE #include "moc_qnetworkreplyimpl_p.cpp" diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 861b2b2..9de16e6 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -115,7 +115,8 @@ public: Working, Finished, Aborted, - WaitingForSession + WaitingForSession, + Reconnecting }; typedef QQueue NotificationQueue; @@ -162,6 +163,8 @@ public: QIODevice *copyDevice; QAbstractNetworkCache *networkCache() const; + void migrateBackend(); + bool cacheEnabled; QIODevice *cacheSaveDevice; @@ -178,6 +181,7 @@ public: qint64 bytesDownloaded; qint64 lastBytesDownloaded; qint64 bytesUploaded; + qint64 preMigrationDownloaded; QString httpReasonPhrase; int httpStatusCode; -- cgit v0.12 From df4b88078124fe993795bd436f3093b0120ffce2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 16:57:47 +1000 Subject: Add hooks for testing. --- src/network/access/qnetworkreply.h | 2 ++ src/network/access/qnetworkreplyimpl.cpp | 7 +++++++ src/network/access/qnetworkreplyimpl_p.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index b39557a..0f1fe8a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -138,6 +138,8 @@ public: void ignoreSslErrors(const QList &errors); #endif + virtual void migrateBackend() { qWarning("Your backend doesn't support migration!"); } // Testing + public Q_SLOTS: virtual void ignoreSslErrors(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 932d81a..0c7aca8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -774,6 +774,13 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +void QNetworkReplyImpl::migrateBackend() +{ + Q_D(QNetworkReplyImpl); + + d->migrateBackend(); +} + void QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 9de16e6..ac82ca0 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -92,6 +92,8 @@ public: Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList &errors); #endif + void migrateBackend(); + Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) -- cgit v0.12 From a307e9662c2b57ad16c2329754ea4795615de125 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 10:51:25 +1000 Subject: Remove implementation specific functions out of QNetworkSessionEngine. --- src/network/bearer/qnetworksessionengine_p.h | 19 +----- src/plugins/bearer/corewlan/corewlan.pro | 3 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 6 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 4 +- src/plugins/bearer/generic/generic.pro | 1 + src/plugins/bearer/generic/qgenericengine.cpp | 14 +--- src/plugins/bearer/generic/qgenericengine.h | 6 +- src/plugins/bearer/nativewifi/nativewifi.pro | 4 +- .../bearer/nativewifi/qnativewifiengine.cpp | 4 +- src/plugins/bearer/nativewifi/qnativewifiengine.h | 6 +- .../bearer/networkmanager/networkmanager.pro | 3 +- .../networkmanager/qnetworkmanagerengine.cpp | 4 +- .../bearer/networkmanager/qnetworkmanagerengine.h | 6 +- src/plugins/bearer/nla/nla.pro | 4 +- src/plugins/bearer/nla/qnlaengine.cpp | 4 +- src/plugins/bearer/nla/qnlaengine.h | 7 +- src/plugins/bearer/qnetworksession_impl.cpp | 34 ++++------ src/plugins/bearer/qnetworksession_impl.h | 11 ++-- src/plugins/bearer/qnetworksessionengine_impl.h | 77 ++++++++++++++++++++++ src/plugins/bearer/symbian/symbianengine.cpp | 24 +------ src/plugins/bearer/symbian/symbianengine.h | 8 +-- 21 files changed, 137 insertions(+), 112 deletions(-) create mode 100644 src/plugins/bearer/qnetworksessionengine_impl.h diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 029c2c5..39c3d17 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -73,28 +73,13 @@ class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject Q_OBJECT public: - enum ConnectionError { - InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, - }; - QNetworkSessionEngine(QObject *parent = 0); virtual ~QNetworkSessionEngine(); - virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; - //virtual QString bearerName(const QString &id) = 0; - - virtual void connectToId(const QString &id) = 0; - virtual void disconnectFromId(const QString &id) = 0; - virtual void requestUpdate() = 0; - virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; - virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; virtual QNetworkSessionPrivate *createSessionBackend() = 0; @@ -115,8 +100,6 @@ Q_SIGNALS: void configurationChanged(QNetworkConfigurationPrivatePointer config); void updateCompleted(); - - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; typedef QNetworkSessionEngine QBearerEngine; diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 1660215..c59d602 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -12,7 +12,8 @@ contains(QT_CONFIG, corewlan) { } HEADERS += qcorewlanengine.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h SOURCES += main.cpp \ qcorewlanengine.mm \ diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 61d80cf..7199ace 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QCOREWLANENGINE_H #define QCOREWLANENGINE_H -#include +#include "../qnetworksessionengine_impl.h" #include #include @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class QCoreWlanEngine : public QNetworkSessionEngine +class QCoreWlanEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 2cbccb5..ca193ab 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -106,7 +106,7 @@ static QString qGetInterfaceType(const QString &interfaceString) } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) -: QNetworkSessionEngine(parent) +: QNetworkSessionEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index d039731..dbf96d1 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -5,6 +5,7 @@ QT += network HEADERS += qgenericengine.h \ ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp \ ../qnetworksession_impl.cpp \ diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 55d1ae4..dea820d 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) } QGenericEngine::QGenericEngine(QObject *parent) -: QNetworkSessionEngine(parent) +: QNetworkSessionEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); @@ -162,16 +162,6 @@ bool QGenericEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id); } -/*QString QGenericEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QLatin1String("Unknown"); - - return qGetInterfaceType(interface); -}*/ - void QGenericEngine::connectToId(const QString &id) { emit connectionError(id, OperationNotSupported); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index b44685b..d755228 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QGENERICENGINE_H #define QGENERICENGINE_H -#include +#include "../qnetworksessionengine_impl.h" #include #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNetworkSessionPrivate; -class QGenericEngine : public QNetworkSessionEngine +class QGenericEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 6e99c62..928d819 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -5,7 +5,9 @@ QT += network HEADERS += qnativewifiengine.h \ platformdefs.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h + SOURCES += main.cpp \ qnativewifiengine.cpp \ ../qnetworksession_impl.cpp diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index af538a8..9f0d4c0 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -77,7 +77,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) } QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent), handle(0) +: QNetworkSessionEngineImpl(parent), handle(0) { DWORD clientVersion; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 83d9e2c..41217e2 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,7 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; struct WLAN_NOTIFICATION_DATA; -class QNativeWifiEngine : public QNetworkSessionEngine +class QNativeWifiEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 2050125..6f271c6 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -8,7 +8,8 @@ DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 439772a..129f7d2 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) -: QNetworkSessionEngine(parent), +: QNetworkSessionEngineImpl(parent), interface(new QNetworkManagerInterface(this)), systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 5f8110c..f454628 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,7 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" #include "qnetworkmanagerservice.h" @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkManagerEngine : public QNetworkSessionEngine +class QNetworkManagerEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 9bd3526..4c5e492 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -11,7 +11,9 @@ QT += network HEADERS += qnlaengine.h \ ../platformdefs_win.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h + SOURCES += main.cpp \ qnlaengine.cpp \ ../qnetworksession_impl.cpp diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 0ed62e3..ed802c0 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -506,7 +506,7 @@ void QNlaThread::fetchConfigurations() } QNlaEngine::QNlaEngine(QObject *parent) -: QNetworkSessionEngine(parent), nlaThread(0) +: QNetworkSessionEngineImpl(parent), nlaThread(0) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 515a13c..fa010b9 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,8 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" + #include #include @@ -71,7 +72,7 @@ public: int version; }; -class QNlaEngine : public QNetworkSessionEngine +class QNlaEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index a826fd6..6de3423 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,9 +40,9 @@ ****************************************************************************/ #include "qnetworksession_impl.h" +#include "qnetworksessionengine_impl.h" #include -#include #include #include @@ -53,13 +53,14 @@ QT_BEGIN_NAMESPACE -static QNetworkSessionEngine *getEngineFromId(const QString &id) +static QNetworkSessionEngineImpl *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - if (engine->hasIdentifier(id)) - return engine; + QNetworkSessionEngineImpl *engineImpl = qobject_cast(engine); + if (engineImpl && engineImpl->hasIdentifier(id)) + return engineImpl; } return 0; @@ -110,8 +111,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType - ("QNetworkSessionEngine::ConnectionError"); + qRegisterMetaType + ("QNetworkSessionEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: @@ -239,14 +240,6 @@ void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, cons { } -/*QString QNetworkSessionPrivateImpl::bearerName() const -{ - if (!publicConfig.isValid() || !engine) - return QString(); - - return engine->bearerName(activeConfig.identifier()); -}*/ - QString QNetworkSessionPrivateImpl::errorString() const { switch (lastError) { @@ -414,18 +407,19 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } } -void QNetworkSessionPrivateImpl::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) +void QNetworkSessionPrivateImpl::connectionError(const QString &id, + QNetworkSessionEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); switch (error) { - case QNetworkSessionEngine::OperationNotSupported: + case QNetworkSessionEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; opened = false; break; - case QNetworkSessionEngine::InterfaceLookupError: - case QNetworkSessionEngine::ConnectError: - case QNetworkSessionEngine::DisconnectionError: + case QNetworkSessionEngineImpl::InterfaceLookupError: + case QNetworkSessionEngineImpl::ConnectError: + case QNetworkSessionEngineImpl::DisconnectionError: default: lastError = QNetworkSession::UnknownSessionError; } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 104d1f0..1fd97d3 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,15 +53,16 @@ // We mean it. // +#include "qnetworksessionengine_impl.h" + #include -#include #include #include QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; +class QNetworkSessionEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { @@ -109,7 +110,7 @@ private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); + void connectionError(const QString &id, QNetworkSessionEngineImpl::ConnectionError error); private: QNetworkConfigurationManager manager; @@ -120,7 +121,7 @@ private: bool opened; - QNetworkSessionEngine *engine; + QNetworkSessionEngineImpl *engine; QNetworkSession::SessionError lastError; diff --git a/src/plugins/bearer/qnetworksessionengine_impl.h b/src/plugins/bearer/qnetworksessionengine_impl.h new file mode 100644 index 0000000..1294cc5 --- /dev/null +++ b/src/plugins/bearer/qnetworksessionengine_impl.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKSESSIONENGINE_IMPL_H +#define QNETWORKSESSIONENGINE_IMPL_H + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkSessionEngineImpl : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + enum ConnectionError { + InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, + }; + + QNetworkSessionEngineImpl(QObject *parent = 0) : QNetworkSessionEngine(parent) { } + ~QNetworkSessionEngineImpl() { } + + virtual void connectToId(const QString &id) = 0; + virtual void disconnectFromId(const QString &id) = 0; + + virtual QString getInterfaceFromId(const QString &id) = 0; + + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + +Q_SIGNALS: + void connectionError(const QString &id, ConnectionError error); +}; + +QT_END_NAMESPACE + +#endif // QNETWORKSESSIONENGINE_IMPL_H diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index f5c5007..3d0ec0f 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -156,12 +156,6 @@ SymbianEngine::~SymbianEngine() delete ipCommsDB; } -QString SymbianEngine::getInterfaceFromId(const QString &id) -{ - qFatal("getInterfaceFromId(%s) not implemented\n", qPrintable(id)); - return QString(); -} - bool SymbianEngine::hasIdentifier(const QString &id) { return accessPointConfigurations.contains(id) || @@ -169,22 +163,6 @@ bool SymbianEngine::hasIdentifier(const QString &id) userChoiceConfigurations.contains(id); } -void SymbianEngine::connectToId(const QString &id) -{ - qFatal("connectToId(%s) not implemented\n", qPrintable(id)); -} - -void SymbianEngine::disconnectFromId(const QString &id) -{ - qFatal("disconnectFromId(%s) not implemented\n", qPrintable(id)); -} - -QNetworkSession::State SymbianEngine::sessionStateForId(const QString &id) -{ - qFatal("sessionStateForId(%s) not implemented\n", qPrintable(id)); - return QNetworkSession::Invalid; -} - QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const { QNetworkConfigurationManager::Capabilities capFlags; diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index cd5aa43..4a4a8c1 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -106,16 +106,10 @@ public: SymbianEngine(QObject *parent = 0); virtual ~SymbianEngine(); - QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id); - QNetworkConfigurationManager::Capabilities capabilities() const; QNetworkSessionPrivate *createSessionBackend(); -- cgit v0.12 From b1029a6bd7131d540f76ead8783ed0978f7163aa Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 11:13:05 +1000 Subject: Rename internal QNetworkSessionEngine* to QBearerEngine*. --- src/network/bearer/bearer.pri | 4 +- src/network/bearer/qbearerengine.cpp | 74 ++++++++++++++ src/network/bearer/qbearerengine_p.h | 107 ++++++++++++++++++++ src/network/bearer/qbearerplugin.h | 4 +- src/network/bearer/qnetworkconfigmanager.cpp | 8 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 8 +- src/network/bearer/qnetworkconfigmanager_p.h | 6 +- src/network/bearer/qnetworksession.cpp | 4 +- src/network/bearer/qnetworksessionengine.cpp | 74 -------------- src/network/bearer/qnetworksessionengine_p.h | 109 --------------------- src/plugins/bearer/corewlan/corewlan.pro | 2 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 4 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 2 +- src/plugins/bearer/generic/generic.pro | 2 +- src/plugins/bearer/generic/qgenericengine.cpp | 2 +- src/plugins/bearer/generic/qgenericengine.h | 4 +- src/plugins/bearer/nativewifi/nativewifi.pro | 2 +- .../bearer/nativewifi/qnativewifiengine.cpp | 2 +- src/plugins/bearer/nativewifi/qnativewifiengine.h | 4 +- .../bearer/networkmanager/networkmanager.pro | 2 +- .../networkmanager/qnetworkmanagerengine.cpp | 2 +- .../bearer/networkmanager/qnetworkmanagerengine.h | 4 +- src/plugins/bearer/nla/nla.pro | 2 +- src/plugins/bearer/nla/qnlaengine.cpp | 2 +- src/plugins/bearer/nla/qnlaengine.h | 4 +- src/plugins/bearer/qbearerengine_impl.h | 77 +++++++++++++++ src/plugins/bearer/qnetworksession_impl.cpp | 34 +++---- src/plugins/bearer/qnetworksession_impl.h | 8 +- src/plugins/bearer/qnetworksessionengine_impl.h | 77 --------------- src/plugins/bearer/symbian/symbianengine.cpp | 2 +- src/plugins/bearer/symbian/symbianengine.h | 4 +- 31 files changed, 319 insertions(+), 321 deletions(-) create mode 100644 src/network/bearer/qbearerengine.cpp create mode 100644 src/network/bearer/qbearerengine_p.h delete mode 100644 src/network/bearer/qnetworksessionengine.cpp delete mode 100644 src/network/bearer/qnetworksessionengine_p.h create mode 100644 src/plugins/bearer/qbearerengine_impl.h delete mode 100644 src/plugins/bearer/qnetworksessionengine_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 66b0ca4..14e7c0c 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -40,11 +40,11 @@ maemo { HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ - bearer/qnetworksessionengine_p.h \ + bearer/qbearerengine_p.h \ bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qnetworksessionengine.cpp \ + bearer/qbearerengine.cpp \ bearer/qbearerplugin.cpp contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp new file mode 100644 index 0000000..4d56047 --- /dev/null +++ b/src/network/bearer/qbearerengine.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbearerengine_p.h" + +QT_BEGIN_NAMESPACE + +QBearerEngine::QBearerEngine(QObject *parent) +: QObject(parent) +{ +} + +QBearerEngine::~QBearerEngine() +{ + foreach (const QString &oldIface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, userChoiceConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } +} + +#include "moc_qbearerengine_p.cpp" + +QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h new file mode 100644 index 0000000..7e96877 --- /dev/null +++ b/src/network/bearer/qbearerengine_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERENGINE_P_H +#define QBEARERENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfiguration_p.h" +#include "qnetworksession.h" +#include "qnetworkconfigmanager.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfiguration; + +class Q_NETWORK_EXPORT QBearerEngine : public QObject +{ + Q_OBJECT + +public: + QBearerEngine(QObject *parent = 0); + virtual ~QBearerEngine(); + + virtual bool hasIdentifier(const QString &id) = 0; + + virtual void requestUpdate() = 0; + + virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + + virtual QNetworkSessionPrivate *createSessionBackend() = 0; + + virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; + +public: + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash accessPointConfigurations; + QHash snapConfigurations; + QHash userChoiceConfigurations; + +Q_SIGNALS: + void configurationAdded(QNetworkConfigurationPrivatePointer config); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); + void configurationChanged(QNetworkConfigurationPrivatePointer config); + + void updateCompleted(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h index 970410b..1958188 100644 --- a/src/network/bearer/qbearerplugin.h +++ b/src/network/bearer/qbearerplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QBEARERPLUGIN_H #define QBEARERPLUGIN_H -#include +#include "qbearerengine_p.h" #include #include diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index f4daf4a..d46048b 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfigmanager_p.h" -#include "qnetworksessionengine_p.h" +#include "qbearerengine_p.h" #include @@ -232,7 +232,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); - foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); //find all InternetAccessPoints @@ -274,7 +274,7 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; - foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); else if (engine->snapConfigurations.contains(identifier)) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index bc3cfbd..a94fd2f 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -176,7 +176,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() foreach (const QString &key, l->keys()) { QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); if (plugin) { - QNetworkSessionEngine *engine = plugin->create(key); + QBearerEngine *engine = plugin->create(key); if (!engine) continue; @@ -195,7 +195,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } } - QNetworkSessionEngine *engine = qobject_cast(sender()); + QBearerEngine *engine = qobject_cast(sender()); if (!updatingEngines.isEmpty() && engine) { int index = sessionEngines.indexOf(engine); if (index >= 0) @@ -219,7 +219,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - foreach (QNetworkSessionEngine *engine, sessionEngines) { + foreach (QBearerEngine *engine, sessionEngines) { QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); if (ptr) { diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 4ef1f09..f6603ce 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; +class QBearerEngine; class QNetworkConfigurationManagerPrivate : public QObject { @@ -96,7 +96,7 @@ private: void abort(); public: - QList sessionEngines; + QList sessionEngines; private: QSet onlineConfigurations; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index c00921f..ba50ed6 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -43,7 +43,7 @@ #include #include "qnetworksession.h" -#include "qnetworksessionengine_p.h" +#include "qbearerengine_p.h" #include "qnetworkconfigmanager_p.h" #if Q_WS_MAEMO_6 @@ -228,7 +228,7 @@ QT_BEGIN_NAMESPACE QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) : QObject(parent), d(0) { - foreach (QNetworkSessionEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { + foreach (QBearerEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { if (engine->hasIdentifier(connectionConfig.identifier())) { d = engine->createSessionBackend(); d->q = this; diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp deleted file mode 100644 index 0744add..0000000 --- a/src/network/bearer/qnetworksessionengine.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworksessionengine_p.h" - -QT_BEGIN_NAMESPACE - -QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionEngine::~QNetworkSessionEngine() -{ - foreach (const QString &oldIface, snapConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - foreach (const QString &oldIface, accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - foreach (const QString &oldIface, userChoiceConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } -} - -#include "moc_qnetworksessionengine_p.cpp" -QT_END_NAMESPACE - diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h deleted file mode 100644 index 39c3d17..0000000 --- a/src/network/bearer/qnetworksessionengine_p.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONENGINE_P_H -#define QNETWORKSESSIONENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworkconfiguration_p.h" -#include "qnetworksession.h" -#include "qnetworkconfigmanager.h" - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfiguration; - -class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject -{ - Q_OBJECT - -public: - QNetworkSessionEngine(QObject *parent = 0); - virtual ~QNetworkSessionEngine(); - - virtual bool hasIdentifier(const QString &id) = 0; - - virtual void requestUpdate() = 0; - - virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; - - virtual QNetworkSessionPrivate *createSessionBackend() = 0; - - virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; - -public: - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash accessPointConfigurations; - QHash snapConfigurations; - QHash userChoiceConfigurations; - -Q_SIGNALS: - void configurationAdded(QNetworkConfigurationPrivatePointer config); - void configurationRemoved(QNetworkConfigurationPrivatePointer config); - void configurationChanged(QNetworkConfigurationPrivatePointer config); - - void updateCompleted(); -}; - -typedef QNetworkSessionEngine QBearerEngine; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index c59d602..50c72b2 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -13,7 +13,7 @@ contains(QT_CONFIG, corewlan) { HEADERS += qcorewlanengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qcorewlanengine.mm \ diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 7199ace..54f2027 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -42,7 +42,7 @@ #ifndef QCOREWLANENGINE_H #define QCOREWLANENGINE_H -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include #include @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class QCoreWlanEngine : public QNetworkSessionEngineImpl +class QCoreWlanEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index ca193ab..fff65e4 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -106,7 +106,7 @@ static QString qGetInterfaceType(const QString &interfaceString) } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent) +: QBearerEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index dbf96d1..1d141fd 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -5,7 +5,7 @@ QT += network HEADERS += qgenericengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h \ + ../qbearerengine_impl.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp \ ../qnetworksession_impl.cpp \ diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index dea820d..c6ab4df 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) } QGenericEngine::QGenericEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent) +: QBearerEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index d755228..cd9a976 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -42,7 +42,7 @@ #ifndef QGENERICENGINE_H #define QGENERICENGINE_H -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNetworkSessionPrivate; -class QGenericEngine : public QNetworkSessionEngineImpl +class QGenericEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 928d819..f277a04 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -6,7 +6,7 @@ QT += network HEADERS += qnativewifiengine.h \ platformdefs.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qnativewifiengine.cpp \ diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 9f0d4c0..d88534b 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -77,7 +77,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) } QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), handle(0) +: QBearerEngineImpl(parent), handle(0) { DWORD clientVersion; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 41217e2..a9a9375 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; struct WLAN_NOTIFICATION_DATA; -class QNativeWifiEngine : public QNetworkSessionEngineImpl +class QNativeWifiEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 6f271c6..5bac121 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -9,7 +9,7 @@ HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 129f7d2..2c550f0 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), +: QBearerEngineImpl(parent), interface(new QNetworkManagerInterface(this)), systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index f454628..848f166 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include "qnetworkmanagerservice.h" @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkManagerEngine : public QNetworkSessionEngineImpl +class QNetworkManagerEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 4c5e492..5ba171e 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -12,7 +12,7 @@ QT += network HEADERS += qnlaengine.h \ ../platformdefs_win.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbeaerengine_impl.h SOURCES += main.cpp \ qnlaengine.cpp \ diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index ed802c0..fbfac17 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -506,7 +506,7 @@ void QNlaThread::fetchConfigurations() } QNlaEngine::QNlaEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), nlaThread(0) +: QBearerEngineImpl(parent), nlaThread(0) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index fa010b9..14c5201 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include @@ -72,7 +72,7 @@ public: int version; }; -class QNlaEngine : public QNetworkSessionEngineImpl +class QNlaEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h new file mode 100644 index 0000000..6fffe27 --- /dev/null +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERENGINE_IMPL_H +#define QBEARERENGINE_IMPL_H + +#include + +QT_BEGIN_NAMESPACE + +class QBearerEngineImpl : public QBearerEngine +{ + Q_OBJECT + +public: + enum ConnectionError { + InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, + }; + + QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) { } + ~QBearerEngineImpl() { } + + virtual void connectToId(const QString &id) = 0; + virtual void disconnectFromId(const QString &id) = 0; + + virtual QString getInterfaceFromId(const QString &id) = 0; + + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + +Q_SIGNALS: + void connectionError(const QString &id, ConnectionError error); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 6de3423..c823d89 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qnetworksession_impl.h" -#include "qnetworksessionengine_impl.h" +#include "qbearerengine_impl.h" #include #include @@ -53,12 +53,12 @@ QT_BEGIN_NAMESPACE -static QNetworkSessionEngineImpl *getEngineFromId(const QString &id) +static QBearerEngineImpl *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - QNetworkSessionEngineImpl *engineImpl = qobject_cast(engine); + foreach (QBearerEngine *engine, priv->sessionEngines) { + QBearerEngineImpl *engineImpl = qobject_cast(engine); if (engineImpl && engineImpl->hasIdentifier(id)) return engineImpl; } @@ -111,16 +111,16 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType - ("QNetworkSessionEngineImpl::ConnectionError"); + qRegisterMetaType + ("QBearerEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: activeConfig = publicConfig; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), Qt::QueuedConnection); } break; @@ -322,15 +322,15 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); + disconnect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), Qt::QueuedConnection); } emit newConfigurationActivated(); @@ -408,18 +408,18 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } void QNetworkSessionPrivateImpl::connectionError(const QString &id, - QNetworkSessionEngineImpl::ConnectionError error) + QBearerEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); switch (error) { - case QNetworkSessionEngineImpl::OperationNotSupported: + case QBearerEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; opened = false; break; - case QNetworkSessionEngineImpl::InterfaceLookupError: - case QNetworkSessionEngineImpl::ConnectError: - case QNetworkSessionEngineImpl::DisconnectionError: + case QBearerEngineImpl::InterfaceLookupError: + case QBearerEngineImpl::ConnectError: + case QBearerEngineImpl::DisconnectionError: default: lastError = QNetworkSession::UnknownSessionError; } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 1fd97d3..0126a99 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -53,7 +53,7 @@ // We mean it. // -#include "qnetworksessionengine_impl.h" +#include "qbearerengine_impl.h" #include #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkSessionEngineImpl; +class QBearerEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { @@ -110,7 +110,7 @@ private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngineImpl::ConnectionError error); + void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); private: QNetworkConfigurationManager manager; @@ -121,7 +121,7 @@ private: bool opened; - QNetworkSessionEngineImpl *engine; + QBearerEngineImpl *engine; QNetworkSession::SessionError lastError; diff --git a/src/plugins/bearer/qnetworksessionengine_impl.h b/src/plugins/bearer/qnetworksessionengine_impl.h deleted file mode 100644 index 1294cc5..0000000 --- a/src/plugins/bearer/qnetworksessionengine_impl.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONENGINE_IMPL_H -#define QNETWORKSESSIONENGINE_IMPL_H - -#include - -QT_BEGIN_NAMESPACE - -class QNetworkSessionEngineImpl : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - enum ConnectionError { - InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, - }; - - QNetworkSessionEngineImpl(QObject *parent = 0) : QNetworkSessionEngine(parent) { } - ~QNetworkSessionEngineImpl() { } - - virtual void connectToId(const QString &id) = 0; - virtual void disconnectFromId(const QString &id) = 0; - - virtual QString getInterfaceFromId(const QString &id) = 0; - - virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; - -Q_SIGNALS: - void connectionError(const QString &id, ConnectionError error); -}; - -QT_END_NAMESPACE - -#endif // QNETWORKSESSIONENGINE_IMPL_H diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 3d0ec0f..2d0b5ee 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -98,7 +98,7 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const } SymbianEngine::SymbianEngine(QObject *parent) -: QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) +: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) { CActiveScheduler::Add(this); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 4a4a8c1..587585b 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -42,7 +42,7 @@ #ifndef SYMBIANENGINE_H #define SYMBIANENGINE_H -#include +#include #include #include @@ -97,7 +97,7 @@ inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfiguration return static_cast(ptr.data()); } -class SymbianEngine : public QNetworkSessionEngine, public CActive, +class SymbianEngine : public QBearerEngine, public CActive, public MConnectionMonitorObserver { Q_OBJECT -- cgit v0.12 From c470f8d1523ec974a7f0e1cb61ef13f0e953c500 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 13:59:49 +1000 Subject: Fix Network Manager and CoreWlan config tests. --- config.tests/unix/networkmanager/main.cpp | 5 +++-- config.tests/unix/networkmanager/networkmanager.pro | 4 ---- configure | 4 +++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp index f8b3d3c..7b91ae0 100644 --- a/config.tests/unix/networkmanager/main.cpp +++ b/config.tests/unix/networkmanager/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,8 +40,9 @@ ****************************************************************************/ #if defined(QT_NO_DBUS) -sjkp //error is no QtDBus +#error Qt is not configured with DBus support. #endif + #include int main(int argc, char** argv) diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro index 686286d..c41204f 100644 --- a/config.tests/unix/networkmanager/networkmanager.pro +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -1,7 +1,3 @@ SOURCES = main.cpp CONFIG -= qt dylib mac:CONFIG -= app_bundle - -!contains(QT_CONFIG,dbus): { - DEFINES += QT_NO_DBUS -} \ No newline at end of file diff --git a/configure b/configure index 13f58c8..a55e9ee 100755 --- a/configure +++ b/configure @@ -7587,7 +7587,9 @@ fi echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE" echo "Alsa support ........... $CFG_ALSA" echo "NetworkManager support . $CFG_NETWORKMANAGER" -echo "CoreWlan support ....... $CFG_COREWLAN" +if [ "$PLATFORM_MAC" = "yes" ]; then + echo "CoreWlan support ....... $CFG_COREWLAN" +fi echo [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC" -- cgit v0.12 From 10628947d5ab1cfcd571ada10c0eab4b7f1f02ac Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:16:34 +1000 Subject: Display session statistics. --- examples/network/bearermonitor/sessionwidget.cpp | 18 ++++++++- examples/network/bearermonitor/sessionwidget.h | 5 ++- examples/network/bearermonitor/sessionwidget.ui | 50 +++++++++++++++++++++++- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index d03c5bf..46ffb20 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -43,7 +43,7 @@ #include "qnetworkconfigmanager.h" SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) -: QWidget(parent) +: QWidget(parent), statsTimer(-1) { setupUi(this); @@ -75,11 +75,25 @@ SessionWidget::~SessionWidget() delete session; } +void SessionWidget::timerEvent(QTimerEvent *e) +{ + if (e->timerId() == statsTimer) { + rxData->setText(QString::number(session->bytesReceived())); + txData->setText(QString::number(session->bytesWritten())); + activeTime->setText(QString::number(session->activeTime())); + } +} + void SessionWidget::updateSession() { updateSessionState(session->state()); updateSessionError(session->error()); + if (session->state() == QNetworkSession::Connected) + statsTimer = startTimer(1000); + else + killTimer(statsTimer); + if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) bearer->setText(session->configuration().bearerName()); else { diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 868de3a..cc9c067 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -56,6 +56,8 @@ public: SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0); ~SessionWidget(); + void timerEvent(QTimerEvent *); + private: void updateSessionState(QNetworkSession::State state); void updateSessionError(QNetworkSession::SessionError error); @@ -69,6 +71,7 @@ private Q_SLOTS: private: QNetworkSession *session; + int statsTimer; }; #endif diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index 65ca43b..45135f5 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -7,7 +7,7 @@ 0 0 340 - 286 + 276 @@ -215,6 +215,54 @@ + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Active Time: + + + + + + + + 0 + 0 + + + + 0 seconds + + + + + + -- cgit v0.12 From 5096692696b18df82914fc1f63597e00c24fa5d2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:45:09 +1000 Subject: Remove remaining Network Manager ifdef'ed code from common code. --- src/network/bearer/bearer.pri | 2 - .../bearer/networkmanager/networkmanager.pro | 2 - .../networkmanager/qnetworkmanagerengine.cpp | 61 +++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 4 + src/plugins/bearer/qbearerengine_impl.h | 4 + src/plugins/bearer/qnetworksession_impl.cpp | 100 +++------------------ src/plugins/bearer/qnetworksession_impl.h | 13 +-- 7 files changed, 86 insertions(+), 100 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 14e7c0c..7dc9195 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -46,7 +46,5 @@ maemo { SOURCES += bearer/qnetworkconfigmanager_p.cpp \ bearer/qbearerengine.cpp \ bearer/qbearerplugin.cpp - - contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM } diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 5bac121..bf0d29a 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network dbus -DEFINES += BACKEND_NM - HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 2c550f0..9a9bdad 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -680,6 +680,67 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i return QNetworkSession::Invalid; } +quint64 QNetworkManagerEngine::bytesWritten(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + const QString networkInterface = getInterfaceFromId(id); + if (!networkInterface.isEmpty()) { + const QString devFile = QLatin1String("/sys/class/net/") + + networkInterface + + QLatin1String("/statistics/tx_bytes"); + + quint64 result = Q_UINT64_C(0); + + QFile tx(devFile); + if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + + return result; + } + } + + return Q_UINT64_C(0); +} + +quint64 QNetworkManagerEngine::bytesReceived(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + const QString networkInterface = getInterfaceFromId(id); + if (!networkInterface.isEmpty()) { + const QString devFile = QLatin1String("/sys/class/net/") + + networkInterface + + QLatin1String("/statistics/rx_bytes"); + + quint64 result = Q_UINT64_C(0); + + QFile tx(devFile); + if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + + return result; + } + } + + return Q_UINT64_C(0); +} + +quint64 QNetworkManagerEngine::startTime(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + if (connection) + return connection->getTimestamp(); + else + return Q_UINT64_C(0); +} + QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const { return QNetworkConfigurationManager::ForcedRoaming | diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 848f166..70efc05 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -82,6 +82,10 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + quint64 bytesWritten(const QString &id); + quint64 bytesReceived(const QString &id); + quint64 startTime(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; QNetworkSessionPrivate *createSessionBackend(); diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 6fffe27..3772639 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -68,6 +68,10 @@ public: virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + virtual quint64 bytesWritten(const QString &) { return Q_UINT64_C(0); } + virtual quint64 bytesReceived(const QString &) { return Q_UINT64_C(0); } + virtual quint64 startTime(const QString &) { return Q_UINT64_C(0); } + Q_SIGNALS: void connectionError(const QString &id, ConnectionError error); }; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index c823d89..8f95e77 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -266,50 +266,26 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const quint64 QNetworkSessionPrivateImpl::bytesWritten() const { -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); - } - } -#endif - return tx_data; + if (engine && state == QNetworkSession::Connected) + return engine->bytesWritten(activeConfig.identifier()); + else + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::bytesReceived() const { -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); - } - } -#endif - return rx_data; + if (engine && state == QNetworkSession::Connected) + return engine->bytesReceived(activeConfig.identifier()); + else + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::activeTime() const { -#if defined(BACKEND_NM) - if (startTime.isNull()) { - return 0; - } - if(state == QNetworkSession::Connected ) - return startTime.secsTo(QDateTime::currentDateTime()); -#endif - return m_activeTime; + if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0)) + return QDateTime::currentDateTime().toTime_t() - startTime; + else + return Q_UINT64_C(0); } void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() @@ -381,9 +357,8 @@ void QNetworkSessionPrivateImpl::networkConfigurationsChanged() updateStateFromServiceNetwork(); else updateStateFromActiveConfig(); -#if defined(BACKEND_NM) && 0 - setActiveTimeStamp(); -#endif + + startTime = engine->startTime(activeConfig.identifier()); } void QNetworkSessionPrivateImpl::configurationChanged(const QNetworkConfiguration &config) @@ -429,51 +404,4 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, } } -#if defined(BACKEND_NM) && 0 -void QNetworkSessionPrivateImpl::setActiveTimeStamp() -{ - if(NetworkManagerAvailable()) { - startTime = QDateTime(); - return; - } - QString connectionIdent = q->configuration().identifier(); - QString interface = currentInterface().hardwareAddress().toLower(); - QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); - - QString path; - QString serviceName; - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - QNetworkManagerConnectionActive *conDetails; - conDetails = new QNetworkManagerConnectionActive(conpath.path()); - QDBusObjectPath connection = conDetails->connection(); - serviceName = conDetails->serviceName(); - QList so = conDetails->devices(); - foreach(QDBusObjectPath device, so) { - - if(device.path() == devicePath) { - path = connection.path(); - } - break; - } - } -if(serviceName.isEmpty()) - return; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(serviceName); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); - startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - } - if(startTime.isNull()) - startTime = QDateTime::currentDateTime(); -} -#endif - QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 0126a99..7349e77 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -68,8 +68,8 @@ class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { Q_OBJECT public: - QNetworkSessionPrivateImpl() : - tx_data(0), rx_data(0), m_activeTime(0) + QNetworkSessionPrivateImpl() + : startTime(0) { } @@ -115,20 +115,13 @@ private Q_SLOTS: private: QNetworkConfigurationManager manager; - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; - bool opened; QBearerEngineImpl *engine; QNetworkSession::SessionError lastError; -#if defined(BACKEND_NM) - QDateTime startTime; - void setActiveTimeStamp(); -#endif + quint64 startTime; }; QT_END_NAMESPACE -- cgit v0.12 From 992af6c30d5e1216bf7a6db2521c16f0b508e396 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:50:14 +1000 Subject: Missed this in a previous commit. --- src/plugins/bearer/qbearerengine_impl.h | 2 +- src/plugins/bearer/qnetworksession_impl.cpp | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 3772639..740def3 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -73,7 +73,7 @@ public: virtual quint64 startTime(const QString &) { return Q_UINT64_C(0); } Q_SIGNALS: - void connectionError(const QString &id, ConnectionError error); + void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); }; QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 8f95e77..de1c91a 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -119,8 +119,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() activeConfig = publicConfig; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } break; @@ -298,15 +298,18 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError))); + disconnect(engine, + SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, + SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), + connect(engine, + SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } emit newConfigurationActivated(); -- cgit v0.12 From 8df1491dfb261ab41f9f360af8e23fd283ad1ca5 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 11:04:00 +1000 Subject: Calculate default configuration if one is not provided by engines. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 62 +++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index a94fd2f..9ebb0b3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -173,6 +173,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QFactoryLoader *l = loader(); + QBearerEngine *generic = 0; + foreach (const QString &key, l->keys()) { QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); if (plugin) { @@ -180,7 +182,11 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (!engine) continue; - sessionEngines.append(engine); + if (key == QLatin1String("generic")) + generic = engine; + else + sessionEngines.append(engine); + connect(engine, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations())); connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), @@ -193,6 +199,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() capFlags |= engine->capabilities(); } } + + sessionEngines.append(generic); } QBearerEngine *engine = qobject_cast(sender()); @@ -229,6 +237,58 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( } } + // Engines don't have a default configuration. + + // Return first active snap + QNetworkConfigurationPrivatePointer firstDiscovered; + + foreach (QBearerEngine *engine, sessionEngines) { + foreach (const QString &id, engine->snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = engine->snapConfigurations.value(id); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = ptr; + return config; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = ptr; + } + } + } + + // No Active SNAPs return first Discovered SNAP. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + + // No Active or Discovered SNAPs, do same for InternetAccessPoints. + firstDiscovered.reset(); + + foreach (QBearerEngine *engine, sessionEngines) { + foreach (const QString &id, engine->accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = engine->accessPointConfigurations.value(id); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = ptr; + return config; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = ptr; + } + } + } + + // No Active InternetAccessPoint return first Discovered InternetAccessPoint. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + return QNetworkConfiguration(); } -- cgit v0.12 From 76160422d532b2ccf63a5c477f74a6645428c0f7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 12:51:27 +1000 Subject: Emit signals when access points appear & disappear. --- .../networkmanager/qnetworkmanagerengine.cpp | 66 +++++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 9a9bdad..51afe3e 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -499,19 +499,21 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec } // Check if configuration exists for connection. - for (int i = 0; i < connections.count(); ++i) { - QNetworkManagerSettingsConnection *connection = connections.at(i); + if (!accessPoint->ssid().isEmpty()) { + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); - if (accessPoint->ssid() == connection->getSsid()) { - const QString service = connection->connectionInterface()->service(); - const QString settingsPath = connection->connectionInterface()->path(); - const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); - QNetworkConfigurationPrivatePointer ptr = - accessPointConfigurations.value(connectionId); - ptr->state = QNetworkConfiguration::Discovered; - emit configurationChanged(ptr); - return; + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } } } @@ -544,12 +546,32 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, if (configuredAccessPoints.contains(accessPoint)) { // find connection and change state to Defined configuredAccessPoints.removeOne(accessPoint); - qDebug() << "At least one connection is no longer discovered."; + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = + QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Defined; + emit configurationChanged(ptr); + return; + } + } } else { - // emit configurationRemoved(cpPriv); - qDebug() << "An unconfigured wifi access point was removed."; + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(QString::number(qHash(objectPath.path()))); + + if (ptr) + emit configurationRemoved(ptr); } + delete accessPoint; + break; } } @@ -564,7 +586,21 @@ void QNetworkManagerEngine::updateAccessPoint(const QMap &map if (!accessPoint) return; - qDebug() << "update access point" << accessPoint; + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } + } } QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &service, -- cgit v0.12 From 2963cb346814d47fd59e04bfd9bcd5fde88d5bd8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 17:29:45 +1000 Subject: Only add generic engine when it is available. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 9ebb0b3..a624376 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -200,7 +200,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } } - sessionEngines.append(generic); + if (generic) + sessionEngines.append(generic); } QBearerEngine *engine = qobject_cast(sender()); -- cgit v0.12 From c6157559204b61b11537ab0c0aba16eb182b09fe Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 17:37:48 +1000 Subject: Automatically migrate in-progress transfers after roaming. Automatically migrate in-progress transfers after roaming to a new access point for backends that support it. Currently only works for http transfers that do not upload data (i.e. HTTP GET). --- src/network/access/qnetworkaccessmanager.cpp | 35 +++----------------------- src/network/access/qnetworkaccessmanager_p.h | 4 +-- src/network/access/qnetworkreplyimpl.cpp | 37 +++++++++++++++++++--------- src/network/access/qnetworkreplyimpl_p.h | 2 +- 4 files changed, 31 insertions(+), 47 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 617e398..8df580d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -802,27 +802,6 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); - - if (session && deferredMigration) { - foreach (QObject *child, q->children()) { - if (child == reply) - continue; - - QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (!replyImpl) - continue; - - QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; - if (state == QNetworkReplyImplPrivate::Buffering || - state == QNetworkReplyImplPrivate::Working) { - return; - } - } - - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList &errors) @@ -1136,6 +1115,7 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() { Q_Q(QNetworkAccessManager); +#if 0 foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); if (reply) { @@ -1151,6 +1131,7 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() } } } +#endif qDebug() << "Accepting new configuration."; session->accept(); @@ -1183,18 +1164,10 @@ void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const foreach (QObject *child, q->children()) { QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (replyImpl) { - QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; - if (state == QNetworkReplyImplPrivate::Buffering || - state == QNetworkReplyImplPrivate::Working) { - deferredMigration = true; - return; - } - } + if (replyImpl) + replyImpl->migrateBackend(); } - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; session->migrate(); } diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 92b2782..e916158 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,8 +76,7 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0), - deferredMigration(false) + session(0) { } ~QNetworkAccessManagerPrivate(); @@ -131,7 +130,6 @@ public: bool cookieJarCreated; QNetworkSession *session; - bool deferredMigration; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 0c7aca8..9721e32 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -477,6 +477,17 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (totalSize.isNull()) { + RawHeadersList::ConstIterator it = findRawHeader("Content-Range"); + if (it != rawHeaders.constEnd()) { + int index = it->second.lastIndexOf('/'); + if (index != -1) + totalSize = it->second.mid(index + 1).toLongLong() - preMigrationDownloaded; + } else { + qDebug() << "Could not find Content-Length or Content-Range header"; + } + } + if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); @@ -520,7 +531,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) void QNetworkReplyImplPrivate::finished() { Q_Q(QNetworkReplyImpl); - if (state == Finished || state == Aborted) + + if (state == Finished || state == Aborted || state == WaitingForSession) return; pauseNotificationHandling(); @@ -540,11 +552,10 @@ void QNetworkReplyImplPrivate::finished() } else { qDebug() << "Download hasn't finished"; - if (q->bytesAvailable() == bytesDownloaded) { - qDebug() << "User hasn't read data from reply, we could continue after reconnect."; - error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); - } else if (q->bytesAvailable() < bytesDownloaded) { - qDebug() << "User has already read data from reply."; + if (migrateBackend()) { + return; + } else { + qDebug() << "Could not migrate backend, application needs to send another requeset."; error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); } } @@ -781,24 +792,24 @@ void QNetworkReplyImpl::migrateBackend() d->migrateBackend(); } -void QNetworkReplyImplPrivate::migrateBackend() +bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); if (state == QNetworkReplyImplPrivate::Finished || state == QNetworkReplyImplPrivate::Aborted) { qDebug() << "Network reply is already finished/aborted."; - return; + return false; } if (!qobject_cast(backend)) { qDebug() << "Resume only support by http backend, not migrating."; - return; + return false; } if (outgoingData) { qDebug() << "Request has outgoing data, not migrating."; - return; + return false; } qDebug() << "Need to check for only cacheable content."; @@ -812,14 +823,14 @@ void QNetworkReplyImplPrivate::migrateBackend() state = QNetworkReplyImplPrivate::Reconnecting; if (backend) { - backend->deleteLater(); + delete backend; backend = 0; } RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); if (it == rawHeaders.constEnd() || it->second == "none") { qDebug() << "Range header not supported by server/resource."; - qFatal("Should fail with TemporaryNetworkFailure."); + return false; } cookedHeaders.clear(); @@ -841,6 +852,8 @@ void QNetworkReplyImplPrivate::migrateBackend() } else { QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } + + return true; } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ac82ca0..89b976f 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -165,7 +165,7 @@ public: QIODevice *copyDevice; QAbstractNetworkCache *networkCache() const; - void migrateBackend(); + bool migrateBackend(); bool cacheEnabled; QIODevice *cacheSaveDevice; -- cgit v0.12 From 21abc34acdfa4a675b9c9ff5294726faf0d4c00e Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 9 Feb 2010 12:06:28 +1000 Subject: Add networkAccess property to QNAM. Enables network access via QNAM to be enabled/disabled. --- src/network/access/qnetworkaccessmanager.cpp | 84 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 8 +++ src/network/access/qnetworkaccessmanager_p.h | 4 +- 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 8df580d..7f36570 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -57,6 +57,7 @@ #include "QtCore/qbuffer.h" #include "QtCore/qurl.h" #include "QtCore/qvector.h" +#include "QtCore/qcoreapplication.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qnetworkconfigmanager.h" @@ -162,6 +163,29 @@ static void ensureInitialized() */ /*! + \property QNetworkAccessManager::networkAccess + \brief wheather network access is enabled or disabled through this network access manager. + \since 4.7 + + Network access is enabled by default. + + When network access is disabled the network access manager will not process any new network + requests, all such requests will fail with an error. Requests with URLs with the file:// scheme + will still be processed. + + This property can be used to enable and disable network access for all clients of a single + network access manager instance. +*/ + +/*! + \fn void QNetworkAccessManager::networkAccessChanged(bool enabled) + + This signal is emitted when the value of the \l networkAccess property changes. If \a enabled + is true new requests that access the network will be processed; otherwise new network requests + that require network access will fail with an error. +*/ + +/*! \fn void QNetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) This signal is emitted whenever a proxy requests authentication @@ -719,6 +743,63 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const } } +void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) +{ + Q_D(QNetworkAccessManager); + + if (d->networkAccessEnabled != enabled) { + d->networkAccessEnabled = enabled; + emit networkAccessChanged(enabled); + } +} + +bool QNetworkAccessManager::networkAccessEnabled() const +{ + Q_D(const QNetworkAccessManager); + + return d->networkAccessEnabled; +} + +class QDisabledNetworkReply : public QNetworkReply +{ + Q_OBJECT + +public: + QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, + const QNetworkAccessManager::Operation op); + ~QDisabledNetworkReply(); + + void abort() { } +protected: + qint64 readData(char *, qint64) { return 0; } +}; + +QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, + const QNetworkRequest &req, + QNetworkAccessManager::Operation op) +: QNetworkReply(parent) +{ + setRequest(req); + setUrl(req.url()); + setOperation(op); + + qRegisterMetaType("QNetworkReply::NetworkError"); + + QString msg = QCoreApplication::translate("QNetworkAccessManager", + "Network access is disabled."); + setError(UnknownNetworkError, msg); + + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); +} + +QDisabledNetworkReply::~QDisabledNetworkReply() +{ +} + +#include "qnetworkaccessmanager.moc" + /*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and @@ -748,6 +829,9 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } + if (!d->networkAccessEnabled) + return new QDisabledNetworkReply(this, req, op); + QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && outgoingData && !outgoingData->isSequential()) { diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 14aaf78..371f729 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -69,6 +69,9 @@ class QNetworkAccessManagerPrivate; class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject { Q_OBJECT + + Q_PROPERTY(bool networkAccess READ networkAccessEnabled WRITE setNetworkAccessEnabled NOTIFY networkAccessChanged) + public: enum Operation { HeadOperation = 1, @@ -108,6 +111,9 @@ public: QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; + void setNetworkAccessEnabled(bool enabled); + bool networkAccessEnabled() const; + Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); @@ -118,6 +124,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void networkAccessChanged(bool enabled); + void debugMessage(const QString &message); protected: diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index e916158..eae08e8 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,8 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0) + session(0), + networkAccessEnabled(true) { } ~QNetworkAccessManagerPrivate(); @@ -130,6 +131,7 @@ public: bool cookieJarCreated; QNetworkSession *session; + bool networkAccessEnabled; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. -- cgit v0.12 From d792ec16f29a7cb34bada871127f701ba9480100 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 10 Feb 2010 15:08:29 +1000 Subject: Convert Maemo6 backend into plugin. --- src/network/bearer/bearer.pri | 52 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 759 ------------- src/network/bearer/qnetworkconfigmanager_maemo_p.h | 141 --- src/network/bearer/qnetworkconfiguration.cpp | 2 +- src/network/bearer/qnetworkconfiguration_maemo_p.h | 122 -- src/network/bearer/qnetworkconfiguration_p.h | 2 +- src/network/bearer/qnetworksession.cpp | 5 - src/network/bearer/qnetworksession_maemo.cpp | 1164 -------------------- src/network/bearer/qnetworksession_maemo_p.h | 170 --- src/network/bearer/qnetworksession_p.h | 8 +- src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/icd/icd.pro | 22 + src/plugins/bearer/icd/main.cpp | 84 ++ src/plugins/bearer/icd/monitor.cpp | 116 ++ src/plugins/bearer/icd/monitor.h | 116 ++ src/plugins/bearer/icd/qicdengine.cpp | 416 +++++++ src/plugins/bearer/icd/qicdengine.h | 122 ++ src/plugins/bearer/icd/qnetworksession_impl.cpp | 1105 +++++++++++++++++++ src/plugins/bearer/icd/qnetworksession_impl.h | 147 +++ 19 files changed, 2148 insertions(+), 2406 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfigmanager_maemo.cpp delete mode 100644 src/network/bearer/qnetworkconfigmanager_maemo_p.h delete mode 100644 src/network/bearer/qnetworkconfiguration_maemo_p.h delete mode 100644 src/network/bearer/qnetworksession_maemo.cpp delete mode 100644 src/network/bearer/qnetworksession_maemo_p.h create mode 100644 src/plugins/bearer/icd/icd.pro create mode 100644 src/plugins/bearer/icd/main.cpp create mode 100644 src/plugins/bearer/icd/monitor.cpp create mode 100644 src/plugins/bearer/icd/monitor.h create mode 100644 src/plugins/bearer/icd/qicdengine.cpp create mode 100644 src/plugins/bearer/icd/qicdengine.h create mode 100644 src/plugins/bearer/icd/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/icd/qnetworksession_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 7dc9195..c03c615 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -1,50 +1,18 @@ # Qt network bearer management module -#DEFINES += BEARER_MANAGEMENT_DEBUG - HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworksession.h \ - bearer/qnetworkconfigmanager.h + bearer/qnetworkconfigmanager.h \ + bearer/qnetworkconfigmanager_p.h \ + bearer/qnetworkconfiguration_p.h \ + bearer/qnetworksession_p.h \ + bearer/qbearerengine_p.h \ + bearer/qbearerplugin.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ - bearer/qnetworkconfiguration.cpp - -maemo { - CONFIG += link_pkgconfig - - exists(../debug) { - message("Enabling debug messages.") - DEFINES += BEARER_MANAGEMENT_DEBUG - } - - HEADERS += bearer/qnetworksession_maemo_p.h \ - bearer/qnetworkconfigmanager_maemo_p.h \ - bearer/qnetworkconfiguration_maemo_p.h - - SOURCES += bearer/qnetworkconfigmanager_maemo.cpp \ - bearer/qnetworksession_maemo.cpp - - documentation.path = $$QT_MOBILITY_PREFIX/doc - documentation.files = doc/html - - PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - - CONFIG += create_pc create_prl - QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig - pkgconfig.files = QtBearer.pc - - INSTALLS += pkgconfig documentation -} else { - HEADERS += bearer/qnetworkconfigmanager_p.h \ - bearer/qnetworkconfiguration_p.h \ - bearer/qnetworksession_p.h \ - bearer/qbearerengine_p.h \ - bearer/qbearerplugin.h - - SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qbearerengine.cpp \ - bearer/qbearerplugin.cpp -} + bearer/qnetworkconfiguration.cpp \ + bearer/qnetworkconfigmanager_p.cpp \ + bearer/qbearerengine.cpp \ + bearer/qbearerplugin.cpp diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp deleted file mode 100644 index 96da30d..0000000 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qnetworkconfigmanager_maemo_p.h" - -#include -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#define IAP "/system/osso/connectivity/IAP" -static int iap_prefix_len; -static void notify_iap(GConfClient *client, guint id, - GConfEntry *entry, gpointer user_data); - - -/* The IapAddTimer is a helper class that makes sure we update - * the configuration only after all gconf additions to certain - * iap are finished (after a certain timeout) - */ -class _IapAddTimer : public QObject -{ - Q_OBJECT - -public: - _IapAddTimer() {} - ~_IapAddTimer() - { - if (timer.isActive()) { - QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.stop(); - } - } - - void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); - - QString iap_id; - QTimer timer; - QNetworkConfigurationManagerPrivate *d; - -public Q_SLOTS: - void timeout(); -}; - - -void _IapAddTimer::add(QString& id, QNetworkConfigurationManagerPrivate *d_ptr) -{ - iap_id = id; - d = d_ptr; - - if (timer.isActive()) { - QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.stop(); - } - timer.setSingleShot(true); - QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.start(1500); -} - - -void _IapAddTimer::timeout() -{ - d->addConfiguration(iap_id); -} - - -class IapAddTimer { - QHash timers; - -public: - IapAddTimer() {} - ~IapAddTimer() {} - - void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); - void del(QString& iap_id); - void removeAll(); -}; - - -void IapAddTimer::removeAll() -{ - QHashIterator i(timers); - while (i.hasNext()) { - i.next(); - _IapAddTimer *t = i.value(); - delete t; - } - timers.clear(); -} - - -void IapAddTimer::add(QString& iap_id, QNetworkConfigurationManagerPrivate *d) -{ - if (timers.contains(iap_id)) { - _IapAddTimer *iap = timers.value(iap_id); - iap->add(iap_id, d); - } else { - _IapAddTimer *iap = new _IapAddTimer; - iap->add(iap_id, d); - timers.insert(iap_id, iap); - } -} - -void IapAddTimer::del(QString& iap_id) -{ - if (timers.contains(iap_id)) { - _IapAddTimer *iap = timers.take(iap_id); - delete iap; - } -} - - -class IapMonitor -{ -public: - IapMonitor() : first_call(true) { } - friend void notify_iap(GConfClient *, guint, - GConfEntry *entry, gpointer user_data); - - void setup(QNetworkConfigurationManagerPrivate *d); - void cleanup(); - -private: - bool first_call; - - void iapAdded(const char *key, GConfEntry *entry); - void iapDeleted(const char *key, GConfEntry *entry); - - Maemo::IAPMonitor *iap; - QNetworkConfigurationManagerPrivate *d; - IapAddTimer timers; -}; - -Q_GLOBAL_STATIC(IapMonitor, iapMonitor); - - -/* Notify func that is called when IAP is added or deleted */ -static void notify_iap(GConfClient *, guint, - GConfEntry *entry, gpointer user_data) -{ - const char *key = gconf_entry_get_key(entry); - if (key && g_str_has_prefix(key, IAP)) { - IapMonitor *ptr = (IapMonitor *)user_data; - if (gconf_entry_get_value(entry)) { - ptr->iapAdded(key, entry); - } else { - ptr->iapDeleted(key, entry); - } - } -} - - -void IapMonitor::setup(QNetworkConfigurationManagerPrivate *d_ptr) -{ - if (first_call) { - d = d_ptr; - iap_prefix_len = strlen(IAP); - iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this); - first_call = false; - } -} - - -void IapMonitor::cleanup() -{ - if (!first_call) { - delete iap; - timers.removeAll(); - first_call = true; - } -} - - -void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/) -{ - //qDebug("Notify called for added element: %s=%s", gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry))); - - /* We cannot know when the IAP is fully added to gconf, so a timer is - * installed instead. When the timer expires we hope that IAP is added ok. - */ - QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0); - timers.add(iap_id, d); -} - - -void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/) -{ - //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry)); - - /* We are only interested in IAP deletions so we skip the config entries - */ - if (strstr(key + iap_prefix_len + 1, "/")) { - //qDebug("Deleting IAP config %s", key+iap_prefix_len); - return; - } - - QString iap_id = key + iap_prefix_len + 1; - d->deleteConfiguration(iap_id); -} - - - -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - capFlags |= QNetworkConfigurationManager::DataStatistics; - capFlags |= QNetworkConfigurationManager::ForcedRoaming; -} - - -static inline QString network_attrs_to_security(uint network_attrs) -{ - uint cap = 0; - nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */ - if (cap & WLANCOND_OPEN) - return "NONE"; - else if (cap & WLANCOND_WEP) - return "WEP"; - else if (cap & WLANCOND_WPA_PSK) - return "WPA_PSK"; - else if (cap & WLANCOND_WPA_EAP) - return "WPA_EAP"; - return ""; -} - - -struct SSIDInfo { - QString iap_id; - QString wlan_security; -}; - - -void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *ptr) -{ - QNetworkConfiguration item; - item.d = ptr; - emit configurationChanged(item); -} - -void QNetworkConfigurationManagerPrivate::deleteConfiguration(QString& iap_id) -{ - /* Called when IAPs are deleted in gconf, in this case we do not scan - * or read all the IAPs from gconf because it might take too much power - * (multiple applications would need to scan and read all IAPs from gconf) - */ - if (accessPointConfigurations.contains(iap_id)) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); - if (priv.data()) { - priv->isValid = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "was removed from storage."; -#endif - - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - configChanged(priv.data(), false); - } else - qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); -#endif - } -} - - -uint32_t QNetworkConfigurationManagerPrivate::getNetworkAttrs(bool is_iap_id, - QString& iap_id, - QString& iap_type, - QString security_method) -{ - guint network_attr = 0; - dbus_uint32_t cap = 0; - - if (iap_type == "WLAN_INFRA") - cap |= WLANCOND_INFRA; - else if (iap_type == "WLAN_ADHOC") - cap |= WLANCOND_ADHOC; - - if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) { - Maemo::IAPConf saved_ap(iap_id); - security_method = saved_ap.value("wlan_security").toString(); - } - - if (!security_method.isEmpty()) { - if (security_method == "WEP") - cap |= WLANCOND_WEP; - else if (security_method == "WPA_PSK") - cap |= WLANCOND_WPA_PSK; - else if (security_method == "WPA_EAP") - cap |= WLANCOND_WPA_EAP; - else if (security_method == "NONE") - cap |= WLANCOND_OPEN; - - if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) { - Maemo::IAPConf saved_iap(iap_id); - bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool(); - if (wpa2_only) { - cap |= WLANCOND_WPA2; - } - } - } - - cap2nwattr(cap, &network_attr); - if (is_iap_id) - network_attr |= ICD_NW_ATTR_IAPNAME; - - return (uint32_t)network_attr; -} - - -void QNetworkConfigurationManagerPrivate::addConfiguration(QString& iap_id) -{ - if (!accessPointConfigurations.contains(iap_id)) { - Maemo::IAPConf saved_iap(iap_id); - QString iap_type = saved_iap.value("type").toString(); - if (!iap_type.isEmpty()) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = saved_iap.value("name").toString(); - if (cpPriv->name.isEmpty()) - cpPriv->name = iap_id; - cpPriv->isValid = true; - cpPriv->id = iap_id; - cpPriv->iap_type = iap_type; - cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - cpPriv->service_id = saved_iap.value("service_id").toString(); - cpPriv->service_type = saved_iap.value("service_type").toString(); - if (iap_type.startsWith("WLAN")) { - QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - } - } - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Defined; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(iap_id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data()); -#endif - - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - configChanged(ptr.data(), true); - } else { - qWarning("IAP %s does not have \"type\" field defined, skipping this IAP.", iap_id.toAscii().data()); - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "already in gconf."; -#endif - - /* Check if the data in gconf changed and update configuration - * accordingly - */ - QExplicitlySharedDataPointer ptr = accessPointConfigurations.take(iap_id); - if (ptr.data()) { - Maemo::IAPConf changed_iap(iap_id); - QString iap_type = changed_iap.value("type").toString(); - bool update_needed = false; /* if IAP type or ssid changed, we need to change the state */ - - ptr->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - ptr->service_id = changed_iap.value("service_id").toString(); - ptr->service_type = changed_iap.value("service_type").toString(); - - if (!iap_type.isEmpty()) { - ptr->name = changed_iap.value("name").toString(); - if (ptr->name.isEmpty()) - ptr->name = iap_id; - ptr->isValid = true; - if (ptr->iap_type != iap_type) { - ptr->iap_type = iap_type; - update_needed = true; - } - if (iap_type.startsWith("WLAN")) { - QByteArray ssid = changed_iap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - } - if (ptr->network_id != ssid) { - ptr->network_id = ssid; - update_needed = true; - } - } - } - accessPointConfigurations.insert(iap_id, ptr); - if (update_needed) { - ptr->type = QNetworkConfiguration::InternetAccessPoint; - if (ptr->state != QNetworkConfiguration::Defined) { - ptr->state = QNetworkConfiguration::Defined; - configurationChanged(ptr.data()); - } - } - } else { - qWarning("Cannot find IAP %s from current configuration although it should be there.", iap_id.toAscii().data()); - } - } -} - - -void QNetworkConfigurationManagerPrivate::updateConfigurations() -{ - /* Contains known network id (like ssid) from storage */ - QMultiHash knownConfigs; - - /* All the scanned access points */ - QList scanned; - - /* Turn on IAP monitoring */ - iapMonitor()->setup(this); - - if (firstUpdate) { - /* We create a default configuration which is a pseudo config */ - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = "UserChoice"; - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->isValid = true; - cpPriv->id = OSSO_IAP_ANY; - cpPriv->type = QNetworkConfiguration::UserChoice; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - QExplicitlySharedDataPointer ptr(cpPriv); - userChoiceConfigurations.insert(cpPriv->id, ptr); - } - - /* We return currently configured IAPs in the first run and do the WLAN - * scan in subsequent runs. - */ - QList all_iaps; - Maemo::IAPConf::getAll(all_iaps); - - foreach (QString escaped_iap_id, all_iaps) { - QByteArray ssid; - - /* The key that is returned by getAll() needs to be unescaped */ - gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1); - QString iap_id = QString((char *)unescaped_id); - g_free(unescaped_id); - - Maemo::IAPConf saved_ap(iap_id); - bool is_temporary = saved_ap.value("temporary").toBool(); - if (is_temporary) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "is temporary, skipping it."; -#endif - continue; - } - - QString iap_type = saved_ap.value("type").toString(); - if (iap_type.startsWith("WLAN")) { - ssid = saved_ap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - continue; - } - - QString security_method = saved_ap.value("wlan_security").toString(); - SSIDInfo *info = new SSIDInfo; - info->iap_id = iap_id; - info->wlan_security = security_method; - knownConfigs.insert(ssid, info); - } else if (iap_type.isEmpty()) { - qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; - continue; - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "network type is" << iap_type; -#endif - ssid.clear(); - } - - if (!accessPointConfigurations.contains(iap_id)) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - //cpPriv->name = iap_info.value().toString(); - cpPriv->name = saved_ap.value("name").toString(); - if (cpPriv->name.isEmpty()) - if (!ssid.isEmpty() && ssid.size() > 0) - cpPriv->name = ssid.data(); - else - cpPriv->name = iap_id; - cpPriv->isValid = true; - cpPriv->id = iap_id; - cpPriv->network_id = ssid; - cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - cpPriv->iap_type = iap_type; - cpPriv->service_id = saved_ap.value("service_id").toString(); - cpPriv->service_type = saved_ap.value("service_type").toString(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->manager = this; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(iap_id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, name: %s, ssid: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); -#endif - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, ssid: %s, already exists in the known list", iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); -#endif - } - } - - if (!firstUpdate) { - QStringList scannedNetworkTypes; - QStringList networkTypesToScan; - QString error; - Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); - - scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, - networkTypesToScan, - scanned, - error); - if (!error.isEmpty()) { - qWarning() << "Network scanning failed" << error; - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - if (!scanned.isEmpty()) - qDebug() << "Scan returned" << scanned.size() << "networks"; - else - qDebug() << "Scan returned nothing."; -#endif - } - } - - - /* This is skipped in the first update as scanned size is zero */ - if (!scanned.isEmpty()) - for (int i=0; i priv = accessPointConfigurations.take(iapid); - if (priv.data()) { - priv->state = QNetworkConfiguration::Discovered; /* Defined is set automagically */ - priv->network_attrs = ap.scan.network_attrs; - priv->service_id = ap.scan.service_id; - priv->service_type = ap.scan.service_type; - priv->service_attrs = ap.scan.service_attrs; - - configurationChanged(priv.data()); - accessPointConfigurations.insert(iapid, priv); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, ssid: %s, discovered", iapid.toAscii().data(), priv->network_id.data()); -#endif - - if (!ap.scan.network_type.startsWith("WLAN")) - continue; // not a wlan AP - - /* Remove scanned AP from known configurations so that we can - * emit configurationRemoved signal later - */ - QList known_iaps = knownConfigs.values(priv->network_id); - rescan_list: - if (!known_iaps.isEmpty()) { - for (int k=0; kiap_id << "security" << iap->wlan_security << "scan" << network_attrs_to_security(ap.scan.network_attrs); -#endif - - if (iap->wlan_security == - network_attrs_to_security(ap.scan.network_attrs)) { - /* Remove IAP from the list */ - knownConfigs.remove(priv->network_id, iap); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Removed IAP" << iap->iap_id << "from unknown config"; -#endif - known_iaps.removeAt(k); - delete iap; - goto rescan_list; - } - } - } - } else { - qWarning() << "IAP" << iapid << "is missing in configuration."; - } - - } else { - /* Non saved access point data */ - QByteArray scanned_ssid = ap.scan.network_id; - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QString hrs = scanned_ssid.data(); - - cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name; - cpPriv->isValid = true; - cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved - cpPriv->network_id = scanned_ssid; - cpPriv->iap_type = ap.scan.network_type; - cpPriv->network_attrs = ap.scan.network_attrs; - cpPriv->service_id = ap.scan.service_id; - cpPriv->service_type = ap.scan.service_type; - cpPriv->service_attrs = ap.scan.service_attrs; - cpPriv->manager = this; - - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Undefined; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(cpPriv->id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan."; -#endif - - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } - - - /* Remove non existing iaps since last update */ - if (!firstUpdate) { - QHashIterator i(knownConfigs); - while (i.hasNext()) { - i.next(); - SSIDInfo *iap = i.value(); - QString iap_id = iap->iap_id; - //qDebug() << i.key() << ": " << iap_id; - - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); - if (priv.data()) { - priv->isValid = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "was removed as it was not found in scan."; -#endif - - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - configChanged(priv.data(), false); - - //if we would have SNAP support we would have to remove the references - //from existing ServiceNetworks to the removed access point configuration - } - } - } - - - QMutableHashIterator i(knownConfigs); - while (i.hasNext()) { - i.next(); - SSIDInfo *iap = i.value(); - delete iap; - i.remove(); - } - - if (!firstUpdate) - emit configurationUpdateComplete(); - - if (firstUpdate) - firstUpdate = false; -} - - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() -{ - /* Here we just return [ANY] request to icd and let the icd decide which - * IAP to connect. - */ - QNetworkConfiguration item; - if (userChoiceConfigurations.contains(OSSO_IAP_ANY)) - item.d = userChoiceConfigurations.value(OSSO_IAP_ANY); - return item; -} - - -void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() -{ - QTimer::singleShot(0, this, SLOT(updateConfigurations())); -} - - -void QNetworkConfigurationManagerPrivate::cleanup() -{ - iapMonitor()->cleanup(); -} - - -void QNetworkConfigurationManagerPrivate::configChanged(QNetworkConfigurationPrivate *ptr, bool added) -{ - if (added) { - if (ptr && ptr->state == QNetworkConfiguration::Active) { - onlineConfigurations++; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } - } else { - if (ptr && ptr->state == QNetworkConfiguration::Active) { - onlineConfigurations--; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - if (onlineConfigurations < 0) - onlineConfigurations = 0; - } - } -} - - -#include "qnetworkconfigmanager_maemo.moc" -#include "moc_qnetworkconfigmanager_maemo_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_maemo_p.h b/src/network/bearer/qnetworkconfigmanager_maemo_p.h deleted file mode 100644 index 5cc99c2..0000000 --- a/src/network/bearer/qnetworkconfigmanager_maemo_p.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONMANAGERPRIVATE_H -#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - - -class QNetworkConfigurationManagerPrivate : public QObject -{ - Q_OBJECT -public: - QNetworkConfigurationManagerPrivate() - : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0) - { - registerPlatformCapabilities(); - updateConfigurations(); - } - - virtual ~QNetworkConfigurationManagerPrivate() - { - QList configIdents = snapConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = userChoiceConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - cleanup(); - } - - QNetworkConfiguration defaultConfiguration(); - - QNetworkConfigurationManager::Capabilities capFlags; - void registerPlatformCapabilities(); - - void performAsyncConfigurationUpdate(); - - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; - bool firstUpdate; - int onlineConfigurations; - friend class IapMonitor; - void cleanup(); - void deleteConfiguration(QString &iap_id); - void addConfiguration(QString &iap_id); - void configurationChanged(QNetworkConfigurationPrivate *ptr); - uint32_t getNetworkAttrs(bool is_iap_id, QString& iap_id, - QString& iap_type, QString security_method); - void configChanged(QNetworkConfigurationPrivate *ptr, bool added); - friend class QNetworkSessionPrivate; - -public slots: - void updateConfigurations(); - -Q_SIGNALS: - void configurationAdded(const QNetworkConfiguration& config); - void configurationRemoved(const QNetworkConfiguration& config); - void configurationUpdateComplete(); - void configurationChanged(const QNetworkConfiguration& config); - void onlineStateChanged(bool isOnline); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 1585be1..cf10677 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h deleted file mode 100644 index 3b43312..0000000 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONPRIVATE_H -#define QNETWORKCONFIGURATIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate : public QSharedData -{ -public: - QNetworkConfigurationPrivate () - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), - network_attrs(0), service_attrs(0), manager(0) - { - } - - ~QNetworkConfigurationPrivate() - { - //release pointers to member configurations - serviceNetworkMembers.clear(); - } - - QString name; - bool isValid; - QString id; - QNetworkConfiguration::StateFlags state; - QNetworkConfiguration::Type type; - bool roamingSupported; - QNetworkConfiguration::Purpose purpose; - - QList > serviceNetworkMembers; - QNetworkInterface serviceInterface; - - /* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */ - QByteArray network_id; /* typically WLAN ssid or similar */ - QString iap_type; /* is this one WLAN or GPRS */ - QString bearerName() const - { - if (iap_type == "WLAN_INFRA" || - iap_type == "WLAN_ADHOC") - return QString("WLAN"); - else if (iap_type == "GPRS") - return QString("HSPA"); - - //return whatever it is - //this may have to be split up later on - return iap_type; - } - - uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */ - - QString service_type; - QString service_id; - uint32_t service_attrs; - - QNetworkConfigurationManagerPrivate *manager; - -private: - - // disallow detaching - QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); - QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 40aea8b..6b40946 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index ba50ed6..f9bb9ea 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -45,12 +45,7 @@ #include "qnetworksession.h" #include "qbearerengine_p.h" #include "qnetworkconfigmanager_p.h" - -#if Q_WS_MAEMO_6 -#include "qnetworksession_maemo_p.h" -#else #include "qnetworksession_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp deleted file mode 100644 index 6fb4453..0000000 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ /dev/null @@ -1,1164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qnetworksession_maemo_p.h" -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static QHash properties; - -static QString get_network_interface(); -static DBusConnection *dbus_connection; -static DBusHandlerResult signal_handler(DBusConnection *connection, - DBusMessage *message, - void *user_data); - -#define ICD_DBUS_MATCH "type='signal'," \ - "interface='" ICD_DBUS_INTERFACE "'," \ - "path='" ICD_DBUS_PATH "'" - - -static inline DBusConnection *get_dbus_conn(DBusError *error) -{ - DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn); -#endif - - return conn; -} - - -/* Helper class that monitors the Icd status messages and - * can change the IAP status accordingly. This is a singleton. - */ -class IcdListener : public QObject -{ - Q_OBJECT - -public: - IcdListener() : first_call(true) { } - friend DBusHandlerResult signal_handler(DBusConnection *connection, - DBusMessage *message, - void *user_data); - void setup(QNetworkSessionPrivate *d); - void cleanup(); - void cleanupSession(QNetworkSessionPrivate *ptr); - - enum IapConnectionStatus { - /* The IAP was connected */ - CONNECTED = 0, - /* The IAP was disconnected */ - DISCONNECTED, - /* The IAP is disconnecting */ - DISCONNECTING, - /* The IAP has a network address, but is not yet fully connected */ - NETWORK_UP - }; - -private: - void icdSignalReceived(QString&, QString&, QString&); - bool first_call; - QHash sessions; -}; - -Q_GLOBAL_STATIC(IcdListener, icdListener); - - -static DBusHandlerResult signal_handler(DBusConnection *, - DBusMessage *message, - void *user_data) -{ - if (dbus_message_is_signal(message, - ICD_DBUS_INTERFACE, - ICD_STATUS_CHANGED_SIG)) { - - IcdListener *icd = (IcdListener *)user_data; - DBusError error; - dbus_error_init(&error); - - char *iap_id = 0; - char *network_type = 0; - char *state = 0; - - if (dbus_message_get_args(message, &error, - DBUS_TYPE_STRING, &iap_id, - DBUS_TYPE_STRING, &network_type, - DBUS_TYPE_STRING, &state, - DBUS_TYPE_INVALID) == FALSE) { - qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); - } else { - QString _iap_id(iap_id); - QString _network_type(network_type); - QString _state(state); - - icd->icdSignalReceived(_iap_id, _network_type, _state); - } - - dbus_error_free(&error); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - - -void IcdListener::setup(QNetworkSessionPrivate *d) -{ - if (first_call) { - // We use the old Icd dbus interface like in ConIC - DBusError error; - dbus_error_init(&error); - - dbus_connection = get_dbus_conn(&error); - if (dbus_error_is_set(&error)) { - qWarning() << "Cannot get dbus connection."; - dbus_error_free(&error); - return; - } - - static struct DBusObjectPathVTable icd_vtable; - icd_vtable.message_function = signal_handler; - - dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); - if (dbus_error_is_set(&error)) { - qWarning() << "Cannot add match" << ICD_DBUS_MATCH; - dbus_error_free(&error); - return; - } - - if (dbus_connection_register_object_path(dbus_connection, - ICD_DBUS_PATH, - &icd_vtable, - (void*)this) == FALSE) { - qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; - dbus_error_free(&error); - return; - } - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE; -#endif - first_call = false; - dbus_error_free(&error); - } - - QString id = d->activeConfig.identifier(); - if (!sessions.contains(id)) { - QNetworkSessionPrivate *ptr = d; - sessions.insert(id, ptr); - } -} - - -void IcdListener::icdSignalReceived(QString& iap_id, -#ifdef BEARER_MANAGEMENT_DEBUG - QString& network_type, -#else - QString&, -#endif - QString& state) -{ - if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore - return; - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state; -#endif - - if (!sessions.contains(iap_id)) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "No session for IAP" << iap_id; -#endif - return; - } - - QNetworkSessionPrivate *session = sessions.value(iap_id); - QNetworkConfiguration ap_conf = session->manager.configurationFromIdentifier(iap_id); - if (!ap_conf.isValid()) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Unknown IAP" << iap_id; -#endif - return; - } - - IapConnectionStatus status; - - if (state == "IDLE") { - status = DISCONNECTED; - } else if (state == "CONNECTED") { - status = CONNECTED; - } else if (state == "NETWORKUP") { - status = NETWORK_UP; - } else { - //qDebug() << "Unknown state" << state; - return; - } - - if (status == DISCONNECTED) { - if (ap_conf.state() == QNetworkConfiguration::Active) { - /* The IAP was just disconnected by Icd */ - session->updateState(QNetworkSession::Disconnected); - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Got a network disconnect when in state" << ap_conf.state(); -#endif - } - } else if (status == CONNECTED) { - /* The IAP was just connected by Icd */ - session->updateState(QNetworkSession::Connected); - session->updateIdentifier(iap_id); - - if (session->publicConfig.identifier() == OSSO_IAP_ANY) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY; -#endif - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "connected"; -#endif - } - } - - return; -} - - -void IcdListener::cleanup() -{ - if (!first_call) { - dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL); - dbus_connection_unref(dbus_connection); - } -} - - -void IcdListener::cleanupSession(QNetworkSessionPrivate *ptr) -{ - if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice) - (void)sessions.take(ptr->activeConfig.identifier()); - else - (void)sessions.take(ptr->publicConfig.identifier()); -} - - -void QNetworkSessionPrivate::cleanupSession(void) -{ - icdListener()->cleanupSession(this); -} - - -void QNetworkSessionPrivate::updateState(QNetworkSession::State newState) -{ - if( newState != state) { - state = newState; - - if (state == QNetworkSession::Disconnected) { - isOpen = false; - currentNetworkInterface.clear(); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - activeConfig.d->state = QNetworkConfiguration::Defined; - publicConfig.d->state = QNetworkConfiguration::Defined; - - } else if (state == QNetworkSession::Connected) { - isOpen = true; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - activeConfig.d->state = QNetworkConfiguration::Active; - activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; - } - publicConfig.d->state = QNetworkConfiguration::Active; - } - - emit q->stateChanged(newState); - } -} - - -void QNetworkSessionPrivate::updateIdentifier(QString &newId) -{ - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - activeConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - activeConfig.d->id = newId; - } else { - publicConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - if (publicConfig.d->id != newId) { - qWarning() << "Your config id changed from" << publicConfig.d->id << "to" << newId; - publicConfig.d->id = newId; - } - } -} - - -quint64 QNetworkSessionPrivate::getStatistics(bool sent) const -{ - /* This could be also implemented by using the Maemo::Icd::statistics() - * that gets the statistics data for a specific IAP. Change if - * necessary. - */ - Maemo::Icd icd; - QList stats_results; - quint64 counter_rx = 0, counter_tx = 0; - - if (!icd.statistics(stats_results)) { - return 0; - } - - foreach (Maemo::IcdStatisticsResult res, stats_results) { - if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { - /* network_id is the IAP UUID */ - if (QString(res.params.network_id.data()) == activeConfig.identifier()) { - counter_tx = res.bytes_sent; - counter_rx = res.bytes_received; - } - } else { - /* We probably will never get to this branch */ - QNetworkConfigurationPrivate *d = activeConfig.d.data(); - if (res.params.network_id == d->network_id) { - counter_tx = res.bytes_sent; - counter_rx = res.bytes_received; - } - } - } - - if (sent) - return counter_tx; - else - return counter_rx; -} - - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ - return getStatistics(true); -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ - return getStatistics(false); -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ - if (startTime.isNull()) { - return 0; - } - return startTime.secsTo(QDateTime::currentDateTime()); -} - - -QNetworkConfiguration& QNetworkSessionPrivate::copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy) -{ - if (deepCopy) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QExplicitlySharedDataPointer ptr(cpPriv); - toConfig.d = ptr; - } - - toConfig.d->name = fromConfig.d->name; - toConfig.d->isValid = fromConfig.d->isValid; - // Note that we do not copy id field here as the publicConfig does - // not contain a valid IAP id. - toConfig.d->state = fromConfig.d->state; - toConfig.d->type = fromConfig.d->type; - toConfig.d->roamingSupported = fromConfig.d->roamingSupported; - toConfig.d->purpose = fromConfig.d->purpose; - toConfig.d->network_id = fromConfig.d->network_id; - toConfig.d->iap_type = fromConfig.d->iap_type; - toConfig.d->network_attrs = fromConfig.d->network_attrs; - toConfig.d->service_type = fromConfig.d->service_type; - toConfig.d->service_id = fromConfig.d->service_id; - toConfig.d->service_attrs = fromConfig.d->service_attrs; - toConfig.d->manager = fromConfig.d->manager; - - return toConfig; -} - - -/* This is called by QNetworkSession constructor and it updates the current - * state of the configuration. - */ -void QNetworkSessionPrivate::syncStateWithInterface() -{ - /* Start to listen Icd status messages. */ - icdListener()->setup(this); - - /* Initially we are not active although the configuration might be in - * connected state. - */ - isOpen = false; - opened = false; - - QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); - - if (publicConfig.d.data()) { - QNetworkConfigurationManagerPrivate* mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager; - if (mgr) { - QObject::connect(mgr, SIGNAL(configurationChanged(QNetworkConfiguration)), - this, SLOT(configurationChanged(QNetworkConfiguration))); - } else { - qWarning()<<"Manager object not set when trying to connect configurationChanged signal. Your configuration object is not correctly setup, did you remember to call manager.updateConfigurations() before creating session object?"; - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - return; - } - } - - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - - switch (publicConfig.type()) { - case QNetworkConfiguration::InternetAccessPoint: - activeConfig = publicConfig; - break; - case QNetworkConfiguration::ServiceNetwork: - serviceConfig = publicConfig; - break; - case QNetworkConfiguration::UserChoice: - // active config will contain correct data after open() has succeeded - copyConfig(publicConfig, activeConfig); - - /* We create new configuration that holds the actual configuration - * returned by icd. This way publicConfig still contains the - * original user specified configuration. - * - * Note that the new activeConfig configuration is not inserted - * to configurationManager as manager class will get the newly - * connected configuration from gconf when the IAP is saved. - * This configuration manager update is done by IapMonitor class. - * If the ANY connection fails in open(), then the configuration - * data is not saved to gconf and will not be added to - * configuration manager IAP list. - */ -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug()<<"New configuration created for" << publicConfig.identifier(); -#endif - break; - default: - /* Invalid configuration, no point continuing */ - return; - } - - if (!activeConfig.isValid()) - return; - - /* Get the initial state from icd */ - Maemo::Icd icd; - QList state_results; - - /* Update the active config from first connection, this is ok as icd - * supports only one connection anyway. - */ - if (icd.state(state_results) && !state_results.isEmpty()) { - - /* If we did not get full state back, then we are not - * connected and can skip the next part. - */ - if (!(state_results.first().params.network_attrs == 0 && - state_results.first().params.network_id.isEmpty())) { - - /* If we try to connect to specific IAP and we get results back - * that tell the icd is actually connected to another IAP, - * then do not update current state etc. - */ - if (publicConfig.type() == QNetworkConfiguration::UserChoice || - publicConfig.d->id == state_results.first().params.network_id) { - - switch (state_results.first().state) { - case ICD_STATE_DISCONNECTED: - state = QNetworkSession::Disconnected; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - case ICD_STATE_CONNECTING: - state = QNetworkSession::Connecting; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - case ICD_STATE_CONNECTED: - { - if (!state_results.first().error.isEmpty()) - break; - - const QString id = state_results.first().params.network_id; - - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - if (mgr->accessPointConfigurations.contains(id)) { - //we don't want the copied data if the config is already known by the manager - //just reuse it so that existing references to the old data get the same update - QExplicitlySharedDataPointer priv = mgr->accessPointConfigurations.value(activeConfig.d->id); - activeConfig.d = priv; - } - - - state = QNetworkSession::Connected; - activeConfig.d->network_id = state_results.first().params.network_id; - activeConfig.d->id = activeConfig.d->network_id; - activeConfig.d->network_attrs = state_results.first().params.network_attrs; - activeConfig.d->iap_type = state_results.first().params.network_type; - activeConfig.d->service_type = state_results.first().params.service_type; - activeConfig.d->service_id = state_results.first().params.service_id; - activeConfig.d->service_attrs = state_results.first().params.service_attrs; - activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; - activeConfig.d->state = QNetworkConfiguration::Active; - activeConfig.d->isValid = true; - currentNetworkInterface = get_network_interface(); - - Maemo::IAPConf iap_name(activeConfig.d->id); - QString name_value = iap_name.value("name").toString(); - if (!name_value.isEmpty()) - activeConfig.d->name = name_value; - else - activeConfig.d->name = activeConfig.d->id; - - - // Add the new active configuration to manager or update the old config - mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - if (!(mgr->accessPointConfigurations.contains(activeConfig.d->id))) { - QExplicitlySharedDataPointer ptr = activeConfig.d; - mgr->accessPointConfigurations.insert(activeConfig.d->id, ptr); - - QNetworkConfiguration item; - item.d = ptr; - emit mgr->configurationAdded(item); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"New configuration"<id<<"added to manager in sync"; -#endif - - } else { - mgr->configurationChanged((QNetworkConfigurationPrivate*)(activeConfig.d.data())); -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"Existing configuration"<id<<"updated in manager in sync"; -#endif - } - - } - break; - - case ICD_STATE_DISCONNECTING: - state = QNetworkSession::Closing; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - default: - break; - } - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "status_req tells icd is not connected"; -#endif - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "status_req did not return any results from icd"; -#endif - } - - networkConfigurationsChanged(); -} - - -void QNetworkSessionPrivate::networkConfigurationsChanged() -{ - if (serviceConfig.isValid()) - updateStateFromServiceNetwork(); - else - updateStateFromActiveConfig(); -} - - -void QNetworkSessionPrivate::updateStateFromServiceNetwork() -{ - QNetworkSession::State oldState = state; - - foreach (const QNetworkConfiguration &config, serviceConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) - continue; - - if (activeConfig != config) { - activeConfig = config; - emit q->newConfigurationActivated(); - } - - state = QNetworkSession::Connected; - if (state != oldState) - emit q->stateChanged(state); - - return; - } - - if (serviceConfig.children().isEmpty()) - state = QNetworkSession::NotAvailable; - else - state = QNetworkSession::Disconnected; - - if (state != oldState) - emit q->stateChanged(state); -} - - -void QNetworkSessionPrivate::clearConfiguration(QNetworkConfiguration &config) -{ - config.d->network_id.clear(); - config.d->iap_type.clear(); - config.d->network_attrs = 0; - config.d->service_type.clear(); - config.d->service_id.clear(); - config.d->service_attrs = 0; -} - - -void QNetworkSessionPrivate::updateStateFromActiveConfig() -{ - QNetworkSession::State oldState = state; - - bool newActive = false; - - if (!activeConfig.d.data()) - return; - - if (!activeConfig.isValid()) { - state = QNetworkSession::Invalid; - clearConfiguration(activeConfig); - } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Connected; - newActive = opened; - } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Disconnected; - } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { - state = QNetworkSession::NotAvailable; - } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { - state = QNetworkSession::NotAvailable; - clearConfiguration(activeConfig); - } - - bool oldActive = isOpen; - isOpen = newActive; - - if (!oldActive && isOpen) - emit quitPendingWaitsForOpened(); - - if (oldActive && !isOpen) - emit q->closed(); - - if (oldState != state) { - emit q->stateChanged(state); - - if (state == QNetworkSession::Disconnected) { -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"session aborted error emitted for"<error(lastError); - } - } - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"oldState ="<ifa_next) { - family = ifa->ifa_addr->sa_family; - if (family != AF_INET) { - continue; /* Currently only IPv4 is supported by icd dbus interface */ - } - if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) { - iface = QString(ifa->ifa_name); - break; - } - } - - freeifaddrs(ifaddr); - return iface; -} - - -void QNetworkSessionPrivate::open() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (!isOpen) { - - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - /* Caller is trying to connect to default IAP. - * At this time we will not know the IAP details so we just - * connect and update the active config when the IAP is - * connected. - */ - opened = true; - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - QTimer::singleShot(0, this, SLOT(do_open())); - return; - } - - /* User is connecting to one specific IAP. If that IAP is not - * in discovered state we cannot continue. - */ - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; - emit q->error(lastError); - return; - } - opened = true; - - if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - - QTimer::singleShot(0, this, SLOT(do_open())); - return; - } - - isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isOpen) - emit quitPendingWaitsForOpened(); - } else { - /* We seem to be active so inform caller */ - emit quitPendingWaitsForOpened(); - } -} - - -void QNetworkSessionPrivate::do_open() -{ - icd_connection_flags flags = connectFlags; - bool st; - QString result; - QString iap = publicConfig.identifier(); - - if (state == QNetworkSession::Connected) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Already connected to" << activeConfig.identifier(); -#endif - emit q->stateChanged(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - return; - } - - Maemo::IcdConnectResult connect_result; - Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - config = activeConfig; - else - config = publicConfig; - - if (iap == OSSO_IAP_ANY) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connecting to default IAP" << iap; -#endif - st = icd.connect(flags, connect_result); - - } else { - - QList params; - Maemo::ConnectParams param; - param.connect.service_type = config.d->service_type; - param.connect.service_attrs = config.d->service_attrs; - param.connect.service_id = config.d->service_id; - param.connect.network_type = config.d->iap_type; - param.connect.network_attrs = config.d->network_attrs; - if (config.d->network_attrs & ICD_NW_ATTR_IAPNAME) - param.connect.network_id = QByteArray(iap.toLatin1()); - else - param.connect.network_id = config.d->network_id; - params.append(param); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", - param.connect.network_id.data(), - param.connect.network_type.toAscii().constData(), - param.connect.network_attrs, - param.connect.service_type.toAscii().constData(), - param.connect.service_attrs, - param.connect.service_id.toAscii().constData()); -#endif - st = icd.connect(flags, params, connect_result); - } - - if (st) { - result = connect_result.connect.network_id.data(); - QString connected_iap = result; - - if (connected_iap.isEmpty()) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connect to"<< iap << "failed, result is empty"; -#endif - updateState(QNetworkSession::Disconnected); - emit quitPendingWaitsForOpened(); - emit q->error(QNetworkSession::InvalidConfigurationError); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - cleanupAnyConfiguration(); - return; - } - - /* If the user tried to connect to some specific connection (foo) - * and we were already connected to some other connection (bar), - * then we cannot activate this session although icd has a valid - * connection to somewhere. - */ - if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && - (connected_iap != config.identifier())) { - updateState(QNetworkSession::Disconnected); - emit quitPendingWaitsForOpened(); - emit q->error(QNetworkSession::InvalidConfigurationError); - return; - } - - - /* Did we connect to non saved IAP? */ - if (!(config.d->network_attrs & ICD_NW_ATTR_IAPNAME)) { - /* Because the connection succeeded, the IAP is now known. - */ - config.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - config.d->id = connected_iap; - } - - /* User might have changed the IAP name when a new IAP was saved */ - Maemo::IAPConf iap_name(config.d->id); - QString name = iap_name.value("name").toString(); - if (!name.isEmpty()) - config.d->name = name; - - config.d->iap_type = connect_result.connect.network_type; - - config.d->isValid = true; - config.d->state = QNetworkConfiguration::Active; - config.d->type = QNetworkConfiguration::InternetAccessPoint; - - startTime = QDateTime::currentDateTime(); - updateState(QNetworkSession::Connected); - - currentNetworkInterface = get_network_interface(); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connected to" << result << config.d->name << "at" << currentNetworkInterface; -#endif - - /* We first check if the configuration already exists in the manager - * and if it is not found there, we then insert it. Note that this - * is only done for user choice config only because it can be missing - * from config manager list. - */ - - if (publicConfig.d->type == QNetworkConfiguration::UserChoice) { - -#ifdef BEARER_MANAGEMENT_DEBUG -#if 0 - QList configs; - QNetworkConfigurationManagerPrivate *conPriv = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - configs << pt; - } - - int all = configs.count(); - qDebug() << "All configurations:" << all; - foreach(QNetworkConfiguration p, configs) { - qDebug() << p.name() <<": isvalid->" <"<< p.type() << - " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << - " purpose->" << p.purpose() << " state->" << p.state(); - } -#endif -#endif - - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; - if (!mgr->accessPointConfigurations.contains(result)) { - QExplicitlySharedDataPointer ptr = config.d; - mgr->accessPointConfigurations.insert(result, ptr); - - QNetworkConfiguration item; - item.d = ptr; - emit mgr->configurationAdded(item); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"New configuration"< priv = mgr->accessPointConfigurations.value(result); - QNetworkConfiguration reference; - reference.d = priv; - copyConfig(config, reference, false); - config = reference; - activeConfig = reference; - mgr->configurationChanged((QNetworkConfigurationPrivate*)(config.d.data())); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"Existing configuration"<error(QNetworkSession::UnknownSessionError); - } -} - - -void QNetworkSessionPrivate::cleanupAnyConfiguration() -{ -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug()<<"Removing configuration created for" << activeConfig.d->id; -#endif - activeConfig = publicConfig; -} - - -void QNetworkSessionPrivate::close() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (isOpen) { - opened = false; - isOpen = false; - emit q->closed(); - } -} - - -void QNetworkSessionPrivate::stop() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else { - if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Closing; - emit q->stateChanged(state); - - Maemo::Icd icd; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "stopping session" << publicConfig.identifier(); -#endif - icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); - startTime = QDateTime(); - - /* Note that the state will go disconnected in - * updateStateFromActiveConfig() which gets called after - * configurationChanged is emitted (below). - */ - - activeConfig.d->state = QNetworkConfiguration::Discovered; - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data()); - - opened = false; - isOpen = false; - - } else { - opened = false; - isOpen = false; - emit q->closed(); - } - } -} - - -void QNetworkSessionPrivate::migrate() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::accept() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::ignore() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::reject() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || state != QNetworkSession::Connected) - return QNetworkInterface(); - - if (currentNetworkInterface.isEmpty()) - return QNetworkInterface(); - - return QNetworkInterface::interfaceFromName(currentNetworkInterface); -} - - -void QNetworkSessionPrivate::setSessionProperty(const QString& key, const QVariant& value) -{ - if (value.isValid()) { - properties.insert(key, value); - - if (key == "ConnectInBackground") { - bool v = value.toBool(); - if (v) - connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT; - else - connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; - } - } else { - properties.remove(key); - - /* Set default value when property is removed */ - if (key == "ConnectInBackground") - connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; - } -} - - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const -{ - return properties.value(key); -} - - -QString QNetworkSessionPrivate::errorString() const -{ - QString errorStr; - switch(q->error()) { - case QNetworkSession::RoamingError: - errorStr = QObject::tr("Roaming error"); - break; - case QNetworkSession::SessionAbortedError: - errorStr = QObject::tr("Session aborted by user or system"); - break; - default: - case QNetworkSession::UnknownSessionError: - errorStr = QObject::tr("Unidentified Error"); - break; - } - return errorStr; -} - - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return QNetworkSession::UnknownSessionError; -} - -#include "qnetworksession_maemo.moc" -#include "moc_qnetworksession_maemo_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h deleted file mode 100644 index ff294f6..0000000 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONPRIVATE_H -#define QNETWORKSESSIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// -#include "qnetworkconfigmanager_maemo_p.h" -#include "qnetworksession.h" - -#include -#include -#include - -#ifdef Q_WS_MAEMO_6 -#include -#endif - -QT_BEGIN_NAMESPACE - -class QNetworkSessionPrivate : public QObject -{ - Q_OBJECT -public: - QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), -#ifdef Q_WS_MAEMO_6 - connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) -#else - connectFlags(0) -#endif - { - } - - ~QNetworkSessionPrivate() - { - cleanupSession(); - } - - //called by QNetworkSession constructor and ensures - //that the state is immediately updated (w/o actually opening - //a session). Also this function should take care of - //notification hooks to discover future state changes. - void syncStateWithInterface(); - - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - - void open(); - void close(); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); - - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; - - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; - -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); - -Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - -private Q_SLOTS: - void do_open(); - void networkConfigurationsChanged(); - void configurationChanged(const QNetworkConfiguration &config); - -private: - QNetworkConfigurationManager manager; - - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; - - // The config set on QNetworkSession. - QNetworkConfiguration publicConfig; - - // If publicConfig is a ServiceNetwork this is a copy of publicConfig. - // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual - // ServiceNetwork configuration. - QNetworkConfiguration serviceConfig; - - // This is the actual active configuration currently in use by the session. - // Either a copy of publicConfig or one of serviceConfig.children(). - QNetworkConfiguration activeConfig; - - QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); - void clearConfiguration(QNetworkConfiguration &config); - void cleanupAnyConfiguration(); - - QNetworkSession::State state; - bool isOpen; - bool opened; - icd_connection_flags connectFlags; - - QNetworkSession::SessionError lastError; - - QNetworkSession* q; - friend class QNetworkSession; - - QDateTime startTime; - QString currentNetworkInterface; - friend class IcdListener; - void updateState(QNetworkSession::State); - void updateIdentifier(QString &newId); - quint64 getStatistics(bool sent) const; - void cleanupSession(void); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKSESSIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a6bb7cb..76691b3 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -109,6 +109,12 @@ protected: return config.d; } + inline void setPrivateConfiguration(QNetworkConfiguration &config, + QNetworkConfigurationPrivatePointer ptr) const + { + config.d = ptr; + } + Q_SIGNALS: //releases any pending waitForOpened() calls void quitPendingWaitsForOpened(); diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 7347735..95c9851 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -5,5 +5,6 @@ win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan symbian:SUBDIRS += symbian +maemo6:contains(QT_CONFIG, dbus):SUBDIRS += icd isEmpty(SUBDIRS):SUBDIRS += generic diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro new file mode 100644 index 0000000..5eaf5af --- /dev/null +++ b/src/plugins/bearer/icd/icd.pro @@ -0,0 +1,22 @@ +TARGET = qicdbearer +include(../../qpluginbase.pri) + +QT += network dbus + +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + +HEADERS += qicdengine.h \ + monitor.h \ + qnetworksession_impl.h + +SOURCES += main.cpp \ + qicdengine.cpp \ + monitor.cpp \ + qnetworksession_impl.cpp + +#DEFINES += BEARER_MANAGEMENT_DEBUG + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp new file mode 100644 index 0000000..8984d2c --- /dev/null +++ b/src/plugins/bearer/icd/main.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qicdengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QIcdEnginePlugin : public QBearerEnginePlugin +{ +public: + QIcdEnginePlugin(); + ~QIcdEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QIcdEnginePlugin::QIcdEnginePlugin() +{ +} + +QIcdEnginePlugin::~QIcdEnginePlugin() +{ +} + +QStringList QIcdEnginePlugin::keys() const +{ + return QStringList() << QLatin1String("icd"); +} + +QBearerEngine *QIcdEnginePlugin::create(const QString &key) const +{ + if (key == QLatin1String("icd")) + return new QIcdEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QIcdEnginePlugin) +Q_EXPORT_PLUGIN2(qicdbearer, QIcdEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/monitor.cpp b/src/plugins/bearer/icd/monitor.cpp new file mode 100644 index 0000000..0ff45d2 --- /dev/null +++ b/src/plugins/bearer/icd/monitor.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "monitor.h" +#include "qicdengine.h" + +#include +#include +#include +#include + +#define IAP "/system/osso/connectivity/IAP" + +static int iap_prefix_len; + +/* Notify func that is called when IAP is added or deleted */ +void notify_iap(GConfClient *, guint, GConfEntry *entry, gpointer user_data) +{ + const char *key = gconf_entry_get_key(entry); + if (key && g_str_has_prefix(key, IAP)) { + IapMonitor *ptr = (IapMonitor *)user_data; + if (gconf_entry_get_value(entry)) { + ptr->iapAdded(key, entry); + } else { + ptr->iapDeleted(key, entry); + } + } +} + + +void IapMonitor::setup(QIcdEngine *d_ptr) +{ + if (first_call) { + d = d_ptr; + iap_prefix_len = strlen(IAP); + iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this); + first_call = false; + } +} + + +void IapMonitor::cleanup() +{ + if (!first_call) { + delete iap; + timers.removeAll(); + first_call = true; + } +} + + +void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for added element: %s=%s", + // gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry))); + + /* We cannot know when the IAP is fully added to gconf, so a timer is + * installed instead. When the timer expires we hope that IAP is added ok. + */ + QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0); + timers.add(iap_id, d); +} + + +void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry)); + + /* We are only interested in IAP deletions so we skip the config entries + */ + if (strstr(key + iap_prefix_len + 1, "/")) { + //qDebug("Deleting IAP config %s", key+iap_prefix_len); + return; + } + + QString iap_id = key + iap_prefix_len + 1; + d->deleteConfiguration(iap_id); +} diff --git a/src/plugins/bearer/icd/monitor.h b/src/plugins/bearer/icd/monitor.h new file mode 100644 index 0000000..82b0f36 --- /dev/null +++ b/src/plugins/bearer/icd/monitor.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MONITOR_H +#define MONITOR_H + +#include +#include + +#include +#include + +#include + +class QIcdEngine; + +/* The IapAddTimer is a helper class that makes sure we update + * the configuration only after all gconf additions to certain + * iap are finished (after a certain timeout) + */ +class _IapAddTimer : public QObject +{ + Q_OBJECT + +public: + _IapAddTimer() {} + ~_IapAddTimer() + { + if (timer.isActive()) { + QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer.stop(); + } + } + + void add(QString& iap_id, QIcdEngine *d); + + QString iap_id; + QTimer timer; + QIcdEngine *d; + +public Q_SLOTS: + void timeout(); +}; + +class IapAddTimer { + QHash timers; + +public: + IapAddTimer() {} + ~IapAddTimer() {} + + void add(QString& iap_id, QIcdEngine *d); + void del(QString& iap_id); + void removeAll(); +}; + +class IapMonitor +{ +public: + IapMonitor() : first_call(true) { } + friend void notify_iap(GConfClient *, guint, + GConfEntry *entry, gpointer user_data); + + void setup(QIcdEngine *d); + void cleanup(); + +private: + bool first_call; + + void iapAdded(const char *key, GConfEntry *entry); + void iapDeleted(const char *key, GConfEntry *entry); + + Maemo::IAPMonitor *iap; + QIcdEngine *d; + IapAddTimer timers; +}; + +#endif // MONITOR_H diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp new file mode 100644 index 0000000..3233eda --- /dev/null +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -0,0 +1,416 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qicdengine.h" +#include "monitor.h" +#include "qnetworksession_impl.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate() +: network_attrs(0), service_attrs(0) +{ +} + +IcdNetworkConfigurationPrivate::~IcdNetworkConfigurationPrivate() +{ +} + +QString IcdNetworkConfigurationPrivate::bearerName() const +{ + if (iap_type == QLatin1String("WLAN_INFRA") || + iap_type == QLatin1String("WLAN_ADHOC")) { + return QLatin1String("WLAN"); + } else if (iap_type == QLatin1String("GPRS")) { + return QLatin1String("HSPA"); + } else { + return iap_type; + } +} + +static inline QString network_attrs_to_security(uint network_attrs) +{ + uint cap = 0; + nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */ + if (cap & WLANCOND_OPEN) + return "NONE"; + else if (cap & WLANCOND_WEP) + return "WEP"; + else if (cap & WLANCOND_WPA_PSK) + return "WPA_PSK"; + else if (cap & WLANCOND_WPA_EAP) + return "WPA_EAP"; + return ""; +} + +QIcdEngine::QIcdEngine(QObject *parent) +: QBearerEngine(parent), iapMonitor(new IapMonitor) +{ + /* Turn on IAP monitoring */ + iapMonitor->setup(this); + + doRequestUpdate(); +} + +QIcdEngine::~QIcdEngine() +{ +} + +bool QIcdEngine::hasIdentifier(const QString &id) +{ + return accessPointConfigurations.contains(id) || + snapConfigurations.contains(id) || + userChoiceConfigurations.contains(id); +} + +void QIcdEngine::requestUpdate() +{ + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +static uint32_t getNetworkAttrs(bool is_iap_id, + QString& iap_id, + QString& iap_type, + QString security_method) +{ + guint network_attr = 0; + dbus_uint32_t cap = 0; + + if (iap_type == "WLAN_INFRA") + cap |= WLANCOND_INFRA; + else if (iap_type == "WLAN_ADHOC") + cap |= WLANCOND_ADHOC; + + if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) { + Maemo::IAPConf saved_ap(iap_id); + security_method = saved_ap.value("wlan_security").toString(); + } + + if (!security_method.isEmpty()) { + if (security_method == "WEP") + cap |= WLANCOND_WEP; + else if (security_method == "WPA_PSK") + cap |= WLANCOND_WPA_PSK; + else if (security_method == "WPA_EAP") + cap |= WLANCOND_WPA_EAP; + else if (security_method == "NONE") + cap |= WLANCOND_OPEN; + + if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) { + Maemo::IAPConf saved_iap(iap_id); + bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool(); + if (wpa2_only) { + cap |= WLANCOND_WPA2; + } + } + } + + cap2nwattr(cap, &network_attr); + if (is_iap_id) + network_attr |= ICD_NW_ATTR_IAPNAME; + + return (uint32_t)network_attr; +} + +void QIcdEngine::doRequestUpdate() +{ + QStringList previous = accessPointConfigurations.keys(); + + /* All the scanned access points */ + QList scanned; + + /* We create a default configuration which is a pseudo config */ + if (!userChoiceConfigurations.contains(OSSO_IAP_ANY)) { + QNetworkConfigurationPrivatePointer ptr(new IcdNetworkConfigurationPrivate); + + ptr->name = QLatin1String("UserChoice"); + ptr->state = QNetworkConfiguration::Discovered; + ptr->isValid = true; + ptr->id = OSSO_IAP_ANY; + ptr->type = QNetworkConfiguration::UserChoice; + ptr->purpose = QNetworkConfiguration::UnknownPurpose; + ptr->roamingSupported = false; + + userChoiceConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + + /* We return currently configured IAPs in the first run and do the WLAN + * scan in subsequent runs. + */ + QList all_iaps; + Maemo::IAPConf::getAll(all_iaps); + + foreach (QString escaped_iap_id, all_iaps) { + QByteArray ssid; + + /* The key that is returned by getAll() needs to be unescaped */ + gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1); + QString iap_id = QString((char *)unescaped_id); + g_free(unescaped_id); + + previous.removeAll(iap_id); + + Maemo::IAPConf saved_ap(iap_id); + bool is_temporary = saved_ap.value("temporary").toBool(); + if (is_temporary) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "is temporary, skipping it."; +#endif + continue; + } + + QString iap_type = saved_ap.value("type").toString(); + if (iap_type.startsWith("WLAN")) { + ssid = saved_ap.value("wlan_ssid").toByteArray(); + if (ssid.isEmpty()) { + qWarning() << "Cannot get ssid for" << iap_id; + continue; + } + + QString security_method = saved_ap.value("wlan_security").toString(); + } else if (iap_type.isEmpty()) { + qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; + continue; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "network type is" << iap_type; +#endif + ssid.clear(); + } + + if (!accessPointConfigurations.contains(iap_id)) { + IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate; + + cpPriv->name = saved_ap.value("name").toString(); + if (cpPriv->name.isEmpty()) + if (!ssid.isEmpty() && ssid.size() > 0) + cpPriv->name = ssid.data(); + else + cpPriv->name = iap_id; + cpPriv->isValid = true; + cpPriv->id = iap_id; + cpPriv->network_id = ssid; + cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); + cpPriv->iap_type = iap_type; + cpPriv->service_id = saved_ap.value("service_id").toString(); + cpPriv->service_type = saved_ap.value("service_type").toString(); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Defined; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(iap_id, ptr); + emit configurationAdded(ptr); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, name: %s, ssid: %s, added to known list", + iap_id.toAscii().data(), ptr->name.toAscii().data(), + !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, already exists in the known list", + iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } + } + + if (sender()) { + QStringList scannedNetworkTypes; + QStringList networkTypesToScan; + QString error; + Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); + + scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, + networkTypesToScan, + scanned, + error); + if (!error.isEmpty()) { + qWarning() << "Network scanning failed" << error; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + if (!scanned.isEmpty()) + qDebug() << "Scan returned" << scanned.size() << "networks"; + else + qDebug() << "Scan returned nothing."; +#endif + } + } + + /* This is skipped in the first update as scanned size is zero */ + if (!scanned.isEmpty()) { + for (int i=0; iisValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->state != QNetworkConfiguration::Discovered) { + ptr->state = QNetworkConfiguration::Discovered; + changed = true; + } + + toIcdConfig(ptr)->network_attrs = ap.scan.network_attrs; + toIcdConfig(ptr)->service_id = ap.scan.service_id; + toIcdConfig(ptr)->service_type = ap.scan.service_type; + toIcdConfig(ptr)->service_attrs = ap.scan.service_attrs; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, discovered", + iapid.toAscii().data(), scanned_ssid.data()); +#endif + + if (changed) + emit configurationChanged(ptr); + + if (!ap.scan.network_type.startsWith("WLAN")) + continue; // not a wlan AP + } + } else { + IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate; + + QString hrs = scanned_ssid.data(); + + cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name; + cpPriv->isValid = true; + // Note: id is now ssid, it should be set to IAP id if the IAP is saved + cpPriv->id = scanned_ssid.data(); + cpPriv->network_id = scanned_ssid; + cpPriv->iap_type = ap.scan.network_type; + if (cpPriv->iap_type.isEmpty()) + cpPriv->iap_type = QLatin1String("WLAN"); + cpPriv->network_attrs = ap.scan.network_attrs; + cpPriv->service_id = ap.scan.service_id; + cpPriv->service_type = ap.scan.service_type; + cpPriv->service_attrs = ap.scan.service_attrs; + + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan."; +#endif + + previous.removeAll(cpPriv->id); + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } + + if (sender()) + emit updateCompleted(); +} + +void QIcdEngine::deleteConfiguration(const QString &iap_id) +{ + /* Called when IAPs are deleted in gconf, in this case we do not scan + * or read all the IAPs from gconf because it might take too much power + * (multiple applications would need to scan and read all IAPs from gconf) + */ + if (accessPointConfigurations.contains(iap_id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id); + + if (ptr) { + ptr->isValid = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "was removed from storage."; +#endif + + emit configurationRemoved(ptr); + } else { + qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); +#endif + } +} + +QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const +{ + return QNetworkConfigurationManager::CanStartAndStopInterfaces | + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::ForcedRoaming; +} + +QNetworkSessionPrivate *QIcdEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl(this); +} + +QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() +{ + // Here we just return [ANY] request to icd and let the icd decide which IAP to connect. + return userChoiceConfigurations.value(OSSO_IAP_ANY); +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h new file mode 100644 index 0000000..30b5711 --- /dev/null +++ b/src/plugins/bearer/icd/qicdengine.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QICDENGINE_H +#define QICDENGINE_H + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class IapMonitor; + +class IcdNetworkConfigurationPrivate : public QNetworkConfigurationPrivate +{ +public: + IcdNetworkConfigurationPrivate(); + ~IcdNetworkConfigurationPrivate(); + + QString bearerName() const; + + // In Maemo the id field (defined in QNetworkConfigurationPrivate) + // is the IAP id (which typically is UUID) + QByteArray network_id; // typically WLAN ssid or similar + QString iap_type; // is this one WLAN or GPRS + + // Network attributes for this IAP, this is the value returned by icd and + // passed to it when connecting. + uint32_t network_attrs; + + QString service_type; + QString service_id; + uint32_t service_attrs; +}; + +inline IcdNetworkConfigurationPrivate *toIcdConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + +class QIcdEngine : public QBearerEngine +{ + Q_OBJECT + + friend class QNetworkSessionPrivateImpl; + +public: + QIcdEngine(QObject *parent = 0); + ~QIcdEngine(); + + bool hasIdentifier(const QString &id); + + void requestUpdate(); + + QNetworkConfigurationManager::Capabilities capabilities() const; + + QNetworkSessionPrivate *createSessionBackend(); + + QNetworkConfigurationPrivatePointer defaultConfiguration(); + + void deleteConfiguration(const QString &iap_id); + +private: + inline void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) + { + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + + inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) + { + emit configurationChanged(ptr); + } + +private Q_SLOTS: + void doRequestUpdate(); + +private: + IapMonitor *iapMonitor; +}; + +QT_END_NAMESPACE + +#endif // QICDENGINE_H diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp new file mode 100644 index 0000000..6cc4a1d --- /dev/null +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -0,0 +1,1105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworksession_impl.h" +#include "qicdengine.h" + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static QHash properties; + +static QString get_network_interface(); +static DBusConnection *dbus_connection; +static DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + +#define ICD_DBUS_MATCH "type='signal'," \ + "interface='" ICD_DBUS_INTERFACE "'," \ + "path='" ICD_DBUS_PATH "'" + + +static inline DBusConnection *get_dbus_conn(DBusError *error) +{ + DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn); +#endif + + return conn; +} + + +/* Helper class that monitors the Icd status messages and + * can change the IAP status accordingly. This is a singleton. + */ +class IcdListener : public QObject +{ + Q_OBJECT + +public: + IcdListener() : first_call(true) { } + friend DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + void setup(QNetworkSessionPrivateImpl *d); + void cleanup(); + void cleanupSession(QNetworkSessionPrivateImpl *ptr); + + enum IapConnectionStatus { + /* The IAP was connected */ + CONNECTED = 0, + /* The IAP was disconnected */ + DISCONNECTED, + /* The IAP is disconnecting */ + DISCONNECTING, + /* The IAP has a network address, but is not yet fully connected */ + NETWORK_UP + }; + +private: + void icdSignalReceived(QString&, QString&, QString&); + bool first_call; + QHash sessions; +}; + +Q_GLOBAL_STATIC(IcdListener, icdListener); + + +static DBusHandlerResult signal_handler(DBusConnection *, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal(message, + ICD_DBUS_INTERFACE, + ICD_STATUS_CHANGED_SIG)) { + + IcdListener *icd = (IcdListener *)user_data; + DBusError error; + dbus_error_init(&error); + + char *iap_id = 0; + char *network_type = 0; + char *state = 0; + + if (dbus_message_get_args(message, &error, + DBUS_TYPE_STRING, &iap_id, + DBUS_TYPE_STRING, &network_type, + DBUS_TYPE_STRING, &state, + DBUS_TYPE_INVALID) == FALSE) { + qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); + } else { + QString _iap_id(iap_id); + QString _network_type(network_type); + QString _state(state); + + icd->icdSignalReceived(_iap_id, _network_type, _state); + } + + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + + +void IcdListener::setup(QNetworkSessionPrivateImpl *d) +{ + if (first_call) { + // We use the old Icd dbus interface like in ConIC + DBusError error; + dbus_error_init(&error); + + dbus_connection = get_dbus_conn(&error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot get dbus connection."; + dbus_error_free(&error); + return; + } + + static struct DBusObjectPathVTable icd_vtable; + icd_vtable.message_function = signal_handler; + + dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot add match" << ICD_DBUS_MATCH; + dbus_error_free(&error); + return; + } + + if (dbus_connection_register_object_path(dbus_connection, + ICD_DBUS_PATH, + &icd_vtable, + (void*)this) == FALSE) { + qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; + dbus_error_free(&error); + return; + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE; +#endif + first_call = false; + dbus_error_free(&error); + } + + QString id = d->activeConfig.identifier(); + if (!sessions.contains(id)) { + QNetworkSessionPrivateImpl *ptr = d; + sessions.insert(id, ptr); + } +} + + +void IcdListener::icdSignalReceived(QString& iap_id, +#ifdef BEARER_MANAGEMENT_DEBUG + QString& network_type, +#else + QString&, +#endif + QString& state) +{ + if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore + return; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state; +#endif + + if (!sessions.contains(iap_id)) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "No session for IAP" << iap_id; +#endif + return; + } + + QNetworkSessionPrivateImpl *session = sessions.value(iap_id); + QNetworkConfiguration ap_conf = + QNetworkConfigurationManager().configurationFromIdentifier(iap_id); + if (!ap_conf.isValid()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Unknown IAP" << iap_id; +#endif + return; + } + + IapConnectionStatus status; + + if (state == "IDLE") { + status = DISCONNECTED; + } else if (state == "CONNECTED") { + status = CONNECTED; + } else if (state == "NETWORKUP") { + status = NETWORK_UP; + } else { + //qDebug() << "Unknown state" << state; + return; + } + + if (status == DISCONNECTED) { + if (ap_conf.state() == QNetworkConfiguration::Active) { + /* The IAP was just disconnected by Icd */ + session->updateState(QNetworkSession::Disconnected); + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Got a network disconnect when in state" << ap_conf.state(); +#endif + } + } else if (status == CONNECTED) { + /* The IAP was just connected by Icd */ + session->updateState(QNetworkSession::Connected); + session->updateIdentifier(iap_id); + + if (session->publicConfig.identifier() == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY; +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected"; +#endif + } + } + + return; +} + + +void IcdListener::cleanup() +{ + if (!first_call) { + dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL); + dbus_connection_unref(dbus_connection); + } +} + + +void IcdListener::cleanupSession(QNetworkSessionPrivateImpl *ptr) +{ + if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice) + (void)sessions.take(ptr->activeConfig.identifier()); + else + (void)sessions.take(ptr->publicConfig.identifier()); +} + + +void QNetworkSessionPrivateImpl::cleanupSession(void) +{ + icdListener()->cleanupSession(this); +} + + +void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState) +{ + if (newState == state) + return; + + state = newState; + + if (state == QNetworkSession::Disconnected) { + isOpen = false; + currentNetworkInterface.clear(); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Defined; + privateConfiguration(publicConfig)->state = QNetworkConfiguration::Defined; + + } else if (state == QNetworkSession::Connected) { + isOpen = true; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Active; + privateConfiguration(activeConfig)->type = QNetworkConfiguration::InternetAccessPoint; + } + privateConfiguration(publicConfig)->state = QNetworkConfiguration::Active; + } + + emit stateChanged(newState); +} + + +void QNetworkSessionPrivateImpl::updateIdentifier(QString &newId) +{ + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + toIcdConfig(privateConfiguration(activeConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME; + privateConfiguration(activeConfig)->id = newId; + } else { + toIcdConfig(privateConfiguration(publicConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME; + if (privateConfiguration(publicConfig)->id != newId) { + qWarning() << "Your config id changed from" << privateConfiguration(publicConfig)->id + << "to" << newId; + privateConfiguration(publicConfig)->id = newId; + } + } +} + + +quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const +{ + /* This could be also implemented by using the Maemo::Icd::statistics() + * that gets the statistics data for a specific IAP. Change if + * necessary. + */ + Maemo::Icd icd; + QList stats_results; + quint64 counter_rx = 0, counter_tx = 0; + + if (!icd.statistics(stats_results)) { + return 0; + } + + foreach (Maemo::IcdStatisticsResult res, stats_results) { + if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { + /* network_id is the IAP UUID */ + if (QString(res.params.network_id.data()) == activeConfig.identifier()) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } else { + /* We probably will never get to this branch */ + if (res.params.network_id == toIcdConfig(privateConfiguration(activeConfig))->network_id) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } + } + + if (sent) + return counter_tx; + else + return counter_rx; +} + + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ + return getStatistics(true); +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ + return getStatistics(false); +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ + if (startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + + +QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfiguration &fromConfig, + QNetworkConfiguration &toConfig, + bool deepCopy) +{ + IcdNetworkConfigurationPrivate *cpPriv; + if (deepCopy) { + cpPriv = new IcdNetworkConfigurationPrivate; + setPrivateConfiguration(toConfig, QNetworkConfigurationPrivatePointer(cpPriv)); + } else { + cpPriv = toIcdConfig(privateConfiguration(toConfig)); + } + + cpPriv->name = privateConfiguration(fromConfig)->name; + cpPriv->isValid = privateConfiguration(fromConfig)->isValid; + // Note that we do not copy id field here as the publicConfig does + // not contain a valid IAP id. + cpPriv->state = privateConfiguration(fromConfig)->state; + cpPriv->type = privateConfiguration(fromConfig)->type; + cpPriv->roamingSupported = privateConfiguration(fromConfig)->roamingSupported; + cpPriv->purpose = privateConfiguration(fromConfig)->purpose; + cpPriv->network_id = toIcdConfig(privateConfiguration(fromConfig))->network_id; + cpPriv->iap_type = toIcdConfig(privateConfiguration(fromConfig))->iap_type; + cpPriv->network_attrs = toIcdConfig(privateConfiguration(fromConfig))->network_attrs; + cpPriv->service_type = toIcdConfig(privateConfiguration(fromConfig))->service_type; + cpPriv->service_id = toIcdConfig(privateConfiguration(fromConfig))->service_id; + cpPriv->service_attrs = toIcdConfig(privateConfiguration(fromConfig))->service_attrs; + + return toConfig; +} + + +/* This is called by QNetworkSession constructor and it updates the current + * state of the configuration. + */ +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + /* Start to listen Icd status messages. */ + icdListener()->setup(this); + + /* Initially we are not active although the configuration might be in + * connected state. + */ + isOpen = false; + opened = false; + + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + break; + case QNetworkConfiguration::UserChoice: + // active config will contain correct data after open() has succeeded + copyConfig(publicConfig, activeConfig); + + /* We create new configuration that holds the actual configuration + * returned by icd. This way publicConfig still contains the + * original user specified configuration. + * + * Note that the new activeConfig configuration is not inserted + * to configurationManager as manager class will get the newly + * connected configuration from gconf when the IAP is saved. + * This configuration manager update is done by IapMonitor class. + * If the ANY connection fails in open(), then the configuration + * data is not saved to gconf and will not be added to + * configuration manager IAP list. + */ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"New configuration created for" << publicConfig.identifier(); +#endif + break; + default: + /* Invalid configuration, no point continuing */ + return; + } + + if (!activeConfig.isValid()) + return; + + /* Get the initial state from icd */ + Maemo::Icd icd; + QList state_results; + + /* Update the active config from first connection, this is ok as icd + * supports only one connection anyway. + */ + if (icd.state(state_results) && !state_results.isEmpty()) { + + /* If we did not get full state back, then we are not + * connected and can skip the next part. + */ + if (!(state_results.first().params.network_attrs == 0 && + state_results.first().params.network_id.isEmpty())) { + + /* If we try to connect to specific IAP and we get results back + * that tell the icd is actually connected to another IAP, + * then do not update current state etc. + */ + if (publicConfig.type() == QNetworkConfiguration::UserChoice || + privateConfiguration(publicConfig)->id == state_results.first().params.network_id) { + + switch (state_results.first().state) { + case ICD_STATE_DISCONNECTED: + state = QNetworkSession::Disconnected; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + case ICD_STATE_CONNECTING: + state = QNetworkSession::Connecting; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + case ICD_STATE_CONNECTED: + { + if (!state_results.first().error.isEmpty()) + break; + + const QString id = state_results.first().params.network_id; + + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if (config.isValid()) { + //we don't want the copied data if the config is already known by the manager + //just reuse it so that existing references to the old data get the same update + setPrivateConfiguration(activeConfig, privateConfiguration(config)); + } + + QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig); + + state = QNetworkSession::Connected; + toIcdConfig(ptr)->network_id = state_results.first().params.network_id; + ptr->id = toIcdConfig(ptr)->network_id; + toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs; + toIcdConfig(ptr)->iap_type = state_results.first().params.network_type; + toIcdConfig(ptr)->service_type = state_results.first().params.service_type; + toIcdConfig(ptr)->service_id = state_results.first().params.service_id; + toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->state = QNetworkConfiguration::Active; + ptr->isValid = true; + currentNetworkInterface = get_network_interface(); + + Maemo::IAPConf iap_name(privateConfiguration(activeConfig)->id); + QString name_value = iap_name.value("name").toString(); + if (!name_value.isEmpty()) + privateConfiguration(activeConfig)->name = name_value; + else + privateConfiguration(activeConfig)->name = privateConfiguration(activeConfig)->id; + + + // Add the new active configuration to manager or update the old config + if (!(engine->accessPointConfigurations.contains(privateConfiguration(activeConfig)->id))) + engine->addSessionConfiguration(privateConfiguration(activeConfig)); + else + engine->changedSessionConfiguration(privateConfiguration(activeConfig)); + } + break; + + case ICD_STATE_DISCONNECTING: + state = QNetworkSession::Closing; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + default: + break; + } + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req tells icd is not connected"; +#endif + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req did not return any results from icd"; +#endif + } + + networkConfigurationsChanged(); +} + + +void QNetworkSessionPrivateImpl::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +} + + +void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + activeConfig = config; + emit newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + if (state != oldState) + emit stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + if (state != oldState) + emit stateChanged(state); +} + + +void QNetworkSessionPrivateImpl::clearConfiguration(QNetworkConfiguration &config) +{ + toIcdConfig(privateConfiguration(config))->network_id.clear(); + toIcdConfig(privateConfiguration(config))->iap_type.clear(); + toIcdConfig(privateConfiguration(config))->network_attrs = 0; + toIcdConfig(privateConfiguration(config))->service_type.clear(); + toIcdConfig(privateConfiguration(config))->service_id.clear(); + toIcdConfig(privateConfiguration(config))->service_attrs = 0; +} + + +void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() +{ + QNetworkSession::State oldState = state; + + bool newActive = false; + + if (!privateConfiguration(activeConfig)) + return; + + if (!activeConfig.isValid()) { + state = QNetworkSession::Invalid; + clearConfiguration(activeConfig); + } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Connected; + newActive = opened; + } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Disconnected; + } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + state = QNetworkSession::NotAvailable; + } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { + state = QNetworkSession::NotAvailable; + //clearConfiguration(activeConfig); + } + + bool oldActive = isOpen; + isOpen = newActive; + + if (!oldActive && isOpen) + emit quitPendingWaitsForOpened(); + + if (oldActive && !isOpen) + emit closed(); + + if (oldState != state) { + emit stateChanged(state); + + if (state == QNetworkSession::Disconnected) { +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"session aborted error emitted for"<ifa_next) { + family = ifa->ifa_addr->sa_family; + if (family != AF_INET) { + continue; /* Currently only IPv4 is supported by icd dbus interface */ + } + if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) { + iface = QString(ifa->ifa_name); + break; + } + } + + freeifaddrs(ifaddr); + return iface; +} + + +void QNetworkSessionPrivateImpl::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (!isOpen) { + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + /* Caller is trying to connect to default IAP. + * At this time we will not know the IAP details so we just + * connect and update the active config when the IAP is + * connected. + */ + opened = true; + state = QNetworkSession::Connecting; + emit stateChanged(state); + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + /* User is connecting to one specific IAP. If that IAP is not + * in discovered state we cannot continue. + */ + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { + state = QNetworkSession::Connecting; + emit stateChanged(state); + + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) + emit quitPendingWaitsForOpened(); + } else { + /* We seem to be active so inform caller */ + emit quitPendingWaitsForOpened(); + } +} + + +void QNetworkSessionPrivateImpl::do_open() +{ + icd_connection_flags flags = connectFlags; + bool st; + QString result; + QString iap = publicConfig.identifier(); + + if (state == QNetworkSession::Connected) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Already connected to" << activeConfig.identifier(); +#endif + emit stateChanged(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + return; + } + + Maemo::IcdConnectResult connect_result; + Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + config = activeConfig; + else + config = publicConfig; + + if (iap == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connecting to default IAP" << iap; +#endif + st = icd.connect(flags, connect_result); + + } else { + + QList params; + Maemo::ConnectParams param; + param.connect.service_type = toIcdConfig(privateConfiguration(config))->service_type; + param.connect.service_attrs = toIcdConfig(privateConfiguration(config))->service_attrs; + param.connect.service_id = toIcdConfig(privateConfiguration(config))->service_id; + param.connect.network_type = toIcdConfig(privateConfiguration(config))->iap_type; + param.connect.network_attrs = toIcdConfig(privateConfiguration(config))->network_attrs; + if (toIcdConfig(privateConfiguration(config))->network_attrs & ICD_NW_ATTR_IAPNAME) + param.connect.network_id = QByteArray(iap.toLatin1()); + else + param.connect.network_id = toIcdConfig(privateConfiguration(config))->network_id; + params.append(param); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", + param.connect.network_id.data(), + param.connect.network_type.toAscii().constData(), + param.connect.network_attrs, + param.connect.service_type.toAscii().constData(), + param.connect.service_attrs, + param.connect.service_id.toAscii().constData()); +#endif + st = icd.connect(flags, params, connect_result); + } + + if (st) { + result = connect_result.connect.network_id.data(); + QString connected_iap = result; + + if (connected_iap.isEmpty()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< iap << "failed, result is empty"; +#endif + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + cleanupAnyConfiguration(); + return; + } + + /* If the user tried to connect to some specific connection (foo) + * and we were already connected to some other connection (bar), + * then we cannot activate this session although icd has a valid + * connection to somewhere. + */ + if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && + (connected_iap != config.identifier())) { + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError); + return; + } + + + /* Did we connect to non saved IAP? */ + if (!(toIcdConfig(privateConfiguration(config))->network_attrs & ICD_NW_ATTR_IAPNAME)) { + /* Because the connection succeeded, the IAP is now known. + */ + toIcdConfig(privateConfiguration(config))->network_attrs |= ICD_NW_ATTR_IAPNAME; + privateConfiguration(config)->id = connected_iap; + } + + /* User might have changed the IAP name when a new IAP was saved */ + Maemo::IAPConf iap_name(privateConfiguration(config)->id); + QString name = iap_name.value("name").toString(); + if (!name.isEmpty()) + privateConfiguration(config)->name = name; + + toIcdConfig(privateConfiguration(config))->iap_type = connect_result.connect.network_type; + + privateConfiguration(config)->isValid = true; + privateConfiguration(config)->state = QNetworkConfiguration::Active; + privateConfiguration(config)->type = QNetworkConfiguration::InternetAccessPoint; + + startTime = QDateTime::currentDateTime(); + updateState(QNetworkSession::Connected); + + currentNetworkInterface = get_network_interface(); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connected to" << result << config.name() << "at" << currentNetworkInterface; +#endif + + /* We first check if the configuration already exists in the manager + * and if it is not found there, we then insert it. Note that this + * is only done for user choice config only because it can be missing + * from config manager list. + */ + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (!engine->accessPointConfigurations.contains(result)) { + engine->addSessionConfiguration(privateConfiguration(config)); + } else { + QNetworkConfigurationPrivatePointer priv = + engine->accessPointConfigurations.value(result); + QNetworkConfiguration reference; + setPrivateConfiguration(reference, priv); + copyConfig(config, reference, false); + config = reference; + activeConfig = reference; + engine->changedSessionConfiguration(privateConfiguration(config)); + } + } + + emit quitPendingWaitsForOpened(); + + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< iap << "failed, status:" << connect_result.status; +#endif + updateState(QNetworkSession::Disconnected); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + cleanupAnyConfiguration(); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError); + } +} + + +void QNetworkSessionPrivateImpl::cleanupAnyConfiguration() +{ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"Removing configuration created for" << activeConfig.identifier(); +#endif + activeConfig = publicConfig; +} + + +void QNetworkSessionPrivateImpl::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (isOpen) { + opened = false; + isOpen = false; + emit closed(); + } +} + + +void QNetworkSessionPrivateImpl::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit stateChanged(state); + + Maemo::Icd icd; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "stopping session" << publicConfig.identifier(); +#endif + icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); + startTime = QDateTime(); + + /* Note that the state will go disconnected in + * updateStateFromActiveConfig() which gets called after + * configurationChanged is emitted (below). + */ + + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Discovered; + engine->changedSessionConfiguration(privateConfiguration(activeConfig)); + + opened = false; + isOpen = false; + + } else { + opened = false; + isOpen = false; + emit closed(); + } + } +} + + +void QNetworkSessionPrivateImpl::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) + return QNetworkInterface(); + + if (currentNetworkInterface.isEmpty()) + return QNetworkInterface(); + + return QNetworkInterface::interfaceFromName(currentNetworkInterface); +} + + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& key, const QVariant& value) +{ + if (value.isValid()) { + properties.insert(key, value); + + if (key == "ConnectInBackground") { + bool v = value.toBool(); + if (v) + connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT; + else + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } + } else { + properties.remove(key); + + /* Set default value when property is removed */ + if (key == "ConnectInBackground") + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } +} + + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& key) const +{ + return properties.value(key); +} + + +QString QNetworkSessionPrivateImpl::errorString() const +{ + QString errorStr; + switch(q->error()) { + case QNetworkSession::RoamingError: + errorStr = QObject::tr("Roaming error"); + break; + case QNetworkSession::SessionAbortedError: + errorStr = QObject::tr("Session aborted by user or system"); + break; + default: + case QNetworkSession::UnknownSessionError: + errorStr = QObject::tr("Unidentified Error"); + break; + } + return errorStr; +} + + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return QNetworkSession::UnknownSessionError; +} + +#include "qnetworksession_impl.moc" + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h new file mode 100644 index 0000000..22e41b3 --- /dev/null +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +//#include "qnetworkconfigmanager_maemo_p.h" +//#include "qnetworksession.h" + +//#include +//#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QIcdEngine; + +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate +{ + Q_OBJECT + +public: + QNetworkSessionPrivateImpl(QIcdEngine *engine) + : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) + { + } + + ~QNetworkSessionPrivateImpl() + { + cleanupSession(); + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void open(); + void close(); + void stop(); + + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private Q_SLOTS: + void do_open(); + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + +private: + QNetworkConfigurationManager manager; + QIcdEngine *engine; + + QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); + void clearConfiguration(QNetworkConfiguration &config); + void cleanupAnyConfiguration(); + + bool opened; + icd_connection_flags connectFlags; + + QNetworkSession::SessionError lastError; + + QDateTime startTime; + QString currentNetworkInterface; + friend class IcdListener; + void updateState(QNetworkSession::State); + void updateIdentifier(QString &newId); + quint64 getStatistics(bool sent) const; + void cleanupSession(void); +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSIONPRIVATE_H + -- cgit v0.12 From 5f885bc5a294cd831f79b5570cb41f3cae2b8b19 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 08:52:32 +1000 Subject: Fix networkAccessEnabled implementation. Move QDisabledNetworkReply to more appropriate source files. Return -1 from QDisabledNetworkReply::readData(). Always allow local access (via QNetworkAccessFileBackend). --- src/network/access/qnetworkaccessmanager.cpp | 47 +++------------------------- src/network/access/qnetworkreplyimpl.cpp | 24 ++++++++++++++ src/network/access/qnetworkreplyimpl_p.h | 14 +++++++++ 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7f36570..07a8b1d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -57,7 +57,6 @@ #include "QtCore/qbuffer.h" #include "QtCore/qurl.h" #include "QtCore/qvector.h" -#include "QtCore/qcoreapplication.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qnetworkconfigmanager.h" @@ -760,46 +759,6 @@ bool QNetworkAccessManager::networkAccessEnabled() const return d->networkAccessEnabled; } -class QDisabledNetworkReply : public QNetworkReply -{ - Q_OBJECT - -public: - QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, - const QNetworkAccessManager::Operation op); - ~QDisabledNetworkReply(); - - void abort() { } -protected: - qint64 readData(char *, qint64) { return 0; } -}; - -QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, - const QNetworkRequest &req, - QNetworkAccessManager::Operation op) -: QNetworkReply(parent) -{ - setRequest(req); - setUrl(req.url()); - setOperation(op); - - qRegisterMetaType("QNetworkReply::NetworkError"); - - QString msg = QCoreApplication::translate("QNetworkAccessManager", - "Network access is disabled."); - setError(UnknownNetworkError, msg); - - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); -} - -QDisabledNetworkReply::~QDisabledNetworkReply() -{ -} - -#include "qnetworkaccessmanager.moc" - /*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and @@ -829,8 +788,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } - if (!d->networkAccessEnabled) + // Return a disabled network reply if network access is disabled. + // Except if the scheme is empty or file://. + if (!d->networkAccessEnabled && !(req.url().scheme() == QLatin1String("file") || + req.url().scheme().isEmpty())) { return new QDisabledNetworkReply(this, req, op); + } QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 9721e32..3cf21f0 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -856,6 +856,30 @@ bool QNetworkReplyImplPrivate::migrateBackend() return true; } +QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, + const QNetworkRequest &req, + QNetworkAccessManager::Operation op) +: QNetworkReply(parent) +{ + setRequest(req); + setUrl(req.url()); + setOperation(op); + + qRegisterMetaType("QNetworkReply::NetworkError"); + + QString msg = QCoreApplication::translate("QNetworkAccessManager", + "Network access is disabled."); + setError(UnknownNetworkError, msg); + + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); +} + +QDisabledNetworkReply::~QDisabledNetworkReply() +{ +} + QT_END_NAMESPACE #include "moc_qnetworkreplyimpl_p.cpp" diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 89b976f..639361e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -193,6 +193,20 @@ public: Q_DECLARE_PUBLIC(QNetworkReplyImpl) }; +class QDisabledNetworkReply : public QNetworkReply +{ + Q_OBJECT + +public: + QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, + const QNetworkAccessManager::Operation op); + ~QDisabledNetworkReply(); + + void abort() { } +protected: + qint64 readData(char *, qint64) { return -1; } +}; + QT_END_NAMESPACE #endif -- cgit v0.12 From d7cf6d018f39607ff7315b7851665e72fc488e62 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:23:55 +1000 Subject: Connect signals between QNAM and QNetworkReplyImpl. Instead of iterating over children, when network session state changes. --- src/network/access/qnetworkaccessmanager.cpp | 36 ++++------------------------ src/network/access/qnetworkaccessmanager.h | 2 ++ src/network/access/qnetworkreplyimpl.cpp | 20 ++++++++++++++++ src/network/access/qnetworkreplyimpl_p.h | 2 ++ 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 07a8b1d..e57702b 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -811,6 +811,8 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // first step: create the reply QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) + connect(this, SIGNAL(networkSessionOnline()), reply, SLOT(_q_networkSessionOnline())); QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; @@ -1131,12 +1133,7 @@ void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); - // start waiting children - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) - QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); - } + emit q->networkSessionOnline(); } void QNetworkAccessManagerPrivate::_q_sessionClosed() @@ -1183,37 +1180,14 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() qDebug() << "Accepting new configuration."; session->accept(); - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (!reply) - continue; - - switch (reply->d_func()->state) { - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - case QNetworkReplyImplPrivate::Reconnecting: - // Migrate existing downloads to new configuration. - reply->d_func()->migrateBackend(); - break; - case QNetworkReplyImplPrivate::WaitingForSession: - // Start waiting requests. - QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); - break; - default: - qDebug() << "How do we handle replies in state" << reply->d_func()->state; - } - } + emit q->networkSessionOnline(); } void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (replyImpl) - replyImpl->migrateBackend(); - } + emit q->networkSessionOnline(); session->migrate(); } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 371f729..f934b22 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -124,6 +124,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void networkSessionOnline(); + void networkAccessChanged(bool enabled); void debugMessage(const QString &message); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 3cf21f0..a7948c2 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -226,6 +226,26 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData() } } +void QNetworkReplyImplPrivate::_q_networkSessionOnline() +{ + Q_Q(QNetworkReplyImpl); + + switch (state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + case QNetworkReplyImplPrivate::Reconnecting: + // Migrate existing downloads to new network connection. + migrateBackend(); + break; + case QNetworkReplyImplPrivate::WaitingForSession: + // Start waiting requests. + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + break; + default: + qDebug() << "How do we handle replies in state" << state; + } +} + void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) { diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 639361e..9941fa7 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -100,6 +100,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionOnline()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -132,6 +133,7 @@ public: void _q_copyReadChannelFinished(); void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); + void _q_networkSessionOnline(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); -- cgit v0.12 From 024b86bce25511aeb4b0f935e36ec43c52c802ca Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:51:30 +1000 Subject: Remove functions used for testing. --- src/network/access/qnetworkreply.h | 2 -- src/network/access/qnetworkreplyimpl.cpp | 7 ------- src/network/access/qnetworkreplyimpl_p.h | 2 -- 3 files changed, 11 deletions(-) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 0f1fe8a..b39557a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -138,8 +138,6 @@ public: void ignoreSslErrors(const QList &errors); #endif - virtual void migrateBackend() { qWarning("Your backend doesn't support migration!"); } // Testing - public Q_SLOTS: virtual void ignoreSslErrors(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index a7948c2..b9206be 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -805,13 +805,6 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } -void QNetworkReplyImpl::migrateBackend() -{ - Q_D(QNetworkReplyImpl); - - d->migrateBackend(); -} - bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 9941fa7..7f1ee80 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -92,8 +92,6 @@ public: Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList &errors); #endif - void migrateBackend(); - Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) -- cgit v0.12 From 70fc1c298b957b54d498b518ddf786694d3001cc Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:54:14 +1000 Subject: Clarify TemporaryNetworkFailureError docs. --- src/network/access/qnetworkreply.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index e299b5b..dd5cace 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -127,7 +127,8 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \value TemporaryNetworkFailureError the connection was broken due to disconnection from the network, however the system has initiated - roaming to another access point. The request should be resubmitted. + roaming to another access point. The request should be resubmitted + and will be processed as soon as the connection is re-established. \value ProxyConnectionRefusedError the connection to the proxy server was refused (the proxy server is not accepting requests) -- cgit v0.12 From 47b96ccf100da33910cbc534035c00aa4b2b533d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 10:15:03 +1000 Subject: Don't try to migrate finished or aborted requests. --- src/network/access/qnetworkreplyimpl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index b9206be..f4e8264 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -573,7 +573,11 @@ void QNetworkReplyImplPrivate::finished() qDebug() << "Download hasn't finished"; if (migrateBackend()) { - return; + // either we are migrating or the request is finished/aborted + if (state == Reconnecting) { + resumeNotificationHandling(); + return; // exit early if we are migrating. + } } else { qDebug() << "Could not migrate backend, application needs to send another requeset."; error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); @@ -812,7 +816,7 @@ bool QNetworkReplyImplPrivate::migrateBackend() if (state == QNetworkReplyImplPrivate::Finished || state == QNetworkReplyImplPrivate::Aborted) { qDebug() << "Network reply is already finished/aborted."; - return false; + return true; } if (!qobject_cast(backend)) { -- cgit v0.12 From 20cffd52ab81d01ca0a45058dfa894df9ce26c5a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 10:27:32 +1000 Subject: Move check for range header support to before deleting backend. --- src/network/access/qnetworkreplyimpl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index f4e8264..70bf238 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -829,6 +829,12 @@ bool QNetworkReplyImplPrivate::migrateBackend() return false; } + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); + if (it == rawHeaders.constEnd() || it->second == "none") { + qDebug() << "Range header not supported by server/resource."; + return false; + } + qDebug() << "Need to check for only cacheable content."; // stop both upload and download @@ -844,12 +850,6 @@ bool QNetworkReplyImplPrivate::migrateBackend() backend = 0; } - RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); - if (it == rawHeaders.constEnd() || it->second == "none") { - qDebug() << "Range header not supported by server/resource."; - return false; - } - cookedHeaders.clear(); rawHeaders.clear(); -- cgit v0.12 From 329572a097e529b0ee330097d31212b091975180 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 10:32:29 +1000 Subject: Add comments to private state enums. --- src/network/access/qnetworkreplyimpl_p.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 7f1ee80..ec413cc 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -111,13 +111,13 @@ public: }; enum State { - Idle, - Buffering, - Working, - Finished, - Aborted, - WaitingForSession, - Reconnecting + Idle, // The reply is idle. + Buffering, // The reply is buffering outgoing data. + Working, // The reply is uploading/downloading data. + Finished, // The reply has finished. + Aborted, // The reply has been aborted. + WaitingForSession, // The reply is waiting for the session to open before connecting. + Reconnecting // The reply will reconnect to once roaming has completed. }; typedef QQueue NotificationQueue; -- cgit v0.12 From 02df547ddf8aabb680511135f98a5188438de6d4 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 11:02:47 +1000 Subject: Rename and remove unused private slots. --- src/network/access/qnetworkaccessbackend.cpp | 5 +- src/network/access/qnetworkaccessmanager.cpp | 86 ++++++---------------------- src/network/access/qnetworkaccessmanager.h | 8 +-- src/network/access/qnetworkaccessmanager_p.h | 13 ++--- src/network/access/qnetworkreplyimpl.cpp | 4 +- 5 files changed, 31 insertions(+), 85 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 0bfeb3b..1d23cdc 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,7 +349,7 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { - if (!manager->session) { + if (!manager->networkSession) { open(); return true; } @@ -364,7 +364,8 @@ bool QNetworkAccessBackend::start() return true; } - if (manager->session->isOpen() && manager->session->state() == QNetworkSession::Connected) { + if (manager->networkSession->isOpen() && + manager->networkSession->state() == QNetworkSession::Connected) { open(); return true; } diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e57702b..3324e09 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -715,8 +715,8 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const { Q_D(const QNetworkAccessManager); - if (d->session) - return d->session->configuration(); + if (d->networkSession) + return d->networkSession->configuration(); else return QNetworkConfiguration(); } @@ -732,11 +732,11 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const { Q_D(const QNetworkAccessManager); - if (d->session) { + if (d->networkSession) { QNetworkConfigurationManager manager; return manager.configurationFromIdentifier( - d->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + d->networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); } else { return QNetworkConfiguration(); } @@ -1107,89 +1107,41 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co { Q_Q(QNetworkAccessManager); - if (session) - delete session; + if (networkSession) + delete networkSession; if (!config.isValid()) { - session = 0; + networkSession = 0; return; } - session = new QNetworkSession(config, q); - - QObject::connect(session, SIGNAL(opened()), q, SLOT(_q_sessionOpened())); - QObject::connect(session, SIGNAL(closed()), q, SLOT(_q_sessionClosed())); - QObject::connect(session, SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_sessionStateChanged(QNetworkSession::State))); - QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), - q, SLOT(_q_sessionError(QNetworkSession::SessionError))); - QObject::connect(session, SIGNAL(newConfigurationActivated()), - q, SLOT(_q_sessionNewConfigurationActivated())); - QObject::connect(session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), - q, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); -} - -void QNetworkAccessManagerPrivate::_q_sessionOpened() -{ - Q_Q(QNetworkAccessManager); - - emit q->networkSessionOnline(); -} - -void QNetworkAccessManagerPrivate::_q_sessionClosed() -{ - Q_Q(QNetworkAccessManager); - - emit q->debugMessage(QLatin1String("Session Closed")); -} + networkSession = new QNetworkSession(config, q); -void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError error) -{ - Q_Q(QNetworkAccessManager); - - emit q->debugMessage(QString::fromLatin1("Session error %1").arg(error)); -} - -void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) -{ - qDebug() << "session state changed to" << state; + QObject::connect(networkSession, SIGNAL(opened()), q, SIGNAL(networkSessionOnline())); + QObject::connect(networkSession, SIGNAL(newConfigurationActivated()), + q, SLOT(_q_networkSessionNewConfigurationActivated())); + QObject::connect(networkSession, + SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + q, + SLOT(_q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); } -void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() +void QNetworkAccessManagerPrivate::_q_networkSessionNewConfigurationActivated() { Q_Q(QNetworkAccessManager); -#if 0 - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (reply) { - switch (reply->d_func()->state) { - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1") - .arg(reply->url().toString())); - break; - default: - qDebug() << "Testing new interface for" << reply->url(); - ; - } - } - } -#endif - - qDebug() << "Accepting new configuration."; - session->accept(); + networkSession->accept(); emit q->networkSessionOnline(); } -void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) +void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); emit q->networkSessionOnline(); - session->migrate(); + networkSession->migrate(); } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index f934b22..a0aa2d8 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -139,12 +139,8 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionOpened()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionClosed()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionError(QNetworkSession::SessionError)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionStateChanged(QNetworkSession::State)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionNewConfigurationActivated()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index eae08e8..0ac49db 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,7 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0), + networkSession(0), networkAccessEnabled(true) { } ~QNetworkAccessManagerPrivate(); @@ -110,12 +110,9 @@ public: void createSession(const QNetworkConfiguration &config); - void _q_sessionOpened(); - void _q_sessionClosed(); - void _q_sessionError(QNetworkSession::SessionError error); - void _q_sessionStateChanged(QNetworkSession::State state); - void _q_sessionNewConfigurationActivated(); - void _q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void _q_networkSessionNewConfigurationActivated(); + void _q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &config, + bool isSeamless); // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -130,7 +127,7 @@ public: bool cookieJarCreated; - QNetworkSession *session; + QNetworkSession *networkSession; bool networkAccessEnabled; // this cache can be used by individual backends to cache e.g. their TCP connections to a server diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 70bf238..afa7307 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -89,7 +89,7 @@ void QNetworkReplyImplPrivate::_q_startOperation() // state changes. state = WaitingForSession; - QNetworkSession *session = manager->d_func()->session; + QNetworkSession *session = manager->d_func()->networkSession; if (session) { if (!session->isOpen()) @@ -559,7 +559,7 @@ void QNetworkReplyImplPrivate::finished() QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; - QNetworkSession *session = manager->d_func()->session; + QNetworkSession *session = manager->d_func()->networkSession; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error -- cgit v0.12 From 12b70a4c52f57255da9586a0f92324557d400c8e Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 11:12:15 +1000 Subject: Remove debug. --- src/network/access/qnetworkaccessmanager.h | 2 -- src/network/access/qnetworkaccessmanager_p.h | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index a0aa2d8..6fdb678 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -128,8 +128,6 @@ Q_SIGNALS: void networkAccessChanged(bool enabled); - void debugMessage(const QString &message); - protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 0ac49db..568894c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -102,12 +102,6 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); - void sendDebugMessage(const QString &message) - { - Q_Q(QNetworkAccessManager); - emit q->debugMessage(message); - } - void createSession(const QNetworkConfiguration &config); void _q_networkSessionNewConfigurationActivated(); -- cgit v0.12 From c2b9767dfc0fb2f26ff52bdded36c76c0a23f938 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 12:42:42 +1000 Subject: Fix after reworking to use signals/slots. --- src/network/access/qnetworkaccessmanager.cpp | 2 -- src/network/access/qnetworkreplyimpl.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 3324e09..9c1e268 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1139,8 +1139,6 @@ void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChange { Q_Q(QNetworkAccessManager); - emit q->networkSessionOnline(); - networkSession->migrate(); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index afa7307..81d4d0d 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -574,7 +574,7 @@ void QNetworkReplyImplPrivate::finished() if (migrateBackend()) { // either we are migrating or the request is finished/aborted - if (state == Reconnecting) { + if (state == Reconnecting || state == WaitingForSession) { resumeNotificationHandling(); return; // exit early if we are migrating. } -- cgit v0.12 From f16733d41b8377a703c594b069cc592466e03a11 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 13:38:15 +1000 Subject: We don't need to migrate cached replies. --- src/network/access/qnetworkreplyimpl.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 81d4d0d..7f12fb8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -829,6 +829,11 @@ bool QNetworkReplyImplPrivate::migrateBackend() return false; } + if (copyDevice) { + qDebug() << "Request is serviced from cache, not migrating."; + return true; + } + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); if (it == rawHeaders.constEnd() || it->second == "none") { qDebug() << "Range header not supported by server/resource."; @@ -837,12 +842,6 @@ bool QNetworkReplyImplPrivate::migrateBackend() qDebug() << "Need to check for only cacheable content."; - // stop both upload and download - if (outgoingData) - outgoingData->disconnect(q); - if (copyDevice) - copyDevice->disconnect(q); - state = QNetworkReplyImplPrivate::Reconnecting; if (backend) { -- cgit v0.12 From 0f99aa42829c1d1b29dfbd8945cc96b0d21b3939 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 13:49:52 +1000 Subject: Update copyright year to 2010. --- src/network/bearer/qbearerengine.cpp | 2 +- src/network/bearer/qbearerplugin.cpp | 2 +- src/network/bearer/qnetworkconfigmanager.h | 2 +- src/network/bearer/qnetworkconfiguration.h | 2 +- src/network/bearer/qnetworksession.h | 2 +- src/plugins/bearer/corewlan/main.cpp | 2 +- src/plugins/bearer/generic/main.cpp | 2 +- src/plugins/bearer/icd/qnetworksession_impl.h | 4 ++-- src/plugins/bearer/nativewifi/main.cpp | 2 +- src/plugins/bearer/nativewifi/platformdefs.h | 2 +- src/plugins/bearer/networkmanager/main.cpp | 2 +- src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp | 2 +- src/plugins/bearer/networkmanager/qnetworkmanagerservice.h | 2 +- src/plugins/bearer/networkmanager/qnmdbushelper.cpp | 2 +- src/plugins/bearer/networkmanager/qnmdbushelper.h | 2 +- src/plugins/bearer/nla/main.cpp | 2 +- src/plugins/bearer/platformdefs_win.h | 2 +- src/plugins/bearer/symbian/main.cpp | 2 +- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 +- src/plugins/bearer/symbian/qnetworksession_impl.h | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index 4d56047..bd2ca6c 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 7b81b13..2ee90d4 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index b7ab72b..83c4939 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dede2b1..8d45cf6 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 6138166..06d5eb7 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index ce0611e..010976a 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index a7df023..8ba9f40 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index 22e41b3..b7461dc 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 64ed73d..6bb2a2b 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h index 38fbae4..57ae852 100644 --- a/src/plugins/bearer/nativewifi/platformdefs.h +++ b/src/plugins/bearer/nativewifi/platformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index b561415..6725252 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 3843f27..9d603b5 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index dbed01e..81903ec 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp index f93a63d..d5e20f3 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h index 410b69f..862290c 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.h +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index 541d2c5..54269a4 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index f2f44a1..37d099c 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 22d654a..37eddee 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 619fd9f..7762fb5 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 2e75d96..30f51e1 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -- cgit v0.12 From 0f90f7bdef4b8f821b00e039038fb83a01bc217b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:07:05 +1000 Subject: Remove debug. --- src/network/access/qnetworkreplyimpl.cpp | 49 ++++++++-------------- .../bearer/nativewifi/qnativewifiengine.cpp | 2 +- .../networkmanager/qnetworkmanagerengine.cpp | 10 +---- .../networkmanager/qnetworkmanagerservice.cpp | 1 - src/plugins/bearer/nla/qnlaengine.cpp | 4 +- src/plugins/bearer/qnetworksession_impl.cpp | 2 - src/plugins/bearer/symbian/symbianengine.cpp | 1 - 7 files changed, 21 insertions(+), 48 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7f12fb8..7f66b25 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -242,7 +242,7 @@ void QNetworkReplyImplPrivate::_q_networkSessionOnline() QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); break; default: - qDebug() << "How do we handle replies in state" << state; + ; } } @@ -503,8 +503,6 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) int index = it->second.lastIndexOf('/'); if (index != -1) totalSize = it->second.mid(index + 1).toLongLong() - preMigrationDownloaded; - } else { - qDebug() << "Could not find Content-Length or Content-Range header"; } } @@ -564,14 +562,7 @@ void QNetworkReplyImplPrivate::finished() state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { - qDebug() << "Connection broke during download."; - qDebug() << "Don't worry, we've already started roaming :)"; - - if (bytesDownloaded == totalSize) { - qDebug() << "Luckily download has already finished."; - } else { - qDebug() << "Download hasn't finished"; - + if (bytesDownloaded != totalSize) { if (migrateBackend()) { // either we are migrating or the request is finished/aborted if (state == Reconnecting || state == WaitingForSession) { @@ -579,8 +570,8 @@ void QNetworkReplyImplPrivate::finished() return; // exit early if we are migrating. } } else { - qDebug() << "Could not migrate backend, application needs to send another requeset."; - error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + error(QNetworkReply::TemporaryNetworkFailureError, + q->tr("Temporary network failure.")); } } } @@ -809,38 +800,34 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +/* + Migrates the backend of the QNetworkReply to a new network connection if required. Returns + true if the reply is migrated or it is not required; otherwise returns false. +*/ bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); - if (state == QNetworkReplyImplPrivate::Finished || - state == QNetworkReplyImplPrivate::Aborted) { - qDebug() << "Network reply is already finished/aborted."; + // Network reply is already finished or aborted, don't need to migrate. + if (state == Finished || state == Aborted) return true; - } - if (!qobject_cast(backend)) { - qDebug() << "Resume only support by http backend, not migrating."; + // Resume only supported by http backend, not migrating. + if (!qobject_cast(backend)) return false; - } - if (outgoingData) { - qDebug() << "Request has outgoing data, not migrating."; + // Request has outgoing data, not migrating. + if (outgoingData) return false; - } - if (copyDevice) { - qDebug() << "Request is serviced from cache, not migrating."; + // Request is serviced from the cache, don't need to migrate. + if (copyDevice) return true; - } + // Range header is not supported by server/resource, can't migrate. RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); - if (it == rawHeaders.constEnd() || it->second == "none") { - qDebug() << "Range header not supported by server/resource."; + if (it == rawHeaders.constEnd() || it->second == "none") return false; - } - - qDebug() << "Need to check for only cacheable content."; state = QNetworkReplyImplPrivate::Reconnecting; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index d88534b..e4ab0aa 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -72,7 +72,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) QMetaObject::invokeMethod(d, "scanComplete", Qt::QueuedConnection); break; default: - qDebug() << "wlan unknown notification"; + ; } } diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 51afe3e..3f3e1bd 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -134,9 +134,6 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) if (devices.isEmpty()) continue; - if (devices.count() > 1) - qDebug() << "multiple network interfaces for" << id; - QNetworkManagerInterfaceDevice device(devices.at(0).path()); return device.interface().name(); } @@ -328,8 +325,6 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, const QMap &properties) { - qDebug() << Q_FUNC_INFO << path; - qDebug() << properties; } void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) @@ -428,7 +423,6 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) const QString service = connection->connectionInterface()->service(); const QString settingsPath = connection->connectionInterface()->path(); - qDebug() << "Should parse connection directly into existing configuration"; QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings); // Check if connection is active. @@ -457,9 +451,7 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) { QDBusPendingReply reply = *watcher; - if (reply.isError()) { - qDebug() << "error connecting NM connection"; - } else { + if (!reply.isError()) { QDBusObjectPath result = reply.value(); QNetworkManagerConnectionActive activeConnection(result.path()); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 9d603b5..f7fedbf 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -723,7 +723,6 @@ bool QNetworkManagerSettingsConnection::setConnections() allOk = true; } else { QDBusError error = dbusConnection.lastError(); - qDebug() << error.name() << error.message() << error.type(); } if (nmDBusHelper) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index fbfac17..2001c0b 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -480,10 +480,8 @@ void QNlaThread::fetchConfigurations() if (error == WSA_E_NO_MORE) break; - if (error == WSAEFAULT) { - qDebug() << "buffer not big enough" << bufferLength; + if (error == WSAEFAULT) break; - } qWarning("WSALookupServiceNext error %d", WSAGetLastError()); break; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index de1c91a..3fe844a 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -316,7 +316,6 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() } state = QNetworkSession::Connected; - qDebug() << oldState << "->" << state; if (state != oldState) emit stateChanged(state); @@ -328,7 +327,6 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() else state = QNetworkSession::Disconnected; - qDebug() << oldState << "->" << state; if (state != oldState) emit stateChanged(state); } diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 2d0b5ee..e25eda4 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -663,7 +663,6 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn startCommsDatabaseNotifications(); - qDebug() << Q_FUNC_INFO << "updateCompleted()"; emit updateCompleted(); } -- cgit v0.12 From b8f21f8cd5b1dd900313675e0c8ffe976a5beded Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:26:37 +1000 Subject: Fix documentation. --- src/network/access/qnetworkaccessmanager.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 9c1e268..7dc9203 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -163,7 +163,9 @@ static void ensureInitialized() /*! \property QNetworkAccessManager::networkAccess - \brief wheather network access is enabled or disabled through this network access manager. + \brief states whether network access is enabled or disabled through this network access + manager. + \since 4.7 Network access is enabled by default. @@ -742,6 +744,12 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const } } +/*! + \since 4.7 + + Enables network access via this QNetworkAccessManager if \a enabled is true; otherwise disables + access. +*/ void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) { Q_D(QNetworkAccessManager); @@ -752,6 +760,12 @@ void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) } } +/*! + \since 4.7 + + Returns true if network access via this QNetworkAccessManager is enabled; otherwise returns + false. +*/ bool QNetworkAccessManager::networkAccessEnabled() const { Q_D(const QNetworkAccessManager); -- cgit v0.12 From b8c971b3841858f70c6355a704617a869db8a694 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:35:54 +1000 Subject: Tag new classes as since 4.7. --- src/network/bearer/qnetworkconfigmanager.cpp | 2 ++ src/network/bearer/qnetworkconfiguration.cpp | 2 ++ src/network/bearer/qnetworksession.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index d46048b..8673f52 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -61,6 +61,8 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() \brief The QNetworkConfigurationManager class manages the network configurations provided by the system. + \since 4.7 + \inmodule QtNetwork \ingroup bearer diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index cf10677..9246645 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE \brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations. + \since 4.7 + \inmodule QtNetwork \ingroup bearer diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index f9bb9ea..3e77354 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE \brief The QNetworkSession class provides control over the system's access points and enables session management for cases when multiple clients access the same access point. + \since 4.7 + \inmodule QtNetwork \ingroup bearer -- cgit v0.12 From 3591386484957cc4c93aece442f673246700b3b2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:54:21 +1000 Subject: Document networkSessionOnline() signal and mark as internal. --- src/network/access/qnetworkaccessmanager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7dc9203..9a351dc 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -187,6 +187,18 @@ static void ensureInitialized() */ /*! + \fn void QNetworkAccessManager::networkSessionOnline() + + \since 4.7 + + \internal + + This signal is emitted when the status of the network session changes into a usable state. + It is used to signal QNetworkReply's to start or migrate their network operation once the + network session has been opened / roamed. +*/ + +/*! \fn void QNetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) This signal is emitted whenever a proxy requests authentication -- cgit v0.12 From b5fe99c0105a9791e34a8b959822430497a4aeb9 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 15:06:45 +1000 Subject: Fix public includes. --- src/network/bearer/bearer.pri | 2 +- src/network/bearer/qbearerplugin.cpp | 2 +- src/network/bearer/qbearerplugin.h | 82 -------------------------- src/network/bearer/qbearerplugin_p.h | 82 ++++++++++++++++++++++++++ src/network/bearer/qnetworkconfigmanager.h | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 2 +- src/network/bearer/qnetworksession.h | 3 +- src/plugins/bearer/corewlan/main.cpp | 2 +- src/plugins/bearer/generic/main.cpp | 2 +- src/plugins/bearer/icd/main.cpp | 2 +- src/plugins/bearer/nativewifi/main.cpp | 2 +- src/plugins/bearer/networkmanager/main.cpp | 2 +- src/plugins/bearer/nla/main.cpp | 2 +- src/plugins/bearer/symbian/main.cpp | 2 +- 14 files changed, 94 insertions(+), 95 deletions(-) delete mode 100644 src/network/bearer/qbearerplugin.h create mode 100644 src/network/bearer/qbearerplugin_p.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index c03c615..44e97fd 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -7,7 +7,7 @@ HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ bearer/qbearerengine_p.h \ - bearer/qbearerplugin.h + bearer/qbearerplugin_p.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 2ee90d4..4509fd0 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qbearerplugin.h" +#include "qbearerplugin_p.h" #include diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h deleted file mode 100644 index 1958188..0000000 --- a/src/network/bearer/qbearerplugin.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QBEARERPLUGIN_H -#define QBEARERPLUGIN_H - -#include "qbearerengine_p.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) - -struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface -{ - virtual QBearerEngine *create(const QString &key = QString()) const = 0; -}; - -#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" -Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) - -class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QBearerEngineFactoryInterface:QFactoryInterface) - -public: - explicit QBearerEnginePlugin(QObject *parent = 0); - virtual ~QBearerEnginePlugin(); - - virtual QStringList keys() const = 0; - virtual QBearerEngine *create(const QString &key = QString()) const = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif - diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h new file mode 100644 index 0000000..1958188 --- /dev/null +++ b/src/network/bearer/qbearerplugin_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERPLUGIN_H +#define QBEARERPLUGIN_H + +#include "qbearerengine_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface +{ + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" +Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) + +class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QBearerEngineFactoryInterface:QFactoryInterface) + +public: + explicit QBearerEnginePlugin(QObject *parent = 0); + virtual ~QBearerEnginePlugin(); + + virtual QStringList keys() const = 0; + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 83c4939..a34e456 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -43,7 +43,7 @@ #define QNETWORKCONFIGURATIONMANAGER_H #include -#include "qnetworkconfiguration.h" +#include QT_BEGIN_HEADER diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index a624376..66d5982 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qnetworkconfigmanager_p.h" -#include "qbearerplugin.h" +#include "qbearerplugin_p.h" #include diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 06d5eb7..3c8d913 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -47,8 +47,7 @@ #include #include #include -#include "qnetworkconfiguration.h" - +#include QT_BEGIN_HEADER diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index 010976a..5be8c0e 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -41,7 +41,7 @@ #include "qcorewlanengine.h" -#include +#include #include diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index 8ba9f40..ba85d93 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -41,7 +41,7 @@ #include "qgenericengine.h" -#include +#include #include diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp index 8984d2c..b131ccb 100644 --- a/src/plugins/bearer/icd/main.cpp +++ b/src/plugins/bearer/icd/main.cpp @@ -41,7 +41,7 @@ #include "qicdengine.h" -#include +#include #include diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 6bb2a2b..d77462e 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index 6725252..f62b847 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -41,7 +41,7 @@ #include "qnetworkmanagerengine.h" -#include +#include #include diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index 54269a4..479a933 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -41,7 +41,7 @@ #include "qnlaengine.h" -#include +#include #include diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 37eddee..0321451 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -41,7 +41,7 @@ #include "symbianengine.h" -#include +#include #include -- cgit v0.12 From 34450eb48e56677395601bf155a6a05752b326ad Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 16:27:44 +1000 Subject: Use provided typedef for QNetworkConfigurationPrivatePointer. --- src/network/bearer/qnetworkconfigmanager.cpp | 6 ++---- src/network/bearer/qnetworkconfigmanager_p.cpp | 10 +++++----- src/network/bearer/qnetworkconfiguration.cpp | 5 ++--- src/plugins/bearer/generic/qgenericengine.cpp | 5 ++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 8673f52..8ca2537 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -239,8 +239,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe //find all InternetAccessPoints foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - engine->accessPointConfigurations.value(ii); + QNetworkConfigurationPrivatePointer p = engine->accessPointConfigurations.value(ii); if ((p->state & filter) == filter) { QNetworkConfiguration pt; pt.d = engine->accessPointConfigurations.value(ii); @@ -251,8 +250,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe //find all service networks cpsIdents = engine->snapConfigurations.keys(); foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - engine->snapConfigurations.value(ii); + QNetworkConfigurationPrivatePointer p = engine->snapConfigurations.value(ii); if ((p->state & filter) == filter) { QNetworkConfiguration pt; pt.d = engine->snapConfigurations.value(ii); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 66d5982..01a85a5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -121,7 +121,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() serviceNetwork->state = QNetworkConfiguration::Defined; serviceNetwork->type = QNetworkConfiguration::ServiceNetwork; - QExplicitlySharedDataPointer ptr(serviceNetwork); + QNetworkConfigurationPrivatePointer ptr(serviceNetwork); generic->snapConfigurations.insert(serviceNetwork->id, ptr); @@ -132,17 +132,17 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() } } - QExplicitlySharedDataPointer ptr = + QNetworkConfigurationPrivatePointer ptr = generic->snapConfigurations.value(QLatin1String("Internet Service Network")); - QList > serviceNetworkMembers; + QList serviceNetworkMembers; - QHash >::const_iterator i = + QHash::const_iterator i = generic->accessPointConfigurations.constBegin(); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; while (i != generic->accessPointConfigurations.constEnd()) { - QExplicitlySharedDataPointer child = i.value(); + QNetworkConfigurationPrivatePointer child = i.value(); if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined)) { diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 9246645..8c11d9c 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -326,10 +326,9 @@ QList QNetworkConfiguration::children() const if (type() != QNetworkConfiguration::ServiceNetwork || !isValid() ) return results; - QMutableListIterator > iter(d->serviceNetworkMembers); - QExplicitlySharedDataPointer p(0); + QMutableListIterator iter(d->serviceNetworkMembers); while(iter.hasNext()) { - p = iter.next(); + QNetworkConfigurationPrivatePointer p = iter.next(); //if we have an invalid member get rid of it -> was deleted earlier on if (!p->isValid) iter.remove(); diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index c6ab4df..dba2c08 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -224,8 +224,7 @@ void QGenericEngine::doRequestUpdate() state |= QNetworkConfiguration::Active; if (accessPointConfigurations.contains(id)) { - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.value(id); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); bool changed = false; @@ -269,7 +268,7 @@ void QGenericEngine::doRequestUpdate() } while (!previous.isEmpty()) { - QExplicitlySharedDataPointer ptr = + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); configurationInterface.remove(ptr->id); -- cgit v0.12 From f11b682818e0d6fbd9cc75ee59b51bc6d6723c19 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 17:01:44 +1000 Subject: Add 'We mean it.' header. --- src/network/bearer/qbearerplugin_p.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h index 1958188..36709c2 100644 --- a/src/network/bearer/qbearerplugin_p.h +++ b/src/network/bearer/qbearerplugin_p.h @@ -39,8 +39,19 @@ ** ****************************************************************************/ -#ifndef QBEARERPLUGIN_H -#define QBEARERPLUGIN_H +#ifndef QBEARERPLUGIN_P_H +#define QBEARERPLUGIN_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include "qbearerengine_p.h" -- cgit v0.12 From cb9cf8fbe9dd54c011490ee814c0692e61b729df Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 12 Feb 2010 11:08:50 +1000 Subject: Fix compiler warning, unused variable. --- src/network/access/qnetworkaccessmanager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 9a351dc..312f744 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1163,8 +1163,6 @@ void QNetworkAccessManagerPrivate::_q_networkSessionNewConfigurationActivated() void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { - Q_Q(QNetworkAccessManager); - networkSession->migrate(); } -- cgit v0.12 From cc1268a6cbc9797e2a9137f7a0389f3d144a8c0a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 12 Feb 2010 11:14:49 +1000 Subject: Move http resume code into http backend. Adds two new virtual functions to QNetworkAccessBackend: bool canResume() const; and void setResumeOffset(quint64) canResume() is used to query the existing backend if resuming is supported for the current request. setResumeOffset() is used to set an additional offset which should be applied when the backend posts the request. The default implementation of canResume() returns false (resuming not supported). The default implementation of setResumeOffset() does nothing. --- src/network/access/qnetworkaccessbackend_p.h | 4 ++ src/network/access/qnetworkaccesshttpbackend.cpp | 48 ++++++++++++++++++++++++ src/network/access/qnetworkaccesshttpbackend_p.h | 5 +++ src/network/access/qnetworkreplyimpl.cpp | 21 ++--------- 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 830ec7e..eab011c 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -162,6 +162,10 @@ public: // This will possibly enable buffering of the upload data. virtual bool needsResetableUploadData() { return false; } + // Returns true if backend is able to resume downloads. + virtual bool canResume() const { return false; } + virtual void setResumeOffset(quint64 offset) { Q_UNUSED(offset); } + protected: // Create the device used for reading the upload data QNonContiguousByteDevice* createUploadByteDevice(); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 8e02723..aa6a820 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -296,6 +296,7 @@ QNetworkAccessHttpBackend::QNetworkAccessHttpBackend() #ifndef QT_NO_OPENSSL , pendingSslConfiguration(0), pendingIgnoreAllSslErrors(false) #endif + , resumeOffset(0) { } @@ -533,6 +534,28 @@ void QNetworkAccessHttpBackend::postRequest() httpRequest.setUrl(url()); QList headers = request().rawHeaderList(); + if (resumeOffset != 0) { + if (headers.contains("Range")) { + // Need to adjust resume offset for user specified range + + headers.removeOne("Range"); + + // We've already verified that requestRange starts with "bytes=", see canResume. + QByteArray requestRange = request().rawHeader("Range").mid(6); + + int index = requestRange.indexOf('-'); + + quint64 requestStartOffset = requestRange.left(index).toULongLong(); + quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); + + requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + + '-' + QByteArray::number(requestEndOffset); + + httpRequest.setHeaderField("Range", requestRange); + } else { + httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-'); + } + } foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, request().rawHeader(header)); @@ -1108,6 +1131,31 @@ QNetworkCacheMetaData QNetworkAccessHttpBackend::fetchCacheMetaData(const QNetwo return metaData; } +bool QNetworkAccessHttpBackend::canResume() const +{ + // Only GET operation supports resuming. + if (operation() != QNetworkAccessManager::GetOperation) + return false; + + // Can only resume if server/resource supports Range header. + if (httpReply->headerField("Accept-Ranges", "none") == "none") + return false; + + // We only support resuming for byte ranges. + if (request().hasRawHeader("Range")) { + QByteArray range = request().rawHeader("Range"); + if (!range.startsWith("bytes=")) + return false; + } + + return true; +} + +void QNetworkAccessHttpBackend::setResumeOffset(quint64 offset) +{ + resumeOffset = offset; +} + QT_END_NAMESPACE #endif // QT_NO_HTTP diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 0eaf003..e5cc0ab 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -99,6 +99,9 @@ public: // we return true since HTTP needs to send PUT/POST data again after having authenticated bool needsResetableUploadData() { return true; } + bool canResume() const; + void setResumeOffset(quint64 offset); + private slots: void replyReadyRead(); void replyFinished(); @@ -120,6 +123,8 @@ private: QList pendingIgnoreSslErrorsList; #endif + quint64 resumeOffset; + void disconnectFromHttp(); void setupConnection(); void validateCache(QHttpNetworkRequest &httpRequest, bool &loadedFromCache); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7f66b25..2906caa 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -497,15 +497,6 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (totalSize.isNull()) { - RawHeadersList::ConstIterator it = findRawHeader("Content-Range"); - if (it != rawHeaders.constEnd()) { - int index = it->second.lastIndexOf('/'); - if (index != -1) - totalSize = it->second.mid(index + 1).toLongLong() - preMigrationDownloaded; - } - } - if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); @@ -812,8 +803,8 @@ bool QNetworkReplyImplPrivate::migrateBackend() if (state == Finished || state == Aborted) return true; - // Resume only supported by http backend, not migrating. - if (!qobject_cast(backend)) + // Backend does not support resuming download. + if (!backend->canResume()) return false; // Request has outgoing data, not migrating. @@ -824,11 +815,6 @@ bool QNetworkReplyImplPrivate::migrateBackend() if (copyDevice) return true; - // Range header is not supported by server/resource, can't migrate. - RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); - if (it == rawHeaders.constEnd() || it->second == "none") - return false; - state = QNetworkReplyImplPrivate::Reconnecting; if (backend) { @@ -841,13 +827,12 @@ bool QNetworkReplyImplPrivate::migrateBackend() preMigrationDownloaded = bytesDownloaded; - request.setRawHeader("Range", "bytes=" + QByteArray::number(preMigrationDownloaded) + '-'); - backend = manager->d_func()->findBackend(operation, request); if (backend) { backend->setParent(q); backend->reply = this; + backend->setResumeOffset(bytesDownloaded); } if (qobject_cast(backend)) { -- cgit v0.12 From c08afbfd96d7b8205fd2d0ff3e3e28f76aa3323f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 12 Feb 2010 15:03:50 +1000 Subject: Fix build on Windows. On Windows interface is #defined to struct. Make sure that qnetworksession.h is included before qplatformdefs.h. --- src/network/access/qnetworkaccessbackend.cpp | 1 + src/network/access/qnetworkaccessbackend_p.h | 1 - src/network/access/qnetworkaccessmanager.cpp | 3 ++- src/network/access/qnetworkreplyimpl.cpp | 1 + src/network/bearer/qnetworksession.h | 1 - 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 1d23cdc..4441993 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -46,6 +46,7 @@ #include "qnetworkreply_p.h" #include "QtCore/qhash.h" #include "QtCore/qmutex.h" +#include "QtNetwork/qnetworksession.h" #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index eab011c..9bc15e5 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -54,7 +54,6 @@ // #include "qnetworkreplyimpl_p.h" -#include "QtNetwork/qnetworksession.h" #include "QtCore/qobject.h" QT_BEGIN_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 312f744..bb5ff6c 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -47,6 +47,8 @@ #include "qnetworkcookie.h" #include "qabstractnetworkcache.h" +#include "QtNetwork/qnetworksession.h" + #include "qnetworkaccesshttpbackend_p.h" #include "qnetworkaccessftpbackend_p.h" #include "qnetworkaccessfilebackend_p.h" @@ -60,7 +62,6 @@ #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qnetworkconfigmanager.h" -#include "QtNetwork/qnetworksession.h" QT_BEGIN_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 2906caa..8951d08 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -46,6 +46,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qdatetime.h" #include "QtNetwork/qsslconfiguration.h" +#include "QtNetwork/qnetworksession.h" #include "qnetworkaccesshttpbackend_p.h" #include "qnetworkaccessmanager_p.h" diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 3c8d913..1c0dce0 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -43,7 +43,6 @@ #define QNETWORKSESSION_H #include -#include #include #include #include -- cgit v0.12 From ddd65592cae3b1ec4ea64c721c44c3ac2fee4660 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 12 Feb 2010 15:12:48 +1000 Subject: Fix build on Windows, typo. --- src/plugins/bearer/nla/nla.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 5ba171e..5148b09 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -12,7 +12,7 @@ QT += network HEADERS += qnlaengine.h \ ../platformdefs_win.h \ ../qnetworksession_impl.h \ - ../qbeaerengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qnlaengine.cpp \ -- cgit v0.12 From 21aeae2a2258ab8e5083a0607c3b98579bf6fc58 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 13:03:24 +1000 Subject: Expand documentation for QNAM::setConfiguration() and friends. --- .../src_network_access_qnetworkaccessmanager.cpp | 9 ++++++ src/network/access/qnetworkaccessmanager.cpp | 33 +++++++++++++++++++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp b/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp index 643d0dd..5db6676 100644 --- a/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp +++ b/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp @@ -60,3 +60,12 @@ connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), connect(reply, SIGNAL(sslErrors(QList)), this, SLOT(slotSslErrors(QList))); //! [1] + +//! [2] +QNetworkConfigurationManager manager; +networkAccessManager->setConfiguration(manager.defaultConfiguration()); +//! [2] + +//! [3] +networkAccessManager->setConfiguration(QNetworkConfiguration()); +//! [3] diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index d9ad085..69b57e5 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -710,9 +710,25 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ /*! \since 4.7 - Sets the network configuration that will be used when creating a network session to \a config. + Sets the network configuration that will be used when creating the + \l {QNetworkSession}{network session} to \a config. - \sa configuration() + The network configuration is used to create and open a network session before any request that + requires network access is process. If no network configuration is explicitly set via this + function the network configuration returned by + QNetworkConfigurationManager::defaultConfiguration() will be used. + + To restore the default network configuration set the network configuration to the value + returned from QNetworkConfigurationManager::defaultConfiguration(). + + \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 2 + + If an invalid network configuration is set, a network session will not be created. In this + case network requests will be processed regardless, but may fail. For example: + + \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 3 + + \sa configuration(), QNetworkSession */ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) { @@ -722,9 +738,10 @@ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config /*! \since 4.7 - Returns the network configuration. + Returns the network configuration that will be used to create the + \l {QNetworkSession}{network session} which will be used when processing network requests. - \sa setConfiguration() + \sa setConfiguration(), activeConfiguration() */ QNetworkConfiguration QNetworkAccessManager::configuration() const { @@ -741,6 +758,14 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const Returns the current active network configuration. + If the network configuration returned by configuration() is of type + QNetworkConfiguration::ServiceNetwork this function will return the current active child + network configuration of that configuration. Otherwise returns the same network configuration + as configuration(). + + Use this function to return the actual network configuration currently in use by the network + session. + \sa configuration() */ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const -- cgit v0.12 From 1afc8234c3a0ab38671f6078cf6a865ba81c73f7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 14:18:42 +1000 Subject: Reorder members to remove hole. --- src/network/access/qnetworkaccessmanager_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 568894c..8a1f19d 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -75,9 +75,9 @@ public: #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif - cookieJarCreated(false), networkSession(0), - networkAccessEnabled(true) + networkAccessEnabled(true), + cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -119,11 +119,11 @@ public: QNetworkProxyFactory *proxyFactory; #endif - bool cookieJarCreated; - QNetworkSession *networkSession; bool networkAccessEnabled; + bool cookieJarCreated; + // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. QNetworkAccessCache objectCache; -- cgit v0.12 From 4089401868dd62972a750c3e668a2998071de97c Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 15:17:55 +1000 Subject: Use snippets. --- .../src_network_bearer_qnetworkconfigmanager.cpp | 49 ++++++++++++++++++++++ src/network/bearer/qnetworkconfigmanager.cpp | 9 +--- 2 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 doc/src/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp diff --git a/doc/src/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp b/doc/src/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp new file mode 100644 index 0000000..e2cc4df --- /dev/null +++ b/doc/src/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +QNetworkConfigurationManager mgr; +QList activeConfigs = mgr.allConfigurations(QNetworkConfiguration::Active) +if (activeConfigs.count() > 0) + Q_ASSERT(mgr.isOnline()) +else + Q_ASSERT(!mgr.isOnline()) +//! [0] diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 8ca2537..2e37e01 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -296,14 +296,7 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( This is equivalent to the following code snippet: - \code - QNetworkConfigurationManager mgr; - QList activeConfigs = mgr.allConfigurations(QNetworkConfiguration::Active) - if (activeConfigs.count() > 0) - Q_ASSERT(mgr.isOnline()) - else - Q_ASSERT(!mgr.isOnline()) - \endcode + \snippet doc/src/snippets/code/src_network_bearer_qnetworkconfigmanager.cpp 0 \sa onlineStateChanged() */ -- cgit v0.12 From 4fb59e0a8d40083f545dd43a370bd6d7b7b4cd35 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 15:18:26 +1000 Subject: Optimise iterations over QHash. --- src/network/bearer/qbearerengine.cpp | 25 ++++++++++----------- src/network/bearer/qnetworkconfigmanager.cpp | 20 ++++++++--------- src/network/bearer/qnetworkconfigmanager_p.cpp | 30 +++++++++++++++----------- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index bd2ca6c..58d64f2 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -50,22 +50,23 @@ QBearerEngine::QBearerEngine(QObject *parent) QBearerEngine::~QBearerEngine() { - foreach (const QString &oldIface, snapConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); + QHash::Iterator it; + QHash::Iterator end; + for (it = snapConfigurations.begin(), end = snapConfigurations.end(); it != end; ++it) { + it.value()->isValid = false; + it.value()->id.clear(); } - foreach (const QString &oldIface, accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); + for (it = accessPointConfigurations.begin(), end = accessPointConfigurations.end(); + it != end; ++it) { + it.value()->isValid = false; + it.value()->id.clear(); } - foreach (const QString &oldIface, userChoiceConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); + for (it = userChoiceConfigurations.begin(), end = userChoiceConfigurations.end(); + it != end; ++it) { + it.value()->isValid = false; + it.value()->id.clear(); } } diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 2e37e01..f54a985 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -235,25 +235,25 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QNetworkConfigurationManagerPrivate* conPriv = connManager(); foreach (QBearerEngine *engine, conPriv->sessionEngines) { - QStringList cpsIdents = engine->accessPointConfigurations.keys(); + QHash::Iterator it; + QHash::Iterator end; //find all InternetAccessPoints - foreach (const QString &ii, cpsIdents) { - QNetworkConfigurationPrivatePointer p = engine->accessPointConfigurations.value(ii); - if ((p->state & filter) == filter) { + for (it = engine->accessPointConfigurations.begin(), + end = engine->accessPointConfigurations.end(); it != end; ++it) { + if ((it.value()->state & filter) == filter) { QNetworkConfiguration pt; - pt.d = engine->accessPointConfigurations.value(ii); + pt.d = it.value(); result << pt; } } //find all service networks - cpsIdents = engine->snapConfigurations.keys(); - foreach (const QString &ii, cpsIdents) { - QNetworkConfigurationPrivatePointer p = engine->snapConfigurations.value(ii); - if ((p->state & filter) == filter) { + for (it = engine->snapConfigurations.begin(), + end = engine->snapConfigurations.end(); it != end; ++it) { + if ((it.value()->state & filter) == filter) { QNetworkConfiguration pt; - pt.d = engine->snapConfigurations.value(ii); + pt.d = it.value(); result << pt; } } diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 01a85a5..b7a30b8 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -244,16 +244,19 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( QNetworkConfigurationPrivatePointer firstDiscovered; foreach (QBearerEngine *engine, sessionEngines) { - foreach (const QString &id, engine->snapConfigurations.keys()) { - QNetworkConfigurationPrivatePointer ptr = engine->snapConfigurations.value(id); + QHash::Iterator it; + QHash::Iterator end; - if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + for (it = engine->snapConfigurations.begin(), end = engine->snapConfigurations.end(); + it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { QNetworkConfiguration config; - config.d = ptr; + config.d = it.value(); return config; - } else if ((ptr->state & QNetworkConfiguration::Discovered) == + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - firstDiscovered = ptr; + firstDiscovered = it.value(); } } } @@ -269,16 +272,19 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( firstDiscovered.reset(); foreach (QBearerEngine *engine, sessionEngines) { - foreach (const QString &id, engine->accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer ptr = engine->accessPointConfigurations.value(id); + QHash::Iterator it; + QHash::Iterator end; - if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + for (it = engine->accessPointConfigurations.begin(), + end = engine->accessPointConfigurations.end(); it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { QNetworkConfiguration config; - config.d = ptr; + config.d = it.value(); return config; - } else if ((ptr->state & QNetworkConfiguration::Discovered) == + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - firstDiscovered = ptr; + firstDiscovered = it.value(); } } } -- cgit v0.12 From 868d5fc208acbe9579b2c70637cccdd355263c11 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 15:24:24 +1000 Subject: Simplify. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index b7a30b8..4367654 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -55,8 +55,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() { - while (!sessionEngines.isEmpty()) - delete sessionEngines.takeFirst(); + qDeleteAll(sessionEngines); } void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) -- cgit v0.12 From af9843fe530d4c09226cc45b223bbf357e6bfb41 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 15:30:39 +1000 Subject: Remove unused code. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 56 -------------------------- src/network/bearer/qnetworkconfigmanager_p.h | 3 -- 2 files changed, 59 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 4367654..bc354c1 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -109,62 +109,6 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura emit onlineStateChanged(online); } -void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() -{ -#if 0 - if (!generic->snapConfigurations.contains(QLatin1String("Internet Service Network"))) { - QNetworkConfigurationPrivate *serviceNetwork = new QNetworkConfigurationPrivate; - serviceNetwork->name = tr("Internet"); - serviceNetwork->isValid = true; - serviceNetwork->id = QLatin1String("Internet Service Network"); - serviceNetwork->state = QNetworkConfiguration::Defined; - serviceNetwork->type = QNetworkConfiguration::ServiceNetwork; - - QNetworkConfigurationPrivatePointer ptr(serviceNetwork); - - generic->snapConfigurations.insert(serviceNetwork->id, ptr); - - if (!firstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } - - QNetworkConfigurationPrivatePointer ptr = - generic->snapConfigurations.value(QLatin1String("Internet Service Network")); - - QList serviceNetworkMembers; - - QHash::const_iterator i = - generic->accessPointConfigurations.constBegin(); - - QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; - while (i != generic->accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivatePointer child = i.value(); - - if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) - == QNetworkConfiguration::Defined)) { - serviceNetworkMembers.append(child); - - state |= child.data()->state; - } - - ++i; - } - - - if (ptr.data()->state != state || ptr.data()->serviceNetworkMembers != serviceNetworkMembers) { - ptr.data()->state = state; - ptr.data()->serviceNetworkMembers = serviceNetworkMembers; - - QNetworkConfiguration item; - item.d = ptr; - emit configurationChanged(item); - } -#endif -} - void QNetworkConfigurationManagerPrivate::updateConfigurations() { if (firstUpdate) { diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index f6603ce..e178c2d 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -90,9 +90,6 @@ Q_SIGNALS: void configurationChanged(const QNetworkConfiguration& config); void onlineStateChanged(bool isOnline); -private: - void updateInternetServiceConfiguration(); - void abort(); public: -- cgit v0.12 From dce74fe14ceb0e297850c73bfa7e7f4938eedd35 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 15 Feb 2010 15:35:17 +1000 Subject: Change docs: "phone" -> "device". --- src/network/bearer/qnetworkconfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 8c11d9c..c551dc5 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -157,7 +157,7 @@ QT_BEGIN_NAMESPACE QNetworkSession. An example of a discovered configuration could be a WLAN which is within in range. If the device moves out of range the discovered flag is dropped. A second example is a GPRS configuration which generally - remains discovered for as long as the phone has network coverage. A + remains discovered for as long as the device has network coverage. A configuration that has this state is also in state QNetworkConfiguration::Defined. If the configuration is a service network this flag is set if at least one of the underlying access points -- cgit v0.12 From f8c5151b96a6c1961e90fd3162975357cac3f06b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 09:43:32 +1000 Subject: Add QT_MODULE headers. --- src/network/bearer/qnetworkconfigmanager.h | 2 ++ src/network/bearer/qnetworkconfiguration.h | 2 ++ src/network/bearer/qnetworksession.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index a34e456..73041fe 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -49,6 +49,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Network) + class QNetworkConfigurationManagerPrivate; class Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject { diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index 8d45cf6..dad6198 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -51,6 +51,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Network) + class QNetworkConfigurationPrivate; class Q_NETWORK_EXPORT QNetworkConfiguration { diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 1c0dce0..18437f6 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -52,6 +52,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Network) + class QNetworkSessionPrivate; class Q_NETWORK_EXPORT QNetworkSession : public QObject { -- cgit v0.12 From 6ade9920551f16154dda548041b5ba7bbddf78eb Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 10:17:48 +1000 Subject: Always build generic plugin when building NetworkManager plugin. --- src/plugins/bearer/bearer.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 95c9851..6ce1f0d 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,6 +1,8 @@ TEMPLATE = subdirs -!maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager +!maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager) { + SUBDIRS += networkmanager generic +} win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan -- cgit v0.12 From 4b47b11f2c504961d7d4dff164c3f015f4bd9445 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 10:25:34 +1000 Subject: Don't block forever if no bearer plugins are loaded. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index bc354c1..141d522 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -244,6 +244,11 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() { + if (sessionEngines.isEmpty()) { + emit configurationUpdateComplete(); + return; + } + updating = true; for (int i = 0; i < sessionEngines.count(); ++i) { -- cgit v0.12 From 81c7817ecb83e2dcbbdae59607bdc1311b9ef38f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 10:34:22 +1000 Subject: Make this a warning. --- .../auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 48db6cb..1cafa47 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -182,8 +182,8 @@ void tst_QNetworkSession::cleanupTestCase() if (!(manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport) && (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces) && inProcessSessionManagementCount == 0) { - QFAIL("No usable configurations found to complete all possible " - "tests in inProcessSessionManagement()"); + qWarning("No usable configurations found to complete all possible tests in " + "inProcessSessionManagement()"); } #ifdef Q_WS_MAEMO_6 -- cgit v0.12 From 4f7dc1642d66850deed0395f8b713af7a21d8957 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 10:55:58 +1000 Subject: Remove debug output. --- src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index f7fedbf..7617e94 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -624,7 +624,7 @@ QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, dbusConnection); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find NetworkManagerSettings"; + //qWarning() << "Could not find NetworkManagerSettings"; return; } d->valid = true; @@ -689,7 +689,7 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri NM_DBUS_IFACE_SETTINGS_CONNECTION, dbusConnection, parent); if (!d->connectionInterface->isValid()) { - qWarning() << "Could not find NetworkManagerSettingsConnection"; + //qWarning() << "Could not find NetworkManagerSettingsConnection"; d->valid = false; return; } @@ -921,7 +921,7 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find NetworkManagerSettingsConnection"; + //qWarning() << "Could not find NetworkManagerSettingsConnection"; return; } d->valid = true; @@ -1022,7 +1022,7 @@ QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectP dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find NetworkManagerIp4Config"; + //qWarning() << "Could not find NetworkManagerIp4Config"; return; } d->valid = true; -- cgit v0.12 From 13a880f23b01856770a3afc12b1a47121ef04349 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 11:21:28 +1000 Subject: Fix segfault. manager may be 0. --- src/network/access/qnetworkreplyimpl.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 8951d08..2175686 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -549,21 +549,24 @@ void QNetworkReplyImplPrivate::finished() QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; - QNetworkSession *session = manager->d_func()->networkSession; - if (session && session->state() == QNetworkSession::Roaming && - state == Working && errorCode != QNetworkReply::OperationCanceledError) { - // only content with a known size will fail with a temporary network failure error - if (!totalSize.isNull()) { - if (bytesDownloaded != totalSize) { - if (migrateBackend()) { - // either we are migrating or the request is finished/aborted - if (state == Reconnecting || state == WaitingForSession) { - resumeNotificationHandling(); - return; // exit early if we are migrating. + + if (!manager.isNull()) { + QNetworkSession *session = manager->d_func()->networkSession; + if (session && session->state() == QNetworkSession::Roaming && + state == Working && errorCode != QNetworkReply::OperationCanceledError) { + // only content with a known size will fail with a temporary network failure error + if (!totalSize.isNull()) { + if (bytesDownloaded != totalSize) { + if (migrateBackend()) { + // either we are migrating or the request is finished/aborted + if (state == Reconnecting || state == WaitingForSession) { + resumeNotificationHandling(); + return; // exit early if we are migrating. + } + } else { + error(QNetworkReply::TemporaryNetworkFailureError, + q->tr("Temporary network failure.")); } - } else { - error(QNetworkReply::TemporaryNetworkFailureError, - q->tr("Temporary network failure.")); } } } -- cgit v0.12 From 0d950606bf2d4e8d63d552420c7517eea69b3a83 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 13:47:31 +1000 Subject: Fix QNetworkSession unit test. Make sure test can find lackey process. Always connect lackey to tests IPC socket. --- tests/auto/qnetworksession/lackey/lackey.pro | 6 +++++- tests/auto/qnetworksession/lackey/main.cpp | 16 ++++++++-------- .../tst_qnetworksession/tst_qnetworksession.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index 3ed9850..8fbdd58 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -1,8 +1,12 @@ SOURCES += main.cpp -TARGET = qnetworksessionlackey +TARGET = lackey QT = core network +DESTDIR = ./ + +win32:CONFIG += console + symbian { # Needed for interprocess communication and opening QNetworkSession TARGET.CAPABILITY = NetworkControl NetworkServices diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 1e40485..41e935a 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -59,6 +59,14 @@ int main(int argc, char** argv) { QCoreApplication app(argc, argv); + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + + QLocalSocket oopSocket; + + oopSocket.connectToServer("tst_qnetworksession"); + oopSocket.waitForConnected(-1); + QNetworkConfigurationManager manager; QList discovered = #if defined (Q_OS_SYMBIAN) @@ -72,14 +80,6 @@ int main(int argc, char** argv) return NO_DISCOVERED_CONFIGURATIONS_ERROR; } - // Cannot read/write to processes on WinCE or Symbian. - // Easiest alternative is to use sockets for IPC. - - QLocalSocket oopSocket; - - oopSocket.connectToServer("tst_qnetworksession"); - oopSocket.waitForConnected(-1); - qDebug() << "Lackey started"; QNetworkSession *session = 0; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 1cafa47..4ef3a4f 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -836,7 +836,7 @@ void tst_QNetworkSession::outOfProcessSession() qDebug() << "starting lackey"; QProcess lackey; - lackey.start("qnetworksessionlackey"); + lackey.start("lackey/lackey"); qDebug() << lackey.error() << lackey.errorString(); QVERIFY(lackey.waitForStarted()); -- cgit v0.12 From d1d81d48dff6b3285d9016d8f3354630926463d8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Feb 2010 12:48:07 +1000 Subject: Disable NLA plugin, build generic on win32 and mac. The NLA plugin locks up on exit for some programs, though not all. Disable for now until cause is found. Always build generic plugin on win32 and mac. --- src/plugins/bearer/bearer.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 6ce1f0d..7ba62b3 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -3,9 +3,11 @@ TEMPLATE = subdirs !maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager) { SUBDIRS += networkmanager generic } -win32:SUBDIRS += nla +#win32:SUBDIRS += nla +win32:SUBDIRS += generic win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan +macx:SUBDIRS += generic symbian:SUBDIRS += symbian maemo6:contains(QT_CONFIG, dbus):SUBDIRS += icd -- cgit v0.12 From 49f63d8f37fcd45ebe527f3554ff7b4c34d8545e Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 18 Feb 2010 10:12:24 +1000 Subject: Don't load NetworkManager plugin in NetworkManager is not available. --- src/plugins/bearer/networkmanager/main.cpp | 13 +++++++++---- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 ++++++++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ .../bearer/networkmanager/qnetworkmanagerservice.cpp | 3 +-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index f62b847..6c97a22 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -72,10 +72,15 @@ QStringList QNetworkManagerEnginePlugin::keys() const QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const { - if (key == QLatin1String("networkmanager")) - return new QNetworkManagerEngine; - else - return 0; + if (key == QLatin1String("networkmanager")) { + QNetworkManagerEngine *engine = new QNetworkManagerEngine; + if (engine->networkManagerAvailable()) + return engine; + else + delete engine; + } + + return 0; } Q_EXPORT_STATIC_PLUGIN(QNetworkManagerEnginePlugin) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 3f3e1bd..4c8928c 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -65,6 +65,9 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) { + if (!interface->isValid()) + return; + interface->setConnections(); connect(interface, SIGNAL(deviceAdded(QDBusObjectPath)), this, SLOT(deviceAdded(QDBusObjectPath))); @@ -115,6 +118,11 @@ QNetworkManagerEngine::~QNetworkManagerEngine() { } +bool QNetworkManagerEngine::networkManagerAvailable() const +{ + return interface->isValid(); +} + void QNetworkManagerEngine::doRequestUpdate() { emit updateCompleted(); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 70efc05..ca1f857 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -70,6 +70,8 @@ public: QNetworkManagerEngine(QObject *parent = 0); ~QNetworkManagerEngine(); + bool networkManagerAvailable() const; + QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 7617e94..5dc0ea4 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -78,7 +78,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) NM_DBUS_INTERFACE, dbusConnection); if (!d->connectionInterface->isValid()) { - qWarning() << "Could not find NetworkManager"; d->valid = false; return; } @@ -321,7 +320,7 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de dbusConnection); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find NetworkManager"; + qWarning() << "Could not find NetworkManagerInterfaceDevice"; return; } d->valid = true; -- cgit v0.12 From e0eb03ec78330b5b2bd064267db71992d81d88c5 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 18 Feb 2010 14:24:20 +1000 Subject: Allow QNAM to be created as a global variable. QNetworkConfigurationManager cannot be loaded before QApplication as the plugins it loads may create timers. Which fail because timers can only be created in threads created with QThread. --- src/network/access/qnetworkaccessmanager.cpp | 10 +++++++--- src/network/access/qnetworkaccessmanager_p.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 69b57e5..ea60f98 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -386,9 +386,6 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) : QObject(*new QNetworkAccessManagerPrivate, parent) { ensureInitialized(); - - QNetworkConfigurationManager manager; - d_func()->createSession(manager.defaultConfiguration()); } /*! @@ -847,6 +844,13 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QDisabledNetworkReply(this, req, op); } + if (d->initializeSession && !d->networkSession) { + QNetworkConfigurationManager manager; + d->createSession(manager.defaultConfiguration()); + + d->initializeSession = false; + } + QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && outgoingData && !outgoingData->isSequential()) { diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 8a1f19d..8d772f0 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -77,6 +77,7 @@ public: #endif networkSession(0), networkAccessEnabled(true), + initializeSession(true), cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -121,6 +122,7 @@ public: QNetworkSession *networkSession; bool networkAccessEnabled; + bool initializeSession; bool cookieJarCreated; -- cgit v0.12 From 46e84339a9eaf1587528c20a4c9e05bc1b549afd Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 19 Feb 2010 12:02:29 +1000 Subject: Create unit-test in parent directory. --- tests/auto/qnetworksession/qnetworksession.pro | 2 +- tests/auto/qnetworksession/test/test.pro | 26 + .../qnetworksession/test/tst_qnetworksession.cpp | 919 +++++++++++++++++++++ .../tst_qnetworksession/tst_qnetworksession.cpp | 919 --------------------- .../tst_qnetworksession/tst_qnetworksession.pro | 15 - 5 files changed, 946 insertions(+), 935 deletions(-) create mode 100644 tests/auto/qnetworksession/test/test.pro create mode 100644 tests/auto/qnetworksession/test/tst_qnetworksession.cpp delete mode 100644 tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp delete mode 100644 tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro diff --git a/tests/auto/qnetworksession/qnetworksession.pro b/tests/auto/qnetworksession/qnetworksession.pro index 14dbb3e..a85925b 100644 --- a/tests/auto/qnetworksession/qnetworksession.pro +++ b/tests/auto/qnetworksession/qnetworksession.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = lackey tst_qnetworksession +SUBDIRS = lackey test diff --git a/tests/auto/qnetworksession/test/test.pro b/tests/auto/qnetworksession/test/test.pro new file mode 100644 index 0000000..d248b10 --- /dev/null +++ b/tests/auto/qnetworksession/test/test.pro @@ -0,0 +1,26 @@ +load(qttest_p4) +SOURCES += tst_qnetworksession.cpp +HEADERS += ../../qbearertestcommon.h + +QT = core network + +TARGET = tst_qnetworksession +CONFIG(debug_and_release) { + CONFIG(debug, debug|release) { + DESTDIR = ../debug + } else { + DESTDIR = ../release + } +} else { + DESTDIR = .. +} + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData PowerMgmt +} + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp new file mode 100644 index 0000000..4ef3a4f --- /dev/null +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -0,0 +1,919 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "../../qbearertestcommon.h" +#include +#include + +#ifdef Q_WS_MAEMO_6 +#include +#include +#endif + +QT_USE_NAMESPACE + +Q_DECLARE_METATYPE(QNetworkConfiguration) +Q_DECLARE_METATYPE(QNetworkSession::State); +Q_DECLARE_METATYPE(QNetworkSession::SessionError); + +class tst_QNetworkSession : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + +private slots: + + void outOfProcessSession(); + void invalidSession(); + + void sessionProperties_data(); + void sessionProperties(); + + void userChoiceSession_data(); + void userChoiceSession(); + + void sessionOpenCloseStop_data(); + void sessionOpenCloseStop(); + +private: + QNetworkConfigurationManager manager; + + int inProcessSessionManagementCount; + +#ifdef Q_WS_MAEMO_6 + Maemo::IAPConf *iapconf; + Maemo::IAPConf *iapconf2; + Maemo::IAPConf *gprsiap; +#define MAX_IAPS 10 + Maemo::IAPConf *iaps[MAX_IAPS]; + QProcess *icd_stub; +#endif +}; + +void tst_QNetworkSession::initTestCase() +{ + qRegisterMetaType("QNetworkSession::State"); + qRegisterMetaType("QNetworkSession::SessionError"); + qRegisterMetaType("QNetworkConfiguration"); + +#ifdef Q_WS_MAEMO_6 + iapconf = new Maemo::IAPConf("007"); + iapconf->setValue("ipv4_type", "AUTO"); + iapconf->setValue("wlan_wepkey1", "connt"); + iapconf->setValue("wlan_wepdefkey", 1); + iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); + iapconf->setValue("name", "James Bond"); + iapconf->setValue("type", "WLAN_INFRA"); + + gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); + gprsiap->setValue("ask_password", false); + gprsiap->setValue("gprs_accesspointname", "internet"); + gprsiap->setValue("gprs_password", ""); + gprsiap->setValue("gprs_username", ""); + gprsiap->setValue("ipv4_autodns", true); + gprsiap->setValue("ipv4_type", "AUTO"); + gprsiap->setValue("sim_imsi", "244070123456789"); + gprsiap->setValue("name", "MI6"); + gprsiap->setValue("type", "GPRS"); + + iapconf2 = new Maemo::IAPConf("osso.net"); + iapconf2->setValue("ipv4_type", "AUTO"); + iapconf2->setValue("wlan_wepkey1", "osso.net"); + iapconf2->setValue("wlan_wepdefkey", 1); + iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); + iapconf2->setValue("name", "osso.net"); + iapconf2->setValue("type", "WLAN_INFRA"); + iapconf2->setValue("wlan_security", "WEP"); + + /* Create large number of IAPs in the gconf and see what happens */ + fflush(stdout); + printf("Creating %d IAPS: ", MAX_IAPS); + for (int i=0; isetValue("name", QString("test-iap-")+num); + iaps[i]->setValue("type", "WLAN_INFRA"); + iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); + iaps[i]->setValue("wlan_security", "WPA_PSK"); + iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); + printf("."); + fflush(stdout); + } + printf("\n"); + fflush(stdout); + + icd_stub = new QProcess(this); + icd_stub->start("/usr/bin/icd2_stub.py"); + QTest::qWait(1000); + + // Add a known network to scan list that icd2 stub returns + QProcess dbus_send; + // 007 network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); + dbus_send.waitForFinished(); + + // osso.net network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); + dbus_send.waitForFinished(); +#endif + + inProcessSessionManagementCount = -1; + + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); + QTRY_VERIFY(spy.count() == 1); +} + +void tst_QNetworkSession::cleanupTestCase() +{ + if (!(manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport) && + (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces) && + inProcessSessionManagementCount == 0) { + qWarning("No usable configurations found to complete all possible tests in " + "inProcessSessionManagement()"); + } + +#ifdef Q_WS_MAEMO_6 + iapconf->clear(); + delete iapconf; + iapconf2->clear(); + delete iapconf2; + gprsiap->clear(); + delete gprsiap; + + printf("Deleting %d IAPS : ", MAX_IAPS); + for (int i=0; iclear(); + delete iaps[i]; + printf("."); + fflush(stdout); + } + printf("\n"); + qDebug() << "Deleted" << MAX_IAPS << "IAPs"; + + icd_stub->terminate(); + icd_stub->waitForFinished(); +#endif +} + +void tst_QNetworkSession::invalidSession() +{ + QNetworkSession session(QNetworkConfiguration(), 0); + QVERIFY(!session.isOpen()); + QVERIFY(session.state() == QNetworkSession::Invalid); +} + +void tst_QNetworkSession::sessionProperties_data() +{ + QTest::addColumn("configuration"); + + QTest::newRow("invalid configuration") << QNetworkConfiguration(); + + foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { + const QString name = config.name().isEmpty() ? QString("") : config.name(); + QTest::newRow(name.toLocal8Bit().constData()) << config; + } +} + +void tst_QNetworkSession::sessionProperties() +{ + QFETCH(QNetworkConfiguration, configuration); + + QNetworkSession session(configuration); + + QVERIFY(session.configuration() == configuration); + + QStringList validBearerNames = QStringList() << QLatin1String("Unknown") + << QLatin1String("Ethernet") + << QLatin1String("WLAN") + << QLatin1String("2G") + << QLatin1String("CDMA2000") + << QLatin1String("WCDMA") + << QLatin1String("HSPA") + << QLatin1String("Bluetooth") + << QLatin1String("WiMAX"); + + if (!configuration.isValid()) { + QVERIFY(configuration.bearerName().isEmpty()); + } else { + qDebug() << "Type:" << configuration.type() + << "Bearer:" << configuration.bearerName(); + + switch (configuration.type()) + { + case QNetworkConfiguration::ServiceNetwork: + case QNetworkConfiguration::UserChoice: + default: + QVERIFY(configuration.bearerName().isEmpty()); + break; + case QNetworkConfiguration::InternetAccessPoint: + QVERIFY(validBearerNames.contains(configuration.bearerName())); + break; + } + } + + // QNetworkSession::interface() should return an invalid interface unless + // session is in the connected state. + qDebug() << "Session state:" << session.state(); + qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited + QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); +#endif + + if (!configuration.isValid()) { + QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && + session.state() == QNetworkSession::Invalid); + } else { + switch (configuration.state()) { + case QNetworkConfiguration::Undefined: + QVERIFY(session.state() == QNetworkSession::NotAvailable); + break; + case QNetworkConfiguration::Defined: + QVERIFY(session.state() == QNetworkSession::NotAvailable); + break; + case QNetworkConfiguration::Discovered: + QVERIFY(session.state() == QNetworkSession::Connecting || + session.state() == QNetworkSession::Disconnected); + break; + case QNetworkConfiguration::Active: + QVERIFY(session.state() == QNetworkSession::Connected || + session.state() == QNetworkSession::Closing || + session.state() == QNetworkSession::Roaming); + break; + default: + QFAIL("Invalid configuration state"); + }; + } +} + +void tst_QNetworkSession::userChoiceSession_data() +{ + QTest::addColumn("configuration"); + + QNetworkConfiguration config = manager.defaultConfiguration(); + if (config.type() == QNetworkConfiguration::UserChoice) + QTest::newRow("UserChoice") << config; + else + QSKIP("Default configuration is not a UserChoice configuration.", SkipAll); +} + +void tst_QNetworkSession::userChoiceSession() +{ + QFETCH(QNetworkConfiguration, configuration); + + QVERIFY(configuration.type() == QNetworkConfiguration::UserChoice); + + QNetworkSession session(configuration); + + // Check that configuration was really set + QVERIFY(session.configuration() == configuration); + + QVERIFY(!session.isOpen()); + + // Check that session is not active + QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); + + // The remaining tests require the session to be not NotAvailable. + if (session.state() == QNetworkSession::NotAvailable) + QSKIP("Network is not available.", SkipSingle); + + QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); + QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); + QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening the session. + { + bool expectStateChange = session.state() != QNetworkSession::Connected; + + session.open(); + + session.waitForOpened(); + + if (session.isOpen()) + QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring up the interface, + // but the operation is not supported. + QSKIP("Configuration does not support open().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring up the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to open session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else if (error == QNetworkSession::UnknownSessionError) { + QSKIP("Unknown session error.", SkipSingle); + } else { + QFAIL("Error opening session."); + } + } else if (!sessionOpenedSpy.isEmpty()) { + QCOMPARE(sessionOpenedSpy.count(), 1); + QVERIFY(sessionClosedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(!stateChangedSpy.isEmpty()); + + QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited + QVERIFY(session.interface().isValid()); +#endif + + const QString userChoiceIdentifier = + session.sessionProperty("UserChoiceConfiguration").toString(); + + QVERIFY(!userChoiceIdentifier.isEmpty()); + QVERIFY(userChoiceIdentifier != configuration.identifier()); + + QNetworkConfiguration userChoiceConfiguration = + manager.configurationFromIdentifier(userChoiceIdentifier); + + QVERIFY(userChoiceConfiguration.isValid()); + QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); + + const QString testIdentifier("abc"); + //resetting UserChoiceConfiguration is ignored (read only property) + session.setSessionProperty("UserChoiceConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier); + + const QString activeIdentifier = + session.sessionProperty("ActiveConfiguration").toString(); + + QVERIFY(!activeIdentifier.isEmpty()); + QVERIFY(activeIdentifier != configuration.identifier()); + + QNetworkConfiguration activeConfiguration = + manager.configurationFromIdentifier(activeIdentifier); + + QVERIFY(activeConfiguration.isValid()); + QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); + + //resetting ActiveConfiguration is ignored (read only property) + session.setSessionProperty("ActiveConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier); + + if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { + QVERIFY(userChoiceConfiguration == activeConfiguration); + } else { + QVERIFY(userChoiceConfiguration.type() == QNetworkConfiguration::ServiceNetwork); + QVERIFY(userChoiceConfiguration.children().contains(activeConfiguration)); + } + } else { + QFAIL("Timeout waiting for session to open."); + } + } +} + +void tst_QNetworkSession::sessionOpenCloseStop_data() +{ + QTest::addColumn("configuration"); + QTest::addColumn("forceSessionStop"); + + foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { + const QString name = config.name().isEmpty() ? QString("") : config.name(); + QTest::newRow((name + QLatin1String(" close")).toLocal8Bit().constData()) + << config << false; + QTest::newRow((name + QLatin1String(" stop")).toLocal8Bit().constData()) + << config << true; + } + + inProcessSessionManagementCount = 0; +} + +void tst_QNetworkSession::sessionOpenCloseStop() +{ + QFETCH(QNetworkConfiguration, configuration); + QFETCH(bool, forceSessionStop); + + QNetworkSession session(configuration); + + // Test initial state of the session. + { + QVERIFY(session.configuration() == configuration); + QVERIFY(!session.isOpen()); + // session may be invalid if configuration is removed between when + // sessionOpenCloseStop_data() is called and here. + QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || + (!configuration.isValid() && (session.state() == QNetworkSession::Invalid))); + QVERIFY(session.error() == QNetworkSession::UnknownSessionError); + } + + // The remaining tests require the session to be not NotAvailable. + if (session.state() == QNetworkSession::NotAvailable) + QSKIP("Network is not available.", SkipSingle); + + QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); + QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); + QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening the session. + { + QNetworkSession::State previousState = session.state(); + bool expectStateChange = previousState != QNetworkSession::Connected; + + session.open(); + + session.waitForOpened(); + + if (session.isOpen()) + QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + + QVERIFY(session.state() == previousState); + + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring up the interface, + // but the operation is not supported. + QSKIP("Configuration does not support open().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring up the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to open session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else if (error == QNetworkSession::UnknownSessionError) { + QSKIP("Unknown Session error.", SkipSingle); + } else { + QFAIL("Error opening session."); + } + } else if (!sessionOpenedSpy.isEmpty()) { + QCOMPARE(sessionOpenedSpy.count(), 1); + QVERIFY(sessionClosedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) { + QTRY_VERIFY(stateChangedSpy.count() >= 2); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy.at(0).at(0)); + QVERIFY(state == QNetworkSession::Connecting); + + state = qvariant_cast(stateChangedSpy.at(1).at(0)); + QVERIFY(state == QNetworkSession::Connected); + } + + QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited + QVERIFY(session.interface().isValid()); +#endif + } else { + QFAIL("Timeout waiting for session to open."); + } + } + + sessionOpenedSpy.clear(); + sessionClosedSpy.clear(); + stateChangedSpy.clear(); + errorSpy.clear(); + + QNetworkSession session2(configuration); + + QSignalSpy sessionOpenedSpy2(&session2, SIGNAL(opened())); + QSignalSpy sessionClosedSpy2(&session2, SIGNAL(closed())); + QSignalSpy stateChangedSpy2(&session2, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy2(&session2, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening a second session. + { + QVERIFY(session2.configuration() == configuration); + QVERIFY(!session2.isOpen()); + QVERIFY(session2.state() == QNetworkSession::Connected); + QVERIFY(session.error() == QNetworkSession::UnknownSessionError); + + session2.open(); + + QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); + + QVERIFY(session.isOpen()); + QVERIFY(session2.isOpen()); + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited + QVERIFY(session.interface().isValid()); +#endif + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } + + sessionOpenedSpy2.clear(); + + if (forceSessionStop) { + // Test forcing the second session to stop the interface. + QNetworkSession::State previousState = session.state(); +#ifdef Q_CC_NOKIAX86 + // For S60 emulator builds: RConnection::Stop does not work on all Emulators + bool expectStateChange = false; +#else + bool expectStateChange = previousState != QNetworkSession::Disconnected; +#endif + + session2.stop(); + + QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); + + QVERIFY(!session2.isOpen()); + + if (!errorSpy2.isEmpty()) { + QVERIFY(!errorSpy.isEmpty()); + + // check for SessionAbortedError + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + QNetworkSession::SessionError error2 = + qvariant_cast(errorSpy2.first().at(0)); + + QVERIFY(error == QNetworkSession::SessionAbortedError); + QVERIFY(error2 == QNetworkSession::SessionAbortedError); + + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy2.count(), 1); + + errorSpy.clear(); + errorSpy2.clear(); + } + + QVERIFY(errorSpy.isEmpty()); + QVERIFY(errorSpy2.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(stateChangedSpy2.count() >= 2 || !errorSpy2.isEmpty()); + + if (!errorSpy2.isEmpty()) { + QVERIFY(session2.state() == previousState); + QVERIFY(session.state() == previousState); + + QNetworkSession::SessionError error = + qvariant_cast(errorSpy2.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring down the interface, + // but the operation is not supported. + QSKIP("Configuration does not support stop().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring down the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to stop session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else { + QFAIL("Error stopping session."); + } + } else if (!sessionClosedSpy2.isEmpty()) { + if (expectStateChange) { + if (configuration.type() == QNetworkConfiguration::ServiceNetwork) { + bool roamedSuccessfully = false; + + QCOMPARE(stateChangedSpy2.count(), 4); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Connecting); + + state = qvariant_cast(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Connected); + + state = qvariant_cast(stateChangedSpy2.at(2).at(0)); + QVERIFY(state == QNetworkSession::Closing); + + state = qvariant_cast(stateChangedSpy2.at(3).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + + QTRY_VERIFY(stateChangedSpy.count() > 0); + state = qvariant_cast(stateChangedSpy.at(0).at(0)); + if (state == QNetworkSession::Roaming) { + QTRY_VERIFY(!errorSpy.isEmpty() || stateChangedSpy.count() > 1); + if (stateChangedSpy.count() > 1) { + state = qvariant_cast(stateChangedSpy.at(1).at(0)); + if (state == QNetworkSession::Connected) { + roamedSuccessfully = true; + QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); + } + } + } + if (roamedSuccessfully) { + QString configId = session.sessionProperty("ActiveConfiguration").toString(); + QNetworkConfiguration config = manager.configurationFromIdentifier(configId); + QNetworkSession session3(config); + QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); + QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); + + session3.open(); + session3.waitForOpened(); + + if (session.isOpen()) + QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); + + session.stop(); + + QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); + QTRY_VERIFY(session3.state() == QNetworkSession::Disconnected); + } +#ifndef Q_CC_NOKIAX86 + if (!roamedSuccessfully) + QVERIFY(!errorSpy.isEmpty()); +#endif + } else { + QCOMPARE(stateChangedSpy2.count(), 2); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Closing); + + state = qvariant_cast(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } + + QTRY_VERIFY(!sessionClosedSpy.isEmpty()); + QVERIFY(session.state() == QNetworkSession::Disconnected); + QVERIFY(session2.state() == QNetworkSession::Disconnected); + } + + QVERIFY(errorSpy2.isEmpty()); + + ++inProcessSessionManagementCount; + } else { + QFAIL("Timeout waiting for session to stop."); + } + +#ifndef Q_CC_NOKIAX86 + QVERIFY(!sessionClosedSpy.isEmpty()); +#endif + QVERIFY(!sessionClosedSpy2.isEmpty()); + +#ifndef Q_CC_NOKIAX86 + QVERIFY(!session.isOpen()); +#endif + QVERIFY(!session2.isOpen()); + } else { + // Test closing the second session. + { + int stateChangedCountBeforeClose = stateChangedSpy2.count(); + session2.close(); + + QTRY_VERIFY(!sessionClosedSpy2.isEmpty()); +#ifndef Q_CC_NOKIAX86 + QVERIFY(stateChangedSpy2.count() == stateChangedCountBeforeClose); +#endif + + QVERIFY(sessionClosedSpy.isEmpty()); + + QVERIFY(session.isOpen()); + QVERIFY(!session2.isOpen()); + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited + QVERIFY(session.interface().isValid()); +#endif + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } + + sessionClosedSpy2.clear(); + + // Test closing the first session. + { +#ifdef Q_CC_NOKIAX86 + // For S60 emulator builds: RConnection::Close does not actually + // close network connection on all Emulators + bool expectStateChange = false; +#else + bool expectStateChange = session.state() != QNetworkSession::Disconnected && + manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport; +#endif + + session.close(); + + QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); + + QVERIFY(!session.isOpen()); + + if (expectStateChange) + QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); + + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring down the interface, + // but the operation is not supported. + QSKIP("Configuration does not support close().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring down the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to close session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else { + QFAIL("Error closing session."); + } + } else if (!sessionClosedSpy.isEmpty()) { + QVERIFY(sessionOpenedSpy.isEmpty()); + QCOMPARE(sessionClosedSpy.count(), 1); + if (expectStateChange) + QVERIFY(!stateChangedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); + + ++inProcessSessionManagementCount; + } else { + QFAIL("Timeout waiting for session to close."); + } + } + } +} + +QDebug operator<<(QDebug debug, const QList &list) +{ + debug.nospace() << "( "; + foreach (const QNetworkConfiguration &config, list) + debug.nospace() << config.identifier() << ", "; + debug.nospace() << ")\n"; + return debug; +} + +// Note: outOfProcessSession requires that at least one configuration is +// at Discovered -state (Defined is ok for symbian as well, as long as it is possible to open). +void tst_QNetworkSession::outOfProcessSession() +{ + qDebug() << "START"; + +#if defined(Q_OS_SYMBIAN) && defined(__WINS__) + QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); +#endif + QNetworkConfigurationManager manager; + // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This + // is actually the essence of this testcase - to check that platform mediates/reflects changes + // regardless of process boundaries. The interprocess communication is more like a way to get + // this test-case act correctly and timely. + QList before = manager.allConfigurations(QNetworkConfiguration::Active); + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); + + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + QLocalServer oopServer; + // First remove possible earlier listening address which would cause listen to fail + // (e.g. previously abruptly ended unit test might cause this) + QLocalServer::removeServer("tst_qnetworksession"); + oopServer.listen("tst_qnetworksession"); + + qDebug() << "starting lackey"; + QProcess lackey; + lackey.start("lackey/lackey"); + qDebug() << lackey.error() << lackey.errorString(); + QVERIFY(lackey.waitForStarted()); + + qDebug() << "waiting for connection"; + QVERIFY(oopServer.waitForNewConnection(-1)); + QLocalSocket *oopSocket = oopServer.nextPendingConnection(); + qDebug() << "got connection"; + do { + QByteArray output; + + if (oopSocket->waitForReadyRead()) + output = oopSocket->readLine().trimmed(); + + if (output.startsWith("Started session ")) { + QString identifier = QString::fromLocal8Bit(output.mid(20).constData()); + QNetworkConfiguration changed; + + do { + QTRY_VERIFY(!spy.isEmpty()); + changed = qvariant_cast(spy.takeFirst().at(0)); + } while (changed.identifier() != identifier); + + QVERIFY((changed.state() & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active); + + QVERIFY(!before.contains(changed)); + + QList after = + manager.allConfigurations(QNetworkConfiguration::Active); + + QVERIFY(after.contains(changed)); + + spy.clear(); + + oopSocket->write("stop\n"); + oopSocket->waitForBytesWritten(); + + do { + QTRY_VERIFY(!spy.isEmpty()); + + changed = qvariant_cast(spy.takeFirst().at(0)); + } while (changed.identifier() != identifier); + + QVERIFY((changed.state() & QNetworkConfiguration::Active) != + QNetworkConfiguration::Active); + + QList afterStop = + manager.allConfigurations(QNetworkConfiguration::Active); + + QVERIFY(!afterStop.contains(changed)); + + oopSocket->disconnectFromServer(); + oopSocket->waitForDisconnected(-1); + + lackey.waitForFinished(); + } + // This is effected by QTBUG-4903, process will always report as running + //} while (lackey.state() == QProcess::Running); + + // Workaround: the socket in the lackey will disconnect on exit + } while (oopSocket->state() == QLocalSocket::ConnectedState); + + switch (lackey.exitCode()) { + case 0: + qDebug("Lackey returned exit success (0)"); + break; + case 1: + QSKIP("No discovered configurations found.", SkipAll); + case 2: + QSKIP("Lackey could not start session.", SkipAll); + default: + QSKIP("Lackey failed", SkipAll); + } + qDebug("STOP"); +} + +QTEST_MAIN(tst_QNetworkSession) + +#include "tst_qnetworksession.moc" + diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp deleted file mode 100644 index 4ef3a4f..0000000 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ /dev/null @@ -1,919 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "../../qbearertestcommon.h" -#include -#include - -#ifdef Q_WS_MAEMO_6 -#include -#include -#endif - -QT_USE_NAMESPACE - -Q_DECLARE_METATYPE(QNetworkConfiguration) -Q_DECLARE_METATYPE(QNetworkSession::State); -Q_DECLARE_METATYPE(QNetworkSession::SessionError); - -class tst_QNetworkSession : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - -private slots: - - void outOfProcessSession(); - void invalidSession(); - - void sessionProperties_data(); - void sessionProperties(); - - void userChoiceSession_data(); - void userChoiceSession(); - - void sessionOpenCloseStop_data(); - void sessionOpenCloseStop(); - -private: - QNetworkConfigurationManager manager; - - int inProcessSessionManagementCount; - -#ifdef Q_WS_MAEMO_6 - Maemo::IAPConf *iapconf; - Maemo::IAPConf *iapconf2; - Maemo::IAPConf *gprsiap; -#define MAX_IAPS 10 - Maemo::IAPConf *iaps[MAX_IAPS]; - QProcess *icd_stub; -#endif -}; - -void tst_QNetworkSession::initTestCase() -{ - qRegisterMetaType("QNetworkSession::State"); - qRegisterMetaType("QNetworkSession::SessionError"); - qRegisterMetaType("QNetworkConfiguration"); - -#ifdef Q_WS_MAEMO_6 - iapconf = new Maemo::IAPConf("007"); - iapconf->setValue("ipv4_type", "AUTO"); - iapconf->setValue("wlan_wepkey1", "connt"); - iapconf->setValue("wlan_wepdefkey", 1); - iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); - iapconf->setValue("name", "James Bond"); - iapconf->setValue("type", "WLAN_INFRA"); - - gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); - gprsiap->setValue("ask_password", false); - gprsiap->setValue("gprs_accesspointname", "internet"); - gprsiap->setValue("gprs_password", ""); - gprsiap->setValue("gprs_username", ""); - gprsiap->setValue("ipv4_autodns", true); - gprsiap->setValue("ipv4_type", "AUTO"); - gprsiap->setValue("sim_imsi", "244070123456789"); - gprsiap->setValue("name", "MI6"); - gprsiap->setValue("type", "GPRS"); - - iapconf2 = new Maemo::IAPConf("osso.net"); - iapconf2->setValue("ipv4_type", "AUTO"); - iapconf2->setValue("wlan_wepkey1", "osso.net"); - iapconf2->setValue("wlan_wepdefkey", 1); - iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); - iapconf2->setValue("name", "osso.net"); - iapconf2->setValue("type", "WLAN_INFRA"); - iapconf2->setValue("wlan_security", "WEP"); - - /* Create large number of IAPs in the gconf and see what happens */ - fflush(stdout); - printf("Creating %d IAPS: ", MAX_IAPS); - for (int i=0; isetValue("name", QString("test-iap-")+num); - iaps[i]->setValue("type", "WLAN_INFRA"); - iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); - iaps[i]->setValue("wlan_security", "WPA_PSK"); - iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); - printf("."); - fflush(stdout); - } - printf("\n"); - fflush(stdout); - - icd_stub = new QProcess(this); - icd_stub->start("/usr/bin/icd2_stub.py"); - QTest::qWait(1000); - - // Add a known network to scan list that icd2 stub returns - QProcess dbus_send; - // 007 network - dbus_send.start("dbus-send --type=method_call --system " - "--dest=com.nokia.icd2 /com/nokia/icd2 " - "com.nokia.icd2.testing.add_available_network " - "string:'' uint32:0 string:'' " - "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); - dbus_send.waitForFinished(); - - // osso.net network - dbus_send.start("dbus-send --type=method_call --system " - "--dest=com.nokia.icd2 /com/nokia/icd2 " - "com.nokia.icd2.testing.add_available_network " - "string:'' uint32:0 string:'' " - "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); - dbus_send.waitForFinished(); -#endif - - inProcessSessionManagementCount = -1; - - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); - QTRY_VERIFY(spy.count() == 1); -} - -void tst_QNetworkSession::cleanupTestCase() -{ - if (!(manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport) && - (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces) && - inProcessSessionManagementCount == 0) { - qWarning("No usable configurations found to complete all possible tests in " - "inProcessSessionManagement()"); - } - -#ifdef Q_WS_MAEMO_6 - iapconf->clear(); - delete iapconf; - iapconf2->clear(); - delete iapconf2; - gprsiap->clear(); - delete gprsiap; - - printf("Deleting %d IAPS : ", MAX_IAPS); - for (int i=0; iclear(); - delete iaps[i]; - printf("."); - fflush(stdout); - } - printf("\n"); - qDebug() << "Deleted" << MAX_IAPS << "IAPs"; - - icd_stub->terminate(); - icd_stub->waitForFinished(); -#endif -} - -void tst_QNetworkSession::invalidSession() -{ - QNetworkSession session(QNetworkConfiguration(), 0); - QVERIFY(!session.isOpen()); - QVERIFY(session.state() == QNetworkSession::Invalid); -} - -void tst_QNetworkSession::sessionProperties_data() -{ - QTest::addColumn("configuration"); - - QTest::newRow("invalid configuration") << QNetworkConfiguration(); - - foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { - const QString name = config.name().isEmpty() ? QString("") : config.name(); - QTest::newRow(name.toLocal8Bit().constData()) << config; - } -} - -void tst_QNetworkSession::sessionProperties() -{ - QFETCH(QNetworkConfiguration, configuration); - - QNetworkSession session(configuration); - - QVERIFY(session.configuration() == configuration); - - QStringList validBearerNames = QStringList() << QLatin1String("Unknown") - << QLatin1String("Ethernet") - << QLatin1String("WLAN") - << QLatin1String("2G") - << QLatin1String("CDMA2000") - << QLatin1String("WCDMA") - << QLatin1String("HSPA") - << QLatin1String("Bluetooth") - << QLatin1String("WiMAX"); - - if (!configuration.isValid()) { - QVERIFY(configuration.bearerName().isEmpty()); - } else { - qDebug() << "Type:" << configuration.type() - << "Bearer:" << configuration.bearerName(); - - switch (configuration.type()) - { - case QNetworkConfiguration::ServiceNetwork: - case QNetworkConfiguration::UserChoice: - default: - QVERIFY(configuration.bearerName().isEmpty()); - break; - case QNetworkConfiguration::InternetAccessPoint: - QVERIFY(validBearerNames.contains(configuration.bearerName())); - break; - } - } - - // QNetworkSession::interface() should return an invalid interface unless - // session is in the connected state. - qDebug() << "Session state:" << session.state(); - qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); -#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) - // On Symbian emulator, the support for data bearers is limited - QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); -#endif - - if (!configuration.isValid()) { - QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && - session.state() == QNetworkSession::Invalid); - } else { - switch (configuration.state()) { - case QNetworkConfiguration::Undefined: - QVERIFY(session.state() == QNetworkSession::NotAvailable); - break; - case QNetworkConfiguration::Defined: - QVERIFY(session.state() == QNetworkSession::NotAvailable); - break; - case QNetworkConfiguration::Discovered: - QVERIFY(session.state() == QNetworkSession::Connecting || - session.state() == QNetworkSession::Disconnected); - break; - case QNetworkConfiguration::Active: - QVERIFY(session.state() == QNetworkSession::Connected || - session.state() == QNetworkSession::Closing || - session.state() == QNetworkSession::Roaming); - break; - default: - QFAIL("Invalid configuration state"); - }; - } -} - -void tst_QNetworkSession::userChoiceSession_data() -{ - QTest::addColumn("configuration"); - - QNetworkConfiguration config = manager.defaultConfiguration(); - if (config.type() == QNetworkConfiguration::UserChoice) - QTest::newRow("UserChoice") << config; - else - QSKIP("Default configuration is not a UserChoice configuration.", SkipAll); -} - -void tst_QNetworkSession::userChoiceSession() -{ - QFETCH(QNetworkConfiguration, configuration); - - QVERIFY(configuration.type() == QNetworkConfiguration::UserChoice); - - QNetworkSession session(configuration); - - // Check that configuration was really set - QVERIFY(session.configuration() == configuration); - - QVERIFY(!session.isOpen()); - - // Check that session is not active - QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); - - // The remaining tests require the session to be not NotAvailable. - if (session.state() == QNetworkSession::NotAvailable) - QSKIP("Network is not available.", SkipSingle); - - QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); - QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); - QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); - QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); - - // Test opening the session. - { - bool expectStateChange = session.state() != QNetworkSession::Connected; - - session.open(); - - session.waitForOpened(); - - if (session.isOpen()) - QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); - if (!errorSpy.isEmpty()) { - QNetworkSession::SessionError error = - qvariant_cast(errorSpy.first().at(0)); - if (error == QNetworkSession::OperationNotSupportedError) { - // The session needed to bring up the interface, - // but the operation is not supported. - QSKIP("Configuration does not support open().", SkipSingle); - } else if (error == QNetworkSession::InvalidConfigurationError) { - // The session needed to bring up the interface, but it is not possible for the - // specified configuration. - if ((session.configuration().state() & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - QFAIL("Failed to open session for Discovered configuration."); - } else { - QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); - } - } else if (error == QNetworkSession::UnknownSessionError) { - QSKIP("Unknown session error.", SkipSingle); - } else { - QFAIL("Error opening session."); - } - } else if (!sessionOpenedSpy.isEmpty()) { - QCOMPARE(sessionOpenedSpy.count(), 1); - QVERIFY(sessionClosedSpy.isEmpty()); - QVERIFY(errorSpy.isEmpty()); - - if (expectStateChange) - QTRY_VERIFY(!stateChangedSpy.isEmpty()); - - QVERIFY(session.state() == QNetworkSession::Connected); -#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) - // On Symbian emulator, the support for data bearers is limited - QVERIFY(session.interface().isValid()); -#endif - - const QString userChoiceIdentifier = - session.sessionProperty("UserChoiceConfiguration").toString(); - - QVERIFY(!userChoiceIdentifier.isEmpty()); - QVERIFY(userChoiceIdentifier != configuration.identifier()); - - QNetworkConfiguration userChoiceConfiguration = - manager.configurationFromIdentifier(userChoiceIdentifier); - - QVERIFY(userChoiceConfiguration.isValid()); - QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); - - const QString testIdentifier("abc"); - //resetting UserChoiceConfiguration is ignored (read only property) - session.setSessionProperty("UserChoiceConfiguration", testIdentifier); - QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier); - - const QString activeIdentifier = - session.sessionProperty("ActiveConfiguration").toString(); - - QVERIFY(!activeIdentifier.isEmpty()); - QVERIFY(activeIdentifier != configuration.identifier()); - - QNetworkConfiguration activeConfiguration = - manager.configurationFromIdentifier(activeIdentifier); - - QVERIFY(activeConfiguration.isValid()); - QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); - - //resetting ActiveConfiguration is ignored (read only property) - session.setSessionProperty("ActiveConfiguration", testIdentifier); - QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier); - - if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { - QVERIFY(userChoiceConfiguration == activeConfiguration); - } else { - QVERIFY(userChoiceConfiguration.type() == QNetworkConfiguration::ServiceNetwork); - QVERIFY(userChoiceConfiguration.children().contains(activeConfiguration)); - } - } else { - QFAIL("Timeout waiting for session to open."); - } - } -} - -void tst_QNetworkSession::sessionOpenCloseStop_data() -{ - QTest::addColumn("configuration"); - QTest::addColumn("forceSessionStop"); - - foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { - const QString name = config.name().isEmpty() ? QString("") : config.name(); - QTest::newRow((name + QLatin1String(" close")).toLocal8Bit().constData()) - << config << false; - QTest::newRow((name + QLatin1String(" stop")).toLocal8Bit().constData()) - << config << true; - } - - inProcessSessionManagementCount = 0; -} - -void tst_QNetworkSession::sessionOpenCloseStop() -{ - QFETCH(QNetworkConfiguration, configuration); - QFETCH(bool, forceSessionStop); - - QNetworkSession session(configuration); - - // Test initial state of the session. - { - QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isOpen()); - // session may be invalid if configuration is removed between when - // sessionOpenCloseStop_data() is called and here. - QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || - (!configuration.isValid() && (session.state() == QNetworkSession::Invalid))); - QVERIFY(session.error() == QNetworkSession::UnknownSessionError); - } - - // The remaining tests require the session to be not NotAvailable. - if (session.state() == QNetworkSession::NotAvailable) - QSKIP("Network is not available.", SkipSingle); - - QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); - QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); - QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); - QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); - - // Test opening the session. - { - QNetworkSession::State previousState = session.state(); - bool expectStateChange = previousState != QNetworkSession::Connected; - - session.open(); - - session.waitForOpened(); - - if (session.isOpen()) - QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); - if (!errorSpy.isEmpty()) { - QNetworkSession::SessionError error = - qvariant_cast(errorSpy.first().at(0)); - - QVERIFY(session.state() == previousState); - - if (error == QNetworkSession::OperationNotSupportedError) { - // The session needed to bring up the interface, - // but the operation is not supported. - QSKIP("Configuration does not support open().", SkipSingle); - } else if (error == QNetworkSession::InvalidConfigurationError) { - // The session needed to bring up the interface, but it is not possible for the - // specified configuration. - if ((session.configuration().state() & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - QFAIL("Failed to open session for Discovered configuration."); - } else { - QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); - } - } else if (error == QNetworkSession::UnknownSessionError) { - QSKIP("Unknown Session error.", SkipSingle); - } else { - QFAIL("Error opening session."); - } - } else if (!sessionOpenedSpy.isEmpty()) { - QCOMPARE(sessionOpenedSpy.count(), 1); - QVERIFY(sessionClosedSpy.isEmpty()); - QVERIFY(errorSpy.isEmpty()); - - if (expectStateChange) { - QTRY_VERIFY(stateChangedSpy.count() >= 2); - - QNetworkSession::State state = - qvariant_cast(stateChangedSpy.at(0).at(0)); - QVERIFY(state == QNetworkSession::Connecting); - - state = qvariant_cast(stateChangedSpy.at(1).at(0)); - QVERIFY(state == QNetworkSession::Connected); - } - - QVERIFY(session.state() == QNetworkSession::Connected); -#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) - // On Symbian emulator, the support for data bearers is limited - QVERIFY(session.interface().isValid()); -#endif - } else { - QFAIL("Timeout waiting for session to open."); - } - } - - sessionOpenedSpy.clear(); - sessionClosedSpy.clear(); - stateChangedSpy.clear(); - errorSpy.clear(); - - QNetworkSession session2(configuration); - - QSignalSpy sessionOpenedSpy2(&session2, SIGNAL(opened())); - QSignalSpy sessionClosedSpy2(&session2, SIGNAL(closed())); - QSignalSpy stateChangedSpy2(&session2, SIGNAL(stateChanged(QNetworkSession::State))); - QSignalSpy errorSpy2(&session2, SIGNAL(error(QNetworkSession::SessionError))); - - // Test opening a second session. - { - QVERIFY(session2.configuration() == configuration); - QVERIFY(!session2.isOpen()); - QVERIFY(session2.state() == QNetworkSession::Connected); - QVERIFY(session.error() == QNetworkSession::UnknownSessionError); - - session2.open(); - - QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); - - QVERIFY(session.isOpen()); - QVERIFY(session2.isOpen()); - QVERIFY(session.state() == QNetworkSession::Connected); - QVERIFY(session2.state() == QNetworkSession::Connected); -#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) - // On Symbian emulator, the support for data bearers is limited - QVERIFY(session.interface().isValid()); -#endif - QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); - QCOMPARE(session.interface().index(), session2.interface().index()); - } - - sessionOpenedSpy2.clear(); - - if (forceSessionStop) { - // Test forcing the second session to stop the interface. - QNetworkSession::State previousState = session.state(); -#ifdef Q_CC_NOKIAX86 - // For S60 emulator builds: RConnection::Stop does not work on all Emulators - bool expectStateChange = false; -#else - bool expectStateChange = previousState != QNetworkSession::Disconnected; -#endif - - session2.stop(); - - QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - - QVERIFY(!session2.isOpen()); - - if (!errorSpy2.isEmpty()) { - QVERIFY(!errorSpy.isEmpty()); - - // check for SessionAbortedError - QNetworkSession::SessionError error = - qvariant_cast(errorSpy.first().at(0)); - QNetworkSession::SessionError error2 = - qvariant_cast(errorSpy2.first().at(0)); - - QVERIFY(error == QNetworkSession::SessionAbortedError); - QVERIFY(error2 == QNetworkSession::SessionAbortedError); - - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorSpy2.count(), 1); - - errorSpy.clear(); - errorSpy2.clear(); - } - - QVERIFY(errorSpy.isEmpty()); - QVERIFY(errorSpy2.isEmpty()); - - if (expectStateChange) - QTRY_VERIFY(stateChangedSpy2.count() >= 2 || !errorSpy2.isEmpty()); - - if (!errorSpy2.isEmpty()) { - QVERIFY(session2.state() == previousState); - QVERIFY(session.state() == previousState); - - QNetworkSession::SessionError error = - qvariant_cast(errorSpy2.first().at(0)); - if (error == QNetworkSession::OperationNotSupportedError) { - // The session needed to bring down the interface, - // but the operation is not supported. - QSKIP("Configuration does not support stop().", SkipSingle); - } else if (error == QNetworkSession::InvalidConfigurationError) { - // The session needed to bring down the interface, but it is not possible for the - // specified configuration. - if ((session.configuration().state() & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - QFAIL("Failed to stop session for Discovered configuration."); - } else { - QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); - } - } else { - QFAIL("Error stopping session."); - } - } else if (!sessionClosedSpy2.isEmpty()) { - if (expectStateChange) { - if (configuration.type() == QNetworkConfiguration::ServiceNetwork) { - bool roamedSuccessfully = false; - - QCOMPARE(stateChangedSpy2.count(), 4); - - QNetworkSession::State state = - qvariant_cast(stateChangedSpy2.at(0).at(0)); - QVERIFY(state == QNetworkSession::Connecting); - - state = qvariant_cast(stateChangedSpy2.at(1).at(0)); - QVERIFY(state == QNetworkSession::Connected); - - state = qvariant_cast(stateChangedSpy2.at(2).at(0)); - QVERIFY(state == QNetworkSession::Closing); - - state = qvariant_cast(stateChangedSpy2.at(3).at(0)); - QVERIFY(state == QNetworkSession::Disconnected); - - QTRY_VERIFY(stateChangedSpy.count() > 0); - state = qvariant_cast(stateChangedSpy.at(0).at(0)); - if (state == QNetworkSession::Roaming) { - QTRY_VERIFY(!errorSpy.isEmpty() || stateChangedSpy.count() > 1); - if (stateChangedSpy.count() > 1) { - state = qvariant_cast(stateChangedSpy.at(1).at(0)); - if (state == QNetworkSession::Connected) { - roamedSuccessfully = true; - QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); - } - } - } - if (roamedSuccessfully) { - QString configId = session.sessionProperty("ActiveConfiguration").toString(); - QNetworkConfiguration config = manager.configurationFromIdentifier(configId); - QNetworkSession session3(config); - QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); - QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); - - session3.open(); - session3.waitForOpened(); - - if (session.isOpen()) - QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); - - session.stop(); - - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - QTRY_VERIFY(session3.state() == QNetworkSession::Disconnected); - } -#ifndef Q_CC_NOKIAX86 - if (!roamedSuccessfully) - QVERIFY(!errorSpy.isEmpty()); -#endif - } else { - QCOMPARE(stateChangedSpy2.count(), 2); - - QNetworkSession::State state = - qvariant_cast(stateChangedSpy2.at(0).at(0)); - QVERIFY(state == QNetworkSession::Closing); - - state = qvariant_cast(stateChangedSpy2.at(1).at(0)); - QVERIFY(state == QNetworkSession::Disconnected); - } - - QTRY_VERIFY(!sessionClosedSpy.isEmpty()); - QVERIFY(session.state() == QNetworkSession::Disconnected); - QVERIFY(session2.state() == QNetworkSession::Disconnected); - } - - QVERIFY(errorSpy2.isEmpty()); - - ++inProcessSessionManagementCount; - } else { - QFAIL("Timeout waiting for session to stop."); - } - -#ifndef Q_CC_NOKIAX86 - QVERIFY(!sessionClosedSpy.isEmpty()); -#endif - QVERIFY(!sessionClosedSpy2.isEmpty()); - -#ifndef Q_CC_NOKIAX86 - QVERIFY(!session.isOpen()); -#endif - QVERIFY(!session2.isOpen()); - } else { - // Test closing the second session. - { - int stateChangedCountBeforeClose = stateChangedSpy2.count(); - session2.close(); - - QTRY_VERIFY(!sessionClosedSpy2.isEmpty()); -#ifndef Q_CC_NOKIAX86 - QVERIFY(stateChangedSpy2.count() == stateChangedCountBeforeClose); -#endif - - QVERIFY(sessionClosedSpy.isEmpty()); - - QVERIFY(session.isOpen()); - QVERIFY(!session2.isOpen()); - QVERIFY(session.state() == QNetworkSession::Connected); - QVERIFY(session2.state() == QNetworkSession::Connected); -#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) - // On Symbian emulator, the support for data bearers is limited - QVERIFY(session.interface().isValid()); -#endif - QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); - QCOMPARE(session.interface().index(), session2.interface().index()); - } - - sessionClosedSpy2.clear(); - - // Test closing the first session. - { -#ifdef Q_CC_NOKIAX86 - // For S60 emulator builds: RConnection::Close does not actually - // close network connection on all Emulators - bool expectStateChange = false; -#else - bool expectStateChange = session.state() != QNetworkSession::Disconnected && - manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport; -#endif - - session.close(); - - QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); - - QVERIFY(!session.isOpen()); - - if (expectStateChange) - QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); - - if (!errorSpy.isEmpty()) { - QNetworkSession::SessionError error = - qvariant_cast(errorSpy.first().at(0)); - if (error == QNetworkSession::OperationNotSupportedError) { - // The session needed to bring down the interface, - // but the operation is not supported. - QSKIP("Configuration does not support close().", SkipSingle); - } else if (error == QNetworkSession::InvalidConfigurationError) { - // The session needed to bring down the interface, but it is not possible for the - // specified configuration. - if ((session.configuration().state() & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - QFAIL("Failed to close session for Discovered configuration."); - } else { - QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); - } - } else { - QFAIL("Error closing session."); - } - } else if (!sessionClosedSpy.isEmpty()) { - QVERIFY(sessionOpenedSpy.isEmpty()); - QCOMPARE(sessionClosedSpy.count(), 1); - if (expectStateChange) - QVERIFY(!stateChangedSpy.isEmpty()); - QVERIFY(errorSpy.isEmpty()); - - if (expectStateChange) - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - - ++inProcessSessionManagementCount; - } else { - QFAIL("Timeout waiting for session to close."); - } - } - } -} - -QDebug operator<<(QDebug debug, const QList &list) -{ - debug.nospace() << "( "; - foreach (const QNetworkConfiguration &config, list) - debug.nospace() << config.identifier() << ", "; - debug.nospace() << ")\n"; - return debug; -} - -// Note: outOfProcessSession requires that at least one configuration is -// at Discovered -state (Defined is ok for symbian as well, as long as it is possible to open). -void tst_QNetworkSession::outOfProcessSession() -{ - qDebug() << "START"; - -#if defined(Q_OS_SYMBIAN) && defined(__WINS__) - QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); -#endif - QNetworkConfigurationManager manager; - // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This - // is actually the essence of this testcase - to check that platform mediates/reflects changes - // regardless of process boundaries. The interprocess communication is more like a way to get - // this test-case act correctly and timely. - QList before = manager.allConfigurations(QNetworkConfiguration::Active); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - - // Cannot read/write to processes on WinCE or Symbian. - // Easiest alternative is to use sockets for IPC. - QLocalServer oopServer; - // First remove possible earlier listening address which would cause listen to fail - // (e.g. previously abruptly ended unit test might cause this) - QLocalServer::removeServer("tst_qnetworksession"); - oopServer.listen("tst_qnetworksession"); - - qDebug() << "starting lackey"; - QProcess lackey; - lackey.start("lackey/lackey"); - qDebug() << lackey.error() << lackey.errorString(); - QVERIFY(lackey.waitForStarted()); - - qDebug() << "waiting for connection"; - QVERIFY(oopServer.waitForNewConnection(-1)); - QLocalSocket *oopSocket = oopServer.nextPendingConnection(); - qDebug() << "got connection"; - do { - QByteArray output; - - if (oopSocket->waitForReadyRead()) - output = oopSocket->readLine().trimmed(); - - if (output.startsWith("Started session ")) { - QString identifier = QString::fromLocal8Bit(output.mid(20).constData()); - QNetworkConfiguration changed; - - do { - QTRY_VERIFY(!spy.isEmpty()); - changed = qvariant_cast(spy.takeFirst().at(0)); - } while (changed.identifier() != identifier); - - QVERIFY((changed.state() & QNetworkConfiguration::Active) == - QNetworkConfiguration::Active); - - QVERIFY(!before.contains(changed)); - - QList after = - manager.allConfigurations(QNetworkConfiguration::Active); - - QVERIFY(after.contains(changed)); - - spy.clear(); - - oopSocket->write("stop\n"); - oopSocket->waitForBytesWritten(); - - do { - QTRY_VERIFY(!spy.isEmpty()); - - changed = qvariant_cast(spy.takeFirst().at(0)); - } while (changed.identifier() != identifier); - - QVERIFY((changed.state() & QNetworkConfiguration::Active) != - QNetworkConfiguration::Active); - - QList afterStop = - manager.allConfigurations(QNetworkConfiguration::Active); - - QVERIFY(!afterStop.contains(changed)); - - oopSocket->disconnectFromServer(); - oopSocket->waitForDisconnected(-1); - - lackey.waitForFinished(); - } - // This is effected by QTBUG-4903, process will always report as running - //} while (lackey.state() == QProcess::Running); - - // Workaround: the socket in the lackey will disconnect on exit - } while (oopSocket->state() == QLocalSocket::ConnectedState); - - switch (lackey.exitCode()) { - case 0: - qDebug("Lackey returned exit success (0)"); - break; - case 1: - QSKIP("No discovered configurations found.", SkipAll); - case 2: - QSKIP("Lackey could not start session.", SkipAll); - default: - QSKIP("Lackey failed", SkipAll); - } - qDebug("STOP"); -} - -QTEST_MAIN(tst_QNetworkSession) - -#include "tst_qnetworksession.moc" - diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro deleted file mode 100644 index cad388c..0000000 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ /dev/null @@ -1,15 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qnetworksession.cpp -HEADERS += ../../qbearertestcommon.h - -QT = core network - -symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData PowerMgmt -} - -maemo6 { - CONFIG += link_pkgconfig - - PKGCONFIG += conninet -} -- cgit v0.12 From bc5b362ae8754ba4bd9d12ddbf9c4a7e21502ff4 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 22 Feb 2010 08:49:46 +1000 Subject: Fixed qnetworksession test on Mac. Don't use an app bundle for this helper app. --- tests/auto/qnetworksession/lackey/lackey.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index 8fbdd58..5db6743 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -6,6 +6,7 @@ QT = core network DESTDIR = ./ win32:CONFIG += console +mac:CONFIG -= app_bundle symbian { # Needed for interprocess communication and opening QNetworkSession -- cgit v0.12 From a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 22 Feb 2010 11:23:24 +1000 Subject: Add locking to bearer code. QNetworkConfigurationManagerPrivate and QBearerEngine derived classes need to be thread-safe. --- src/network/bearer/qbearerengine.cpp | 2 +- src/network/bearer/qbearerengine_p.h | 19 ++-- src/network/bearer/qnetworkconfigmanager.cpp | 84 +++++++++++++++- src/network/bearer/qnetworkconfigmanager_p.cpp | 109 ++++++--------------- src/network/bearer/qnetworkconfigmanager_p.h | 22 ++--- src/network/bearer/qnetworksession.cpp | 2 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 22 +++++ src/plugins/bearer/generic/qgenericengine.cpp | 10 ++ src/plugins/bearer/icd/qicdengine.cpp | 10 ++ .../bearer/nativewifi/qnativewifiengine.cpp | 14 +++ .../networkmanager/qnetworkmanagerengine.cpp | 50 ++++++++++ src/plugins/bearer/nla/qnlaengine.cpp | 10 ++ src/plugins/bearer/qnetworksession_impl.cpp | 2 +- src/plugins/bearer/symbian/symbianengine.cpp | 44 +++++++++ 14 files changed, 297 insertions(+), 103 deletions(-) diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index 58d64f2..eb851cc 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE QBearerEngine::QBearerEngine(QObject *parent) -: QObject(parent) +: QObject(parent), mutex(QMutex::Recursive) { } diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h index 7e96877..5e12b0f 100644 --- a/src/network/bearer/qbearerengine_p.h +++ b/src/network/bearer/qbearerengine_p.h @@ -63,6 +63,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -72,6 +73,8 @@ class Q_NETWORK_EXPORT QBearerEngine : public QObject { Q_OBJECT + friend class QNetworkConfigurationManager; + public: QBearerEngine(QObject *parent = 0); virtual ~QBearerEngine(); @@ -86,7 +89,14 @@ public: virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; -public: +Q_SIGNALS: + void configurationAdded(QNetworkConfigurationPrivatePointer config); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); + void configurationChanged(QNetworkConfigurationPrivatePointer config); + + void updateCompleted(); + +protected: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or //the members of ServiceNetworks change @@ -94,12 +104,7 @@ public: QHash snapConfigurations; QHash userChoiceConfigurations; -Q_SIGNALS: - void configurationAdded(QNetworkConfigurationPrivatePointer config); - void configurationRemoved(QNetworkConfigurationPrivatePointer config); - void configurationChanged(QNetworkConfigurationPrivatePointer config); - - void updateCompleted(); + mutable QMutex mutex; }; QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index f54a985..e960323 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -206,7 +206,81 @@ QNetworkConfigurationManager::~QNetworkConfigurationManager() */ QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const { - return connManager()->defaultConfiguration(); + QNetworkConfigurationManagerPrivate *conPriv = connManager(); + + foreach (QBearerEngine *engine, conPriv->engines()) { + QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); + + if (ptr) { + QNetworkConfiguration config; + config.d = ptr; + return config; + } + } + + // Engines don't have a default configuration. + + // Return first active snap + QNetworkConfigurationPrivatePointer firstDiscovered; + + foreach (QBearerEngine *engine, conPriv->engines()) { + QHash::Iterator it; + QHash::Iterator end; + + QMutexLocker locker(&engine->mutex); + + for (it = engine->snapConfigurations.begin(), end = engine->snapConfigurations.end(); + it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = it.value(); + return config; + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = it.value(); + } + } + } + + // No Active SNAPs return first Discovered SNAP. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + + // No Active or Discovered SNAPs, do same for InternetAccessPoints. + firstDiscovered.reset(); + + foreach (QBearerEngine *engine, conPriv->engines()) { + QHash::Iterator it; + QHash::Iterator end; + + QMutexLocker locker(&engine->mutex); + + for (it = engine->accessPointConfigurations.begin(), + end = engine->accessPointConfigurations.end(); it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = it.value(); + return config; + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = it.value(); + } + } + } + + // No Active InternetAccessPoint return first Discovered InternetAccessPoint. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + + return QNetworkConfiguration(); } /*! @@ -234,10 +308,12 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); - foreach (QBearerEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->engines()) { QHash::Iterator it; QHash::Iterator end; + QMutexLocker locker(&engine->mutex); + //find all InternetAccessPoints for (it = engine->accessPointConfigurations.begin(), end = engine->accessPointConfigurations.end(); it != end; ++it) { @@ -274,7 +350,9 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; - foreach (QBearerEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->engines()) { + QMutexLocker locker(&engine->mutex); + if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); else if (engine->snapConfigurations.contains(identifier)) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 141d522..6ac61b3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -47,19 +47,34 @@ #include #include #include +#include QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) +QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() +: capFlags(0), firstUpdate(true), mutex(QMutex::Recursive) +{ + updateConfigurations(); + + moveToThread(QCoreApplicationPrivate::mainThread()); + foreach (QBearerEngine *engine, sessionEngines) + engine->moveToThread(QCoreApplicationPrivate::mainThread()); +} + QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() { + QMutexLocker locker(&mutex); + qDeleteAll(sessionEngines); } void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { + QMutexLocker locker(&mutex); + if (!firstUpdate) { QNetworkConfiguration item; item.d = ptr; @@ -75,6 +90,8 @@ void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurati void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr) { + QMutexLocker locker(&mutex); + ptr->isValid = false; if (!firstUpdate) { @@ -90,6 +107,8 @@ void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigura void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr) { + QMutexLocker locker(&mutex); + if (!firstUpdate) { QNetworkConfiguration item; item.d = ptr; @@ -111,6 +130,8 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura void QNetworkConfigurationManagerPrivate::updateConfigurations() { + QMutexLocker locker(&mutex); + if (firstUpdate) { updating = false; @@ -163,87 +184,10 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() firstUpdate = false; } -/*! - Returns the default configuration of the first plugin, if one exists; otherwise returns an - invalid configuration. - - \internal -*/ -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() -{ - foreach (QBearerEngine *engine, sessionEngines) { - QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); - - if (ptr) { - QNetworkConfiguration config; - config.d = ptr; - return config; - } - } - - // Engines don't have a default configuration. - - // Return first active snap - QNetworkConfigurationPrivatePointer firstDiscovered; - - foreach (QBearerEngine *engine, sessionEngines) { - QHash::Iterator it; - QHash::Iterator end; - - for (it = engine->snapConfigurations.begin(), end = engine->snapConfigurations.end(); - it != end; ++it) { - if ((it.value()->state & QNetworkConfiguration::Active) == - QNetworkConfiguration::Active) { - QNetworkConfiguration config; - config.d = it.value(); - return config; - } else if ((it.value()->state & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - firstDiscovered = it.value(); - } - } - } - - // No Active SNAPs return first Discovered SNAP. - if (firstDiscovered) { - QNetworkConfiguration config; - config.d = firstDiscovered; - return config; - } - - // No Active or Discovered SNAPs, do same for InternetAccessPoints. - firstDiscovered.reset(); - - foreach (QBearerEngine *engine, sessionEngines) { - QHash::Iterator it; - QHash::Iterator end; - - for (it = engine->accessPointConfigurations.begin(), - end = engine->accessPointConfigurations.end(); it != end; ++it) { - if ((it.value()->state & QNetworkConfiguration::Active) == - QNetworkConfiguration::Active) { - QNetworkConfiguration config; - config.d = it.value(); - return config; - } else if ((it.value()->state & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - firstDiscovered = it.value(); - } - } - } - - // No Active InternetAccessPoint return first Discovered InternetAccessPoint. - if (firstDiscovered) { - QNetworkConfiguration config; - config.d = firstDiscovered; - return config; - } - - return QNetworkConfiguration(); -} - void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() { + QMutexLocker locker(&mutex); + if (sessionEngines.isEmpty()) { emit configurationUpdateComplete(); return; @@ -257,4 +201,11 @@ void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() } } +QList QNetworkConfigurationManagerPrivate::engines() +{ + QMutexLocker locker(&mutex); + + return sessionEngines; +} + QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index e178c2d..c7e988e 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -56,20 +56,17 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfiguration_p.h" +#include + QT_BEGIN_NAMESPACE class QBearerEngine; -class QNetworkConfigurationManagerPrivate : public QObject +class Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate : public QObject { Q_OBJECT public: - QNetworkConfigurationManagerPrivate() - : QObject(0), capFlags(0), firstUpdate(true) - { - updateConfigurations(); - } - + QNetworkConfigurationManagerPrivate(); virtual ~QNetworkConfigurationManagerPrivate(); QNetworkConfiguration defaultConfiguration(); @@ -78,7 +75,7 @@ public: void performAsyncConfigurationUpdate(); - bool firstUpdate; + QList engines(); public slots: void updateConfigurations(); @@ -92,14 +89,17 @@ Q_SIGNALS: void abort(); -public: +private: + QMutex mutex; + QList sessionEngines; -private: QSet onlineConfigurations; - bool updating; QSet updatingEngines; + bool updating; + + bool firstUpdate; private Q_SLOTS: void configurationAdded(QNetworkConfigurationPrivatePointer ptr); diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 3e77354..6a82791 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -225,7 +225,7 @@ QT_BEGIN_NAMESPACE QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) : QObject(parent), d(0) { - foreach (QBearerEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { + foreach (QBearerEngine *engine, qNetworkConfigurationManagerPrivate()->engines()) { if (engine->hasIdentifier(connectionConfig.identifier())) { d = engine->createSessionBackend(); d->q = this; diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index fff65e4..a5384d1 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -121,16 +121,22 @@ QCoreWlanEngine::~QCoreWlanEngine() QString QCoreWlanEngine::getInterfaceFromId(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.value(id); } bool QCoreWlanEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.contains(id); } void QCoreWlanEngine::connectToId(const QString &id) { + QMutexLocker locker(&mutex); + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; QString interfaceString = getInterfaceFromId(id); @@ -205,6 +211,8 @@ void QCoreWlanEngine::connectToId(const QString &id) void QCoreWlanEngine::disconnectFromId(const QString &id) { + QMutexLocker locker(&mutex); + QString interfaceString = getInterfaceFromId(id); if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now #if defined(MAC_SDK_10_6) @@ -225,12 +233,16 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) void QCoreWlanEngine::requestUpdate() { + QMutexLocker locker(&mutex); + pollTimer.stop(); QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } void QCoreWlanEngine::doRequestUpdate() { + QMutexLocker locker(&mutex); + getAllScInterfaces(); QStringList previous = accessPointConfigurations.keys(); @@ -330,6 +342,8 @@ void QCoreWlanEngine::doRequestUpdate() QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) { + QMutexLocker locker(&mutex); + QStringList found; #if defined(MAC_SDK_10_6) @@ -422,6 +436,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) { + QMutexLocker locker(&mutex); + #if defined(MAC_SDK_10_6) CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)]; if([defaultInterface power]) @@ -434,6 +450,8 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid) { + QMutexLocker locker(&mutex); + #if defined(MAC_SDK_10_6) CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)]; CWConfiguration *userConfig = [wifiInterface configuration]; @@ -451,6 +469,8 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s bool QCoreWlanEngine::getAllScInterfaces() { + QMutexLocker locker(&mutex); + networkInterfaces.clear(); NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -491,6 +511,8 @@ bool QCoreWlanEngine::getAllScInterfaces() QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index dba2c08..a95b14b 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -154,11 +154,15 @@ QGenericEngine::~QGenericEngine() QString QGenericEngine::getInterfaceFromId(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.value(id); } bool QGenericEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.contains(id); } @@ -174,12 +178,16 @@ void QGenericEngine::disconnectFromId(const QString &id) void QGenericEngine::requestUpdate() { + QMutexLocker locker(&mutex); + pollTimer.stop(); QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } void QGenericEngine::doRequestUpdate() { + QMutexLocker locker(&mutex); + // Immediately after connecting with a wireless access point // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a // second time results in a non-empty list. If we loose interfaces we will end up removing @@ -282,6 +290,8 @@ void QGenericEngine::doRequestUpdate() QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 3233eda..f10042a 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -100,6 +100,8 @@ QIcdEngine::~QIcdEngine() bool QIcdEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + return accessPointConfigurations.contains(id) || snapConfigurations.contains(id) || userChoiceConfigurations.contains(id); @@ -107,6 +109,8 @@ bool QIcdEngine::hasIdentifier(const QString &id) void QIcdEngine::requestUpdate() { + QMutexLocker locker(&mutex); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } @@ -156,6 +160,8 @@ static uint32_t getNetworkAttrs(bool is_iap_id, void QIcdEngine::doRequestUpdate() { + QMutexLocker locker(&mutex); + QStringList previous = accessPointConfigurations.keys(); /* All the scanned access points */ @@ -371,6 +377,8 @@ void QIcdEngine::doRequestUpdate() void QIcdEngine::deleteConfiguration(const QString &iap_id) { + QMutexLocker locker(&mutex); + /* Called when IAPs are deleted in gconf, in this case we do not scan * or read all the IAPs from gconf because it might take too much power * (multiple applications would need to scan and read all IAPs from gconf) @@ -409,6 +417,8 @@ QNetworkSessionPrivate *QIcdEngine::createSessionBackend() QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() { + QMutexLocker locker(&mutex); + // Here we just return [ANY] request to icd and let the icd decide which IAP to connect. return userChoiceConfigurations.value(OSSO_IAP_ANY); } diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index e4ab0aa..c8015d8 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -109,6 +109,8 @@ QNativeWifiEngine::~QNativeWifiEngine() void QNativeWifiEngine::scanComplete() { + QMutexLocker locker(&mutex); + QStringList previous = accessPointConfigurations.keys(); // enumerate interfaces @@ -227,6 +229,8 @@ void QNativeWifiEngine::scanComplete() QString QNativeWifiEngine::getInterfaceFromId(const QString &id) { + QMutexLocker locker(&mutex); + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -276,6 +280,8 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) bool QNativeWifiEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -330,6 +336,8 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) void QNativeWifiEngine::connectToId(const QString &id) { + QMutexLocker locker(&mutex); + WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { @@ -393,6 +401,8 @@ void QNativeWifiEngine::connectToId(const QString &id) void QNativeWifiEngine::disconnectFromId(const QString &id) { + QMutexLocker locker(&mutex); + QString interface = getInterfaceFromId(id); if (interface.isEmpty()) { @@ -421,6 +431,8 @@ void QNativeWifiEngine::disconnectFromId(const QString &id) void QNativeWifiEngine::requestUpdate() { + QMutexLocker locker(&mutex); + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -440,6 +452,8 @@ void QNativeWifiEngine::requestUpdate() QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 4c8928c..5c6efe3 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -120,6 +120,8 @@ QNetworkManagerEngine::~QNetworkManagerEngine() bool QNetworkManagerEngine::networkManagerAvailable() const { + QMutexLocker locker(&mutex); + return interface->isValid(); } @@ -130,6 +132,8 @@ void QNetworkManagerEngine::doRequestUpdate() QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) { + QMutexLocker locker(&mutex); + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { QNetworkManagerConnectionActive activeConnection(acPath.path()); @@ -152,6 +156,8 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) bool QNetworkManagerEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + if (connectionFromId(id)) return true; @@ -170,6 +176,8 @@ bool QNetworkManagerEngine::hasIdentifier(const QString &id) QString QNetworkManagerEngine::bearerName(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkManagerSettingsConnection *connection = connectionFromId(id); if (!connection) @@ -192,6 +200,8 @@ QString QNetworkManagerEngine::bearerName(const QString &id) void QNetworkManagerEngine::connectToId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkManagerSettingsConnection *connection = connectionFromId(id); if (!connection) @@ -223,6 +233,8 @@ void QNetworkManagerEngine::connectToId(const QString &id) void QNetworkManagerEngine::disconnectFromId(const QString &id) { + QMutexLocker locker(&mutex); + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { QNetworkManagerConnectionActive activeConnection(acPath.path()); @@ -238,12 +250,16 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id) void QNetworkManagerEngine::requestUpdate() { + QMutexLocker locker(&mutex); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, const QMap &properties) { + QMutexLocker locker(&mutex); + Q_UNUSED(path) QMapIterator i(properties); @@ -310,6 +326,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, const QMap &properties) { + QMutexLocker locker(&mutex); + Q_UNUSED(properties) QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); @@ -333,10 +351,14 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(path); + Q_UNUSED(properties); } void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) { + QMutexLocker locker(&mutex); + QNetworkManagerInterfaceDevice device(path.path()); if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) { QNetworkManagerInterfaceDeviceWireless *wirelessDevice = @@ -358,12 +380,16 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path) { + QMutexLocker locker(&mutex); + delete wirelessDevices.value(path.path()); } void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings) { + QMutexLocker locker(&mutex); + if (!settings) settings = qobject_cast(sender()); @@ -404,6 +430,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, void QNetworkManagerEngine::removeConnection(const QString &path) { + QMutexLocker locker(&mutex); + Q_UNUSED(path) QNetworkManagerSettingsConnection *connection = @@ -423,6 +451,8 @@ void QNetworkManagerEngine::removeConnection(const QString &path) void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) { + QMutexLocker locker(&mutex); + QNetworkManagerSettingsConnection *connection = qobject_cast(sender()); if (!connection) @@ -458,6 +488,8 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) { + QMutexLocker locker(&mutex); + QDBusPendingReply reply = *watcher; if (!reply.isError()) { QDBusObjectPath result = reply.value(); @@ -480,6 +512,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + QMutexLocker locker(&mutex); + Q_UNUSED(path) QNetworkManagerInterfaceAccessPoint *accessPoint = @@ -535,6 +569,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec void QNetworkManagerEngine::removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + QMutexLocker locker(&mutex); + Q_UNUSED(path) for (int i = 0; i < accessPoints.count(); ++i) { @@ -579,6 +615,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, void QNetworkManagerEngine::updateAccessPoint(const QMap &map) { + QMutexLocker locker(&mutex); + Q_UNUSED(map) QNetworkManagerInterfaceAccessPoint *accessPoint = @@ -607,6 +645,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri const QString &settingsPath, const QNmSettingsMap &map) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; cpPriv->name = map.value("connection").value("id").toString(); cpPriv->isValid = true; @@ -664,6 +704,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const { + QMutexLocker locker(&mutex); + for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); const QString service = connection->connectionInterface()->service(); @@ -680,6 +722,8 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) @@ -718,6 +762,8 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i quint64 QNetworkManagerEngine::bytesWritten(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { const QString networkInterface = getInterfaceFromId(id); @@ -744,6 +790,8 @@ quint64 QNetworkManagerEngine::bytesWritten(const QString &id) quint64 QNetworkManagerEngine::bytesReceived(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { const QString networkInterface = getInterfaceFromId(id); @@ -770,6 +818,8 @@ quint64 QNetworkManagerEngine::bytesReceived(const QString &id) quint64 QNetworkManagerEngine::startTime(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkManagerSettingsConnection *connection = connectionFromId(id); if (connection) return connection->getTimestamp(); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 2001c0b..ff334e5 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -521,6 +521,8 @@ QNlaEngine::~QNlaEngine() void QNlaEngine::networksChanged() { + QMutexLocker locker(&mutex); + QStringList previous = accessPointConfigurations.keys(); QList foundConfigurations = nlaThread->getConfigurations(); @@ -574,11 +576,15 @@ void QNlaEngine::networksChanged() QString QNlaEngine::getInterfaceFromId(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.value(id.toUInt()); } bool QNlaEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + return configurationInterface.contains(id.toUInt()); } @@ -604,11 +610,15 @@ void QNlaEngine::disconnectFromId(const QString &id) void QNlaEngine::requestUpdate() { + QMutexLocker locker(&mutex); + nlaThread->forceUpdate(); } QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id) { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 3fe844a..f41fdba 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -57,7 +57,7 @@ static QBearerEngineImpl *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - foreach (QBearerEngine *engine, priv->sessionEngines) { + foreach (QBearerEngine *engine, priv->engines()) { QBearerEngineImpl *engineImpl = qobject_cast(engine); if (engineImpl && engineImpl->hasIdentifier(id)) return engineImpl; diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index e25eda4..0331026 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -158,6 +158,8 @@ SymbianEngine::~SymbianEngine() bool SymbianEngine::hasIdentifier(const QString &id) { + QMutexLocker locker(&mutex); + return accessPointConfigurations.contains(id) || snapConfigurations.contains(id) || userChoiceConfigurations.contains(id); @@ -187,6 +189,8 @@ QNetworkSessionPrivate *SymbianEngine::createSessionBackend() void SymbianEngine::requestUpdate() { + QMutexLocker locker(&mutex); + if (!iInitOk || iUpdateGoingOn) { return; } @@ -199,6 +203,8 @@ void SymbianEngine::requestUpdate() void SymbianEngine::updateConfigurations() { + QMutexLocker locker(&mutex); + if (!iInitOk) { return; } @@ -208,6 +214,8 @@ void SymbianEngine::updateConfigurations() void SymbianEngine::updateConfigurationsL() { + QMutexLocker locker(&mutex); + QList knownConfigs = accessPointConfigurations.keys(); QList knownSnapConfigs = snapConfigurations.keys(); @@ -381,6 +389,8 @@ void SymbianEngine::updateConfigurationsL() SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( RCmConnectionMethod& connectionMethod) { + QMutexLocker locker(&mutex); + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; CleanupStack::PushL(cpPriv); @@ -463,6 +473,8 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb( TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) { + QMutexLocker locker(&mutex); + TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); if (error != KErrNone) { return false; @@ -473,6 +485,8 @@ bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb( void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) { + QMutexLocker locker(&mutex); + CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); TBuf name; @@ -533,6 +547,8 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration() { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr; if (iInitOk) { @@ -546,6 +562,8 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration() QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() { + QMutexLocker locker(&mutex); + QNetworkConfigurationPrivatePointer ptr; #ifdef SNAP_FUNCTIONALITY_AVAILABLE @@ -571,6 +589,8 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() void SymbianEngine::updateActiveAccessPoints() { + QMutexLocker locker(&mutex); + bool online = false; QList inactiveConfigs = accessPointConfigurations.keys(); @@ -620,6 +640,8 @@ void SymbianEngine::updateActiveAccessPoints() void SymbianEngine::updateAvailableAccessPoints() { + QMutexLocker locker(&mutex); + if (!ipAccessPointsAvailabilityScanner) { ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); } @@ -631,6 +653,8 @@ void SymbianEngine::updateAvailableAccessPoints() void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) { + QMutexLocker locker(&mutex); + iUpdateGoingOn = false; if (scanSuccessful) { QList unavailableConfigs = accessPointConfigurations.keys(); @@ -668,6 +692,8 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn void SymbianEngine::updateStatesToSnaps() { + QMutexLocker locker(&mutex); + // Go through SNAPs and set correct state to SNAPs QList snapConfigIdents = snapConfigurations.keys(); foreach (QString iface, snapConfigIdents) { @@ -700,6 +726,8 @@ void SymbianEngine::updateStatesToSnaps() bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, QNetworkConfiguration::StateFlags newState) { + QMutexLocker locker(&mutex); + if (newState != ptr->state) { ptr->state = newState; emit configurationChanged(ptr); @@ -715,6 +743,8 @@ bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePoint bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr, QNetworkConfiguration::StateFlags newState) { + QMutexLocker locker(&mutex); + if ((newState | ptr->state) != ptr->state) { ptr->state = (ptr->state | newState); emit configurationChanged(ptr); @@ -731,6 +761,8 @@ bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivate bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, QNetworkConfiguration::StateFlags newState) { + QMutexLocker locker(&mutex); + if ((newState & ptr->state) != ptr->state) { ptr->state = (newState & ptr->state); emit configurationChanged(ptr); @@ -741,6 +773,8 @@ bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivate void SymbianEngine::startCommsDatabaseNotifications() { + QMutexLocker locker(&mutex); + if (!iWaitingCommsDatabaseNotifications) { iWaitingCommsDatabaseNotifications = ETrue; if (!IsActive()) { @@ -753,6 +787,8 @@ void SymbianEngine::startCommsDatabaseNotifications() void SymbianEngine::stopCommsDatabaseNotifications() { + QMutexLocker locker(&mutex); + if (iWaitingCommsDatabaseNotifications) { iWaitingCommsDatabaseNotifications = EFalse; if (!IsActive()) { @@ -769,6 +805,8 @@ void SymbianEngine::stopCommsDatabaseNotifications() void SymbianEngine::RunL() { + QMutexLocker locker(&mutex); + if (iStatus != KErrCancel) { RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); switch (event) { @@ -805,12 +843,16 @@ void SymbianEngine::RunL() void SymbianEngine::DoCancel() { + QMutexLocker locker(&mutex); + ipCommsDB->CancelRequestNotification(); } void SymbianEngine::EventL(const CConnMonEventBase& aEvent) { + QMutexLocker locker(&mutex); + switch (aEvent.EventType()) { case EConnMonCreateConnection: { @@ -902,6 +944,8 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) { + QMutexLocker locker(&mutex); + QNetworkConfiguration item; QHash::const_iterator i = -- cgit v0.12 From 0f761d9d95bc187cb786ce7dc03a7d8c9ad9d779 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 22 Feb 2010 12:27:39 +1000 Subject: Increase try verify timeout. --- .../declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp | 2 +- tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp index 183f7e4..bb978d1 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp +++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp @@ -60,7 +60,7 @@ #define TRY_WAIT(expr) \ do { \ - for (int ii = 0; ii < 6; ++ii) { \ + for (int ii = 0; ii < 60; ++ii) { \ if ((expr)) break; \ QTest::qWait(50); \ } \ diff --git a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp index 503b05e..a25dcd2 100644 --- a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp @@ -59,7 +59,7 @@ #define TRY_WAIT(expr) \ do { \ - for (int ii = 0; ii < 6; ++ii) { \ + for (int ii = 0; ii < 60; ++ii) { \ if ((expr)) break; \ QTest::qWait(50); \ } \ -- cgit v0.12 From 2e4f20d8c541db2c68e82be3261355ccc59fd10d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 22 Feb 2010 15:53:16 +1000 Subject: Change initialization order. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 6ac61b3..1ac10c5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -55,7 +55,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() -: capFlags(0), firstUpdate(true), mutex(QMutex::Recursive) +: capFlags(0), mutex(QMutex::Recursive), firstUpdate(true) { updateConfigurations(); -- cgit v0.12 From 0771d24f2ea3ba46c8e825b8720561258f9646ce Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 23 Feb 2010 11:35:41 +1000 Subject: Fix build on Symbian. --- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 4 ++-- src/plugins/bearer/symbian/symbianengine.cpp | 7 +++++++ src/plugins/bearer/symbian/symbianengine.h | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 7762fb5..9af1fe9 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -322,7 +322,7 @@ void QNetworkSessionPrivateImpl::open() } newState(QNetworkSession::Connecting); } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurations.keys(); + iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers(); iConnection.Start(iStatus); if (!IsActive()) { SetActive(); @@ -699,7 +699,7 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia // 1. Sync internal configurations array to commsdb first engine->updateConfigurations(); // 2. Check if new configuration was created during connection creation - QList knownConfigs = engine->accessPointConfigurations.keys(); + QStringList knownConfigs = engine->accessPointConfigurationIdentifiers(); if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { // Configuration count increased => new configuration was created // => Search new, created configuration diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 0331026..b3c9cb3 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -560,6 +560,13 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration() return ptr; } +QStringList SymbianEngine::accessPointConfigurationIdentifiers() +{ + QMutexLocker locker(&mutex); + + return accessPointConfigurations.keys(); +} + QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() { QMutexLocker locker(&mutex); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 587585b..5448813 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -42,6 +42,7 @@ #ifndef SYMBIANENGINE_H #define SYMBIANENGINE_H +#include #include #include @@ -116,6 +117,8 @@ public: QNetworkConfigurationPrivatePointer defaultConfiguration(); + QStringList accessPointConfigurationIdentifiers(); + Q_SIGNALS: void onlineStateChanged(bool isOnline); -- cgit v0.12 From 055fa76e7575be55899127de2d254e0f0e90a1db Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 23 Feb 2010 13:12:44 +1000 Subject: Make compile on Maemo6. --- src/plugins/bearer/icd/main.cpp | 2 +- src/plugins/bearer/icd/qicdengine.h | 14 +++++++++++--- src/plugins/bearer/icd/qnetworksession_impl.cpp | 9 ++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp index b131ccb..ad1a918 100644 --- a/src/plugins/bearer/icd/main.cpp +++ b/src/plugins/bearer/icd/main.cpp @@ -41,7 +41,7 @@ #include "qicdengine.h" -#include +#include #include diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index 30b5711..6ebe40d 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -80,8 +80,6 @@ class QIcdEngine : public QBearerEngine { Q_OBJECT - friend class QNetworkSessionPrivateImpl; - public: QIcdEngine(QObject *parent = 0); ~QIcdEngine(); @@ -98,15 +96,25 @@ public: void deleteConfiguration(const QString &iap_id); -private: + inline QNetworkConfigurationPrivatePointer configuration(const QString &id) + { + QMutexLocker locker(&mutex); + + return accessPointConfigurations.value(id); + } + inline void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) { + QMutexLocker locker(&mutex); + accessPointConfigurations.insert(ptr->id, ptr); emit configurationAdded(ptr); } inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) { + QMutexLocker locker(&mutex); + emit configurationChanged(ptr); } diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 6cc4a1d..a9e93e0 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -560,7 +560,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() // Add the new active configuration to manager or update the old config - if (!(engine->accessPointConfigurations.contains(privateConfiguration(activeConfig)->id))) + if (!engine->hasIdentifier(privateConfiguration(activeConfig)->id)) engine->addSessionConfiguration(privateConfiguration(activeConfig)); else engine->changedSessionConfiguration(privateConfiguration(activeConfig)); @@ -924,11 +924,10 @@ void QNetworkSessionPrivateImpl::do_open() */ if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (!engine->accessPointConfigurations.contains(result)) { + if (!engine->hasIdentifier(result)) { engine->addSessionConfiguration(privateConfiguration(config)); - } else { - QNetworkConfigurationPrivatePointer priv = - engine->accessPointConfigurations.value(result); + } else { + QNetworkConfigurationPrivatePointer priv = engine->configuration(result); QNetworkConfiguration reference; setPrivateConfiguration(reference, priv); copyConfig(config, reference, false); -- cgit v0.12 From ba301c2e265f3132906254b145fad394eeb4091f Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 23 Feb 2010 09:22:50 +0100 Subject: Factored readRegistryKey implementation out of qmake This function is now implemented with its own header and source files, rather than being embedded within the MSVC qmake generator. The motivation for this is to allow code to be shared between qmake and configure, both of which query the registry when built for Windows. Reviewed-by: Miikka Heikkinen (cherry picked from commit 5254184c07b4da800e29000a251ed2a026bd2be5) Conflicts: qmake/Makefile.unix --- qmake/Makefile.unix | 9 +- qmake/Makefile.win32 | 7 ++ qmake/Makefile.win32-g++ | 5 + qmake/Makefile.win32-g++-sh | 5 + qmake/generators/win32/msvc_vcproj.cpp | 97 +------------------- qmake/qmake.pri | 7 +- qmake/qmake.pro | 4 + tools/shared/windows/registry.cpp | 161 +++++++++++++++++++++++++++++++++ tools/shared/windows/registry.h | 64 +++++++++++++ 9 files changed, 259 insertions(+), 100 deletions(-) create mode 100644 tools/shared/windows/registry.cpp create mode 100644 tools/shared/windows/registry.h diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 5e3190d..0d6c117 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -10,7 +10,8 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ mingw_make.o option.o winmakefile.o projectgenerator.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \ - symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o + symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \ + registry.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -20,6 +21,7 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qgl qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \ qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \ qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ + registry.o \ $(QTOBJS) @@ -32,6 +34,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/makefiledeps.cpp option.cpp generators/win32/mingw_make.cpp generators/makefile.cpp \ generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \ + $(SOURCE_PATH)/tools/shared/windows/registry.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ @@ -62,6 +65,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ + -I$(BUILD_PATH)/tools/shared \ -DQT_NO_PCRE \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ @@ -278,6 +282,9 @@ symmake_sbsv2.o: generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp +registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp + projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 1f3092a..bbc37c1 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -34,6 +34,7 @@ CFLAGS = -c -Fo$@ \ -I$(BUILD_PATH)\src\corelib\global \ -I$(BUILD_PATH)\src\corelib\xml \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ + -I$(SOURCE_PATH)\tools\shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED \ @@ -59,6 +60,7 @@ CFLAGS = -c -o$@ \ -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ + -I$(SOURCE_PATH)\tools\shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT @@ -75,6 +77,7 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \ borland_bmake.obj msvc_nmake.obj msvc_vcproj.obj \ msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \ + registry.obj \ symmake_abld.obj symmake_sbsv2.obj !IFDEF QMAKE_OPENSOURCE_EDITION @@ -197,6 +200,7 @@ clean:: -del symmake_abld.obj -del symmake_sbsv2.obj -del initprojectdeploy_symbian.obj + -del registry.obj -del pbuilder_pbx.obj -del qxmlstream.obj -del qxmlutils.obj @@ -393,6 +397,9 @@ symmake_sbsv2.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp +registry.obj: $(SOURCE_PATH)/tools/shared/windows/registry.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp + md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 41a1d8c..0b47905 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -21,6 +21,7 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ + -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ @@ -38,6 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ + registry.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -275,6 +277,9 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp +registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 0b08320..0772aff 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -21,6 +21,7 @@ CFLAGS = -c -o$@ -O \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ + -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ @@ -38,6 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ + registry.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -274,6 +276,9 @@ symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp +registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 3536a02..f1777e1 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -67,6 +67,7 @@ QT_END_NAMESPACE #ifdef Q_OS_WIN32 #include +#include QT_BEGIN_NAMESPACE @@ -93,102 +94,6 @@ struct { {NETUnknown, "", ""}, }; -static QString keyPath(const QString &rKey) -{ - int idx = rKey.lastIndexOf(QLatin1Char('\\')); - if (idx == -1) - return QString(); - return rKey.left(idx + 1); -} - -static QString keyName(const QString &rKey) -{ - int idx = rKey.lastIndexOf(QLatin1Char('\\')); - if (idx == -1) - return rKey; - - QString res(rKey.mid(idx + 1)); - if (res == "Default" || res == ".") - res = ""; - return res; -} - -static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) -{ - - QString rSubkeyName = keyName(rSubkey); - QString rSubkeyPath = keyPath(rSubkey); - - HKEY handle = 0; - LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); - - if (res != ERROR_SUCCESS) - return QString(); - - // get the size and type of the value - DWORD dataType; - DWORD dataSize; - res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - if (res != ERROR_SUCCESS) { - RegCloseKey(handle); - return QString(); - } - - // get the value - QByteArray data(dataSize, 0); - res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast(data.data()), &dataSize); - if (res != ERROR_SUCCESS) { - RegCloseKey(handle); - return QString(); - } - - QString result; - switch (dataType) { - case REG_EXPAND_SZ: - case REG_SZ: { - result = QString::fromWCharArray(((const wchar_t *)data.constData())); - break; - } - - case REG_MULTI_SZ: { - QStringList l; - int i = 0; - for (;;) { - QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); - i += s.length() + 1; - - if (s.isEmpty()) - break; - l.append(s); - } - result = l.join(", "); - break; - } - - case REG_NONE: - case REG_BINARY: { - result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); - break; - } - - case REG_DWORD_BIG_ENDIAN: - case REG_DWORD: { - Q_ASSERT(data.size() == sizeof(int)); - int i; - memcpy((char*)&i, data.constData(), sizeof(int)); - result = QString::number(i); - break; - } - - default: - qWarning("QSettings: unknown data %d type in windows registry", dataType); - break; - } - - RegCloseKey(handle); - return result; -} QT_END_NAMESPACE #endif diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 17d9518..187232f 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -17,7 +17,8 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ generators/symbian/symmake.cpp \ generators/symbian/symmake_abld.cpp \ generators/symbian/symmake_sbsv2.cpp \ - generators/symbian/initprojectdeploy_symbian.cpp + generators/symbian/initprojectdeploy_symbian.cpp \ + windows/registry.cpp HEADERS += project.h property.h generators/makefile.h \ generators/unix/unixmake.h meta.h option.h cachekeys.h \ @@ -29,8 +30,8 @@ HEADERS += project.h property.h generators/makefile.h \ generators/symbian/symmake.h \ generators/symbian/symmake_abld.h \ generators/symbian/symmake_sbsv2.h \ - generators/symbian/epocroot.h \ - generators/symbian/initprojectdeploy_symbian.h + generators/symbian/initprojectdeploy_symbian.h \ + windows/registry.h contains(QT_EDITION, OpenSource) { DEFINES += QMAKE_OPENSOURCE_EDITION diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 00dcbce..f3f9d53 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -27,5 +27,9 @@ INCPATH += generators \ $$QT_SOURCE_TREE/include \ $$QT_SOURCE_TREE/include/QtCore \ $$QT_SOURCE_TREE/qmake + +VPATH += $$QT_SOURCE_TREE/tools/shared +INCPATH += $$QT_SOURCE_TREE/tools/shared + include(qmake.pri) diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp new file mode 100644 index 0000000..d342d78 --- /dev/null +++ b/tools/shared/windows/registry.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "registry.h" + +/*! + Returns the path part of a registry key. + e.g. + For a key + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir" + it returns + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\" +*/ +static QString keyPath(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return QString(); + return rKey.left(idx + 1); +} + +/*! + Returns the name part of a registry key. + e.g. + For a key + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir" + it returns + "ProductDir" +*/ +static QString keyName(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return rKey; + + QString res(rKey.mid(idx + 1)); + if (res == "Default" || res == ".") + res = ""; + return res; +} + +QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) +{ + QString result; + +#ifdef Q_OS_WIN32 + QString rSubkeyName = keyName(rSubkey); + QString rSubkeyPath = keyPath(rSubkey); + + HKEY handle = 0; + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); + + if (res != ERROR_SUCCESS) + return QString(); + + // get the size and type of the value + DWORD dataType; + DWORD dataSize; + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); + if (res != ERROR_SUCCESS) { + RegCloseKey(handle); + return QString(); + } + + // get the value + QByteArray data(dataSize, 0); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast(data.data()), &dataSize); + if (res != ERROR_SUCCESS) { + RegCloseKey(handle); + return QString(); + } + + switch (dataType) { + case REG_EXPAND_SZ: + case REG_SZ: { + result = QString::fromWCharArray(((const wchar_t *)data.constData())); + break; + } + + case REG_MULTI_SZ: { + QStringList l; + int i = 0; + for (;;) { + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); + i += s.length() + 1; + + if (s.isEmpty()) + break; + l.append(s); + } + result = l.join(", "); + break; + } + + case REG_NONE: + case REG_BINARY: { + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); + break; + } + + case REG_DWORD_BIG_ENDIAN: + case REG_DWORD: { + Q_ASSERT(data.size() == sizeof(int)); + int i; + memcpy((char*)&i, data.constData(), sizeof(int)); + result = QString::number(i); + break; + } + + default: + qWarning("QSettings: unknown data %d type in windows registry", dataType); + break; + } + + RegCloseKey(handle); +#endif + + return result; +} + + diff --git a/tools/shared/windows/registry.h b/tools/shared/windows/registry.h new file mode 100644 index 0000000..3896527 --- /dev/null +++ b/tools/shared/windows/registry.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOWS_REGISTRY_H +#define WINDOWS_REGISTRY_H + +#include + +#ifdef Q_OS_WIN32 + #include +#else + typedef void* HKEY; +#endif + +#include + +/** + * Read a value from the Windows registry. + * + * If the key is not found, or the registry cannot be accessed (for example + * if this code is compiled for a platform other than Windows), a null + * string is returned. + */ +QString readRegistryKey(HKEY parentHandle, const QString &rSubkey); + +#endif // WINDOWS_REGISTRY_H -- cgit v0.12 From 295e3dd7e07c7a1788e3dce4446eab9a608f99e6 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 10 Feb 2010 14:57:51 +0000 Subject: Factored epocRoot implementation out of qmake This function is now implemented in its own source file, rather than being embedded within the Symbian qmake generator. The motivation for this is to allow code to be shared between qmake and configure - the latter needs to determine the epoc root path in order to perform feature detection on Symbian SDKs. Reviewed-by: Miikka Heikkinen (cherry picked from commit 6ebcf2c24b43fdc1d6da50e9d7ec9dd63dd507d7) --- qmake/Makefile.unix | 9 +- qmake/Makefile.win32 | 5 + qmake/Makefile.win32-g++ | 4 + qmake/Makefile.win32-g++-sh | 4 + qmake/generators/symbian/epocroot.h | 51 ----- .../symbian/initprojectdeploy_symbian.cpp | 96 +-------- .../generators/symbian/initprojectdeploy_symbian.h | 2 - qmake/generators/symbian/symmake.cpp | 3 + qmake/generators/symbian/symmake_abld.cpp | 3 + qmake/generators/symbian/symmake_sbsv2.cpp | 3 + qmake/project.cpp | 5 +- qmake/qmake.pri | 6 +- tools/shared/symbian/epocroot.cpp | 230 +++++++++++++++++++++ tools/shared/symbian/epocroot.h | 67 ++++++ 14 files changed, 337 insertions(+), 151 deletions(-) delete mode 100644 qmake/generators/symbian/epocroot.h create mode 100644 tools/shared/symbian/epocroot.cpp create mode 100644 tools/shared/symbian/epocroot.h diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 0d6c117..94b34b7 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -11,7 +11,8 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \ symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \ - registry.o + registry.o \ + epocroot.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -22,6 +23,7 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qgl qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \ qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ registry.o \ + epocroot.o \ $(QTOBJS) @@ -35,6 +37,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \ $(SOURCE_PATH)/tools/shared/windows/registry.cpp \ + $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ @@ -285,6 +288,9 @@ initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp +epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp @@ -293,6 +299,7 @@ qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + #default rules .cpp.o: $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index bbc37c1..a598350 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -78,6 +78,7 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw borland_bmake.obj msvc_nmake.obj msvc_vcproj.obj \ msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \ registry.obj \ + epocroot.obj \ symmake_abld.obj symmake_sbsv2.obj !IFDEF QMAKE_OPENSOURCE_EDITION @@ -201,6 +202,7 @@ clean:: -del symmake_sbsv2.obj -del initprojectdeploy_symbian.obj -del registry.obj + -del epocroot.obj -del pbuilder_pbx.obj -del qxmlstream.obj -del qxmlutils.obj @@ -400,6 +402,9 @@ initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initproje registry.obj: $(SOURCE_PATH)/tools/shared/windows/registry.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp +epocroot.obj: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 0b47905..d4d6e0e 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -40,6 +40,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ registry.o \ + epocroot.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -280,6 +281,9 @@ initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initproject registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp +epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 0772aff..5061089 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -40,6 +40,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o \ msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ registry.o \ + epocroot.o \ symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION @@ -279,6 +280,9 @@ initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initproject registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp +epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/generators/symbian/epocroot.h b/qmake/generators/symbian/epocroot.h deleted file mode 100644 index be26438..0000000 --- a/qmake/generators/symbian/epocroot.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EPOCROOT_H -#define EPOCROOT_H - -#include - -// Implementation of epocRoot method is in initprojectdeploy_symbian.cpp -// Defined in separate header for inclusion clarity -extern QString epocRoot(); - -#endif // EPOCROOT_H diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 7279a4c..0d50112 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -46,105 +46,15 @@ #include #include +// Included from tools/shared +#include + #define SYSBIN_DIR "\\sys\\bin" #define SUFFIX_DLL "dll" #define SUFFIX_EXE "exe" #define SUFFIX_QTPLUGIN "qtplugin" -static void fixEpocRootStr(QString& path) -{ - path.replace("\\", "/"); - - if (path.size() > 1 && path[1] == QChar(':')) { - path = path.mid(2); - } - - if (!path.size() || path[path.size()-1] != QChar('/')) { - path += QChar('/'); - } -} - -#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs" - -static QString epocRootStr; - -QString epocRoot() -{ - if (!epocRootStr.isEmpty()) { - return epocRootStr; - } - - // First, check the env variable - epocRootStr = qgetenv("EPOCROOT"); - - if (epocRootStr.isEmpty()) { - // No EPOCROOT set, check the default device - // First check EPOCDEVICE env variable - QString defaultDevice = qgetenv("EPOCDEVICE"); - - // Check the windows registry via QSettings for devices.xml path - QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat); - QString devicesXmlPath = settings.value("CommonPath").toString(); - - if (!devicesXmlPath.isEmpty()) { - // Parse xml for correct device - devicesXmlPath += "/devices.xml"; - QFile devicesFile(devicesXmlPath); - if (devicesFile.open(QIODevice::ReadOnly)) { - QXmlStreamReader xml(&devicesFile); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "devices") { - if (xml.attributes().value("version") == "1.0") { - // Look for correct device - while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "device") { - if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") || - (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) { - // Found the correct device - while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { - xml.readNext(); - if (xml.isStartElement() && xml.name() == "epocroot") { - epocRootStr = xml.readElementText(); - fixEpocRootStr(epocRootStr); - return epocRootStr; - } - } - xml.raiseError("No epocroot element found"); - } - } - } - } else { - xml.raiseError("Invalid 'devices' element version"); - } - } - } - if (xml.hasError()) { - fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString())); - } - } else { - fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath)); - } - } else { - fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n"); - } - - fprintf(stderr, "Failed to determine epoc root.\n"); - if (!defaultDevice.isEmpty()) - fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice)); - fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n"); - - // No valid device found; set epocroot to "/" - epocRootStr = QLatin1String("/"); - } - - fixEpocRootStr(epocRootStr); - return epocRootStr; -} - - static bool isPlugin(const QFileInfo& info, const QString& devicePath) { // Libraries are plugins if deployment path is something else than diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index e23e6a9..b409225 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -50,8 +50,6 @@ #include #include -#include "epocroot.h" - #define PLUGIN_STUB_DIR "qmakepluginstubs" struct CopyItem diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 6854084..ac4bca3 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -49,6 +49,9 @@ #include #include +// Included from tools/shared +#include + #define RESOURCE_DIRECTORY_MMP "/resource/apps" #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 9b7ae3e..81165f5 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -48,6 +48,9 @@ #include #include +// Included from tools/shared +#include + #define DO_NOTHING_TARGET "do_nothing" #define CREATE_TEMPS_TARGET "create_temps" #define EXTENSION_CLEAN "extension_clean" diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index f610181..4366f0e 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -48,6 +48,9 @@ #include #include +// Included from tools/shared +#include + SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { } SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } diff --git a/qmake/project.cpp b/qmake/project.cpp index 8871152..4193163 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -44,8 +44,6 @@ #include "option.h" #include "cachekeys.h" -#include "epocroot.h" - #include #include #include @@ -64,6 +62,9 @@ #include #include +// Included from tools/shared +#include + #ifdef Q_OS_WIN32 #define QT_POPEN _popen #define QT_PCLOSE _pclose diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 187232f..0821f00 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -18,7 +18,8 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ generators/symbian/symmake_abld.cpp \ generators/symbian/symmake_sbsv2.cpp \ generators/symbian/initprojectdeploy_symbian.cpp \ - windows/registry.cpp + windows/registry.cpp \ + symbian/epocroot.cpp HEADERS += project.h property.h generators/makefile.h \ generators/unix/unixmake.h meta.h option.h cachekeys.h \ @@ -31,7 +32,8 @@ HEADERS += project.h property.h generators/makefile.h \ generators/symbian/symmake_abld.h \ generators/symbian/symmake_sbsv2.h \ generators/symbian/initprojectdeploy_symbian.h \ - windows/registry.h + windows/registry.h \ + symbian/epocroot.h contains(QT_EDITION, OpenSource) { DEFINES += QMAKE_OPENSOURCE_EDITION diff --git a/tools/shared/symbian/epocroot.cpp b/tools/shared/symbian/epocroot.cpp new file mode 100644 index 0000000..071477d --- /dev/null +++ b/tools/shared/symbian/epocroot.cpp @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +#include "epocroot.h" +#include "../windows/registry.h" + +// Registry key under which the location of the Symbian devices.xml file is +// stored. +// Note that, on 64-bit machines, this key is located under the 32-bit +// compatibility key: +// HKEY_LOCAL_MACHINE\Software\Wow6432Node +#define SYMBIAN_SDKS_REG_SUBKEY "Software\\Symbian\\EPOC SDKs\\CommonPath" + +#ifdef Q_OS_WIN32 +# define SYMBIAN_SDKS_REG_HANDLE HKEY_LOCAL_MACHINE +#else +# define SYMBIAN_SDKS_REG_HANDLE 0 +#endif + +// Value which is populated and returned by the epocRoot() function. +// Stored as a static value in order to avoid unnecessary re-evaluation. +static QString epocRootValue; + +#ifdef QT_BUILD_QMAKE +std::ostream &operator<<(std::ostream &s, const QString &val) { + s << val.toLocal8Bit().data(); + return s; +} +#else +// Operator implemented in configureapp.cpp +std::ostream &operator<<(std::ostream &s, const QString &val); +#endif + +QString getDevicesXmlPath() + { + // Note that the following call will return a null string on platforms other + // than Windows. If support is required on other platforms for devices.xml, + // an alternative mechanism for retrieving the location of this file will + // be required. + return readRegistryKey(SYMBIAN_SDKS_REG_HANDLE, SYMBIAN_SDKS_REG_SUBKEY); + } + +/** + * Checks whether epocRootValue points to an existent directory. + * If not, epocRootValue is set to an empty string and an error message is printed. + */ +void checkEpocRootExists(const QString &source) +{ + if (!epocRootValue.isEmpty()) { + QDir dir(epocRootValue); + if (!dir.exists()) { + std::cerr << "Warning: " << source << " is set to an invalid path: " << epocRootValue << std::endl; + epocRootValue = QString(); + } + } +} + +/** + * Translate path from Windows to Qt format. + */ +static void fixEpocRoot(QString &path) +{ + path.replace("\\", "/"); + + if (path.size() > 1 && path[1] == QChar(':')) { + path = path.mid(2); + } + + if (!path.size() || path[path.size()-1] != QChar('/')) { + path += QChar('/'); + } +} + +/** + * Determine the epoc root for the currently active SDK. + */ +QString epocRoot() +{ + if (epocRootValue.isEmpty()) { + // 1. If environment variable EPOCROOT is set and points to an existent + // directory, this is returned. + epocRootValue = qgetenv("EPOCROOT"); + checkEpocRootExists("EPOCROOT"); + + if (epocRootValue.isEmpty()) { + // 2. The location of devices.xml is specified by a registry key. If this + // file exists, it is parsed. + QString devicesXmlPath = getDevicesXmlPath(); + if (devicesXmlPath.isEmpty()) { + std::cerr << "Error: Symbian SDK registry key not found" << std::endl; + } else { + devicesXmlPath += "/devices.xml"; + QFile devicesFile(devicesXmlPath); + if (devicesFile.open(QIODevice::ReadOnly)) { + + // 3. If the EPOCDEVICE environment variable is set and a corresponding + // entry is found in devices.xml, and its epocroot value points to an + // existent directory, it is returned. + // 4. If a device element marked as default is found in devices.xml and its + // epocroot value points to an existent directory, this is returned. + + const QString epocDeviceValue = qgetenv("EPOCDEVICE"); + bool epocDeviceFound = false; + + QXmlStreamReader xml(&devicesFile); + while (!xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "devices") { + if (xml.attributes().value("version") == "1.0") { + while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "device") { + const bool isDefault = xml.attributes().value("default") == "yes"; + const QString id = xml.attributes().value("id").toString(); + const QString name = xml.attributes().value("name").toString(); + const bool epocDeviceMatch = (id + ":" + name) == epocDeviceValue; + epocDeviceFound |= epocDeviceMatch; + + if((epocDeviceValue.isEmpty() && isDefault) || epocDeviceMatch) { + // Found a matching device + while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "epocroot") { + epocRootValue = xml.readElementText(); + const QString deviceSource = epocDeviceValue.isEmpty() + ? "default device" + : "EPOCDEVICE (" + epocDeviceValue + ")"; + checkEpocRootExists(deviceSource); + } + } + + if (epocRootValue.isEmpty()) + xml.raiseError("No epocroot element found"); + } + } + } + } else { + xml.raiseError("Invalid 'devices' element version"); + } + } + } + if (xml.hasError()) { + std::cerr << "Error: \"" << xml.errorString() << "\" when parsing devices.xml" << std::endl; + } else { + if (epocRootValue.isEmpty()) { + if (!epocDeviceValue.isEmpty()) { + if (epocDeviceFound) { + std::cerr << "Error: missing or invalid epocroot attribute " + << "in device '" << epocDeviceValue << "'"; + } else { + std::cerr << "Error: no device matching EPOCDEVICE (" + << epocDeviceValue << ")"; + } + } else { + if (epocDeviceFound) { + std::cerr << "Error: missing or invalid epocroot attribute " + << "in default device"; + } else { + std::cerr << "Error: no default device"; + } + } + std::cerr << " found in devices.xml file." << std::endl; + } + } + } else { + std::cerr << "Error: could not open file " << devicesXmlPath << std::endl; + } + } + } + + if (epocRootValue.isEmpty()) { + // 5. An empty string is returned. + std::cerr << "Error: failed to find epoc root" << std::endl + << "Either" << std::endl + << " 1. Set EPOCROOT environment variable to a valid value" << std::endl + << " or 2. Ensure that the HKEY_LOCAL_MACHINE\\" SYMBIAN_SDKS_REG_SUBKEY + " registry key is set, and then" << std::endl + << " a. Set EPOCDEVICE environment variable to a valid device" << std::endl + << " or b. Specify a default device in the devices.xml file." << std::endl; + } else { + fixEpocRoot(epocRootValue); + } + } + + return epocRootValue; +} + diff --git a/tools/shared/symbian/epocroot.h b/tools/shared/symbian/epocroot.h new file mode 100644 index 0000000..9846485 --- /dev/null +++ b/tools/shared/symbian/epocroot.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMBIAN_EPOCROOT_H +#define SYMBIAN_EPOCROOT_H + +#include + +/** + * Determine the epoc root for the currently active SDK. + * + * The algorithm used is as follows: + * 1. If environment variable EPOCROOT is set and points to an existent + * directory, this is returned. + * 2. The location of devices.xml is specified by a registry key. If this + * file exists, it is parsed. + * 3. If the EPOCDEVICE environment variable is set and a corresponding + * entry is found in devices.xml, and its epocroot value points to an + * existent directory, it is returned. + * 4. If a device element marked as default is found in devices.xml and its + * epocroot value points to an existent directory, this is returned. + * 5. An empty string is returned. + * + * Any return value other than the empty string therefore is guaranteed to + * point to an existent directory. + */ +QString epocRoot(); + +#endif // EPOCROOT_H -- cgit v0.12 From 8fcb0b6618610cb2ff947fc62f57abd33c8438b6 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 19 Feb 2010 11:16:34 +0100 Subject: Fixed linkage failure when building qmake on Unix platforms Commits f641369c/5254184c and 13cb80be/6ebcf2c2 caused registry.o and epocroot.o respectively to be included twice during the linkage step of qmake/Makefile.unix. (cherry picked from commit 480f3df2eab9ad13e0d7ea1245158866a0b942bd) --- qmake/Makefile.unix | 2 -- 1 file changed, 2 deletions(-) diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 94b34b7..54d52f2 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -22,8 +22,6 @@ QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qgl qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \ qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \ qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ - registry.o \ - epocroot.o \ $(QTOBJS) -- cgit v0.12 From 6bd5eba10a787a8458f6f77af2d24f4773b22f98 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 23 Feb 2010 09:47:33 +0100 Subject: Fixed shadow builds on Unix. --- qmake/Makefile.unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 54d52f2..c101626 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -66,7 +66,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ - -I$(BUILD_PATH)/tools/shared \ + -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_PCRE \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ -- cgit v0.12 From ca204e26f0c94a3f7ffbf2dfdf99ead5fa3ef33a Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 23 Feb 2010 10:21:07 +0100 Subject: Fix compilation with namespace. --- src/declarative/qml/qmllist.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qmllist.h index cedc35b..5528d8d 100644 --- a/src/declarative/qml/qmllist.h +++ b/src/declarative/qml/qmllist.h @@ -133,10 +133,11 @@ private: friend class QmlListReferencePrivate; QmlListReferencePrivate* d; }; -Q_DECLARE_METATYPE(QmlListReference); QT_END_NAMESPACE +Q_DECLARE_METATYPE(QmlListReference); + QT_END_HEADER #endif // QMLLIST_H -- cgit v0.12 From 9f34ce3029326dabad79357acde2c529c5265693 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 23 Feb 2010 20:27:09 +0100 Subject: Fix compilation error in openVG After 58533cbc7322c4f821f2 --- src/openvg/qpaintengine_vg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 24f678b..bc9f0c9 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3083,7 +3083,7 @@ void QVGPaintEngine::drawPixmapFragments(const QPainter::Fragment *drawingData, for (int i = 0; i < dataCount; ++i) { QTransform transform(d->imageTransform); - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); + transform.translate(drawingData[i].x, drawingData[i].y); transform.rotate(drawingData[i].rotation); VGImage child; -- cgit v0.12 From 35da749cba87e4e08a630bd359403fde8f266f0d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 18 Feb 2010 20:52:45 +0100 Subject: Compile with QT_USE_FAST_OPERATOR_PLUS Reviewed-by: Joao (cherry picked from commit 5d3eb7a1062744afad06882e9a8f59c84fd4e8b7) --- src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 5f343ff..af7e5f6 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -180,7 +180,7 @@ void InspectorClientQt::populateSetting(const String& key, String* setting) return; } - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); QVariant storedValue = qsettings.value(settingKey); storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); @@ -197,7 +197,7 @@ void InspectorClientQt::storeSetting(const String& key, const String& setting) } QVariant valueToStore = settingToVariant(setting); - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); qsettings.setValue(settingKey, valueToStore); qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } -- cgit v0.12 From 0f20bdc28458b147cb177b1d45dc06a75ab3b7b9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 09:21:49 +0100 Subject: Fix compilation on Windows For some reason, the MSVC compiler choose the operator+(const QString &, const QString &) instead of operator+(const WebCore::String &, const WebCore::String &) resulting in errors when QT_USE_FAST_OPERATOR_PLUS is used Reviewed-by: Jocelyn Turcotte (cherry picked from commit 1ecfec9950fb66378035f92be8c8b13b1b891872) --- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 5335b07..8ff8d6b 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -329,7 +329,7 @@ static inline void handleElementNamespaces(Element* newElement, const QXmlStream for (int i = 0; i < ns.count(); ++i) { const QXmlStreamNamespaceDeclaration &decl = ns[i]; String namespaceURI = decl.namespaceUri(); - String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + decl.prefix(); + String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix()); newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec, scriptingPermission); if (ec) // exception setting attributes return; -- cgit v0.12 From 1851d61749ad4645aeee83867e020d8276fe6ea6 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 23 Feb 2010 21:22:56 +0100 Subject: Revert "Updated WebKit from /home/jturcott/dev/webkit to qtwebkit-4.7-merged ( 9303f6d67fb964b71ed3e7361367c3ccfaba5e0a )" This reverts commit 45344965f1c6b0cd298a05beea3d74547c5a2a91. Reverting the WebKit update because of build issues on Mac and MSVC 64bit --- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 9 --------- src/3rdparty/webkit/WebCore/WebCore.pro | 23 +++++++++++++---------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 09bc40b..efd96ca 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -499,7 +499,7 @@ # include #endif -#if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS) +#if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS) #define ENABLE_JSC_MULTIPLE_THREADS 1 #endif diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 999fdb0..35511fb 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 9303f6d67fb964b71ed3e7361367c3ccfaba5e0a + 5381ceeb37d97365cfb2f037650dbb4e495bca4e diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index e83b003..362834e 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -44,15 +44,6 @@ * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::handleDataLoadNow): clear m_initialRequest -2010-02-23 Jocelyn Turcotte - - Reviewed by Laszlo Gombos. - - [Qt] Correct build problems while building QtWebKit inside Qt. - https://bugs.webkit.org/show_bug.cgi?id=34975 - - * WebCore.pro: Change the condition !standalone_package to !QTDIR_build - 2010-02-20 Laszlo Gombos Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 63bd728..ba16754 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -47,9 +47,8 @@ CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/generated isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/../JavaScriptCore/generated - # Qt will set the version for us when building in Qt's tree CONFIG(QTDIR_build):include($$QT_SOURCE_TREE/src/qbase.pri) - else: VERSION = $${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} + else: VERSION = 4.7.0 PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h DEFINES *= NDEBUG @@ -2692,15 +2691,19 @@ WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS QMAKE_EXTRA_TARGETS += install } -!CONFIG(QTDIR_build) { - win32-*|wince* { - DLLDESTDIR = $$OUTPUT_DIR/bin - TARGET = $$qtLibraryTarget($$TARGET) +# Qt will set the version for us when building in Qt's tree +!CONFIG(QTDIR_build): VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} - dlltarget.commands = $(COPY_FILE) $(DESTDIR_TARGET) $$[QT_INSTALL_BINS] - dlltarget.CONFIG = no_path - INSTALLS += dlltarget - } +win32-*|wince* { + DLLDESTDIR = $$OUTPUT_DIR/bin + TARGET = $$qtLibraryTarget($$TARGET) + + dlltarget.commands = $(COPY_FILE) $(DESTDIR_TARGET) $$[QT_INSTALL_BINS] + dlltarget.CONFIG = no_path + INSTALLS += dlltarget +} + +!CONFIG(standalone_package) { unix { CONFIG += create_pc create_prl -- cgit v0.12 From 5ee46f459268d8c735aeeca3a3479477dbdd470f Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 23 Feb 2010 21:29:35 +0100 Subject: Revert "Updated WebKit from /home/jturcott/dev/webkit to qtwebkit-4.7-merged ( 5381ceeb37d97365cfb2f037650dbb4e495bca4e )" This reverts commit f3be69195ebe94c003755a652a9ef9e8a3a898fe. Reverting the WebKit update because of build issues on Mac and MSVC 64bit --- src/3rdparty/webkit/.gitattributes | 273 - src/3rdparty/webkit/.gitignore | 18 - src/3rdparty/webkit/ChangeLog | 708 - src/3rdparty/webkit/JavaScriptCore/API/APICast.h | 20 +- src/3rdparty/webkit/JavaScriptCore/API/APIShims.h | 97 - src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp | 18 +- src/3rdparty/webkit/JavaScriptCore/API/JSBase.h | 20 +- .../JavaScriptCore/API/JSCallbackConstructor.cpp | 3 +- .../JavaScriptCore/API/JSCallbackConstructor.h | 2 +- .../JavaScriptCore/API/JSCallbackFunction.cpp | 3 +- .../webkit/JavaScriptCore/API/JSCallbackFunction.h | 2 +- .../webkit/JavaScriptCore/API/JSCallbackObject.h | 5 +- .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 106 +- .../webkit/JavaScriptCore/API/JSClassRef.cpp | 95 +- .../webkit/JavaScriptCore/API/JSClassRef.h | 3 +- .../webkit/JavaScriptCore/API/JSContextRef.cpp | 32 +- .../webkit/JavaScriptCore/API/JSObjectRef.cpp | 64 +- .../webkit/JavaScriptCore/API/JSStringRef.h | 3 +- .../webkit/JavaScriptCore/API/JSValueRef.cpp | 83 +- .../webkit/JavaScriptCore/API/OpaqueJSString.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 8029 +- src/3rdparty/webkit/JavaScriptCore/Info.plist | 4 +- .../webkit/JavaScriptCore/JavaScriptCore.gypi | 19 +- .../webkit/JavaScriptCore/JavaScriptCore.order | 2 + .../webkit/JavaScriptCore/JavaScriptCore.pri | 223 +- .../webkit/JavaScriptCore/JavaScriptCore.pro | 6 + .../JavaScriptCore/assembler/ARMAssembler.cpp | 92 +- .../webkit/JavaScriptCore/assembler/ARMAssembler.h | 91 +- .../JavaScriptCore/assembler/ARMv7Assembler.h | 17 +- .../assembler/AbstractMacroAssembler.h | 8 +- .../JavaScriptCore/assembler/MacroAssembler.h | 23 +- .../JavaScriptCore/assembler/MacroAssemblerARM.cpp | 11 +- .../JavaScriptCore/assembler/MacroAssemblerARM.h | 139 +- .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 49 +- .../assembler/MacroAssemblerCodeRef.h | 6 +- .../JavaScriptCore/assembler/MacroAssemblerX86.h | 2 +- .../assembler/MacroAssemblerX86Common.h | 89 +- .../assembler/MacroAssemblerX86_64.h | 29 +- .../webkit/JavaScriptCore/assembler/X86Assembler.h | 64 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 336 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.h | 34 +- .../webkit/JavaScriptCore/bytecode/EvalCodeCache.h | 2 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 11 - .../JavaScriptCore/bytecode/SamplingTool.cpp | 4 +- .../bytecompiler/BytecodeGenerator.cpp | 22 +- .../bytecompiler/BytecodeGenerator.h | 13 - .../JavaScriptCore/bytecompiler/NodesCodegen.cpp | 1999 - src/3rdparty/webkit/JavaScriptCore/config.h | 23 +- .../webkit/JavaScriptCore/create_jit_stubs | 69 - .../webkit/JavaScriptCore/debugger/Debugger.cpp | 7 +- .../webkit/JavaScriptCore/debugger/Debugger.h | 2 +- .../JavaScriptCore/debugger/DebuggerActivation.cpp | 8 +- .../JavaScriptCore/debugger/DebuggerActivation.h | 6 +- .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 8 +- .../JavaScriptCore/generated/ArrayPrototype.lut.h | 2 +- .../JavaScriptCore/generated/DatePrototype.lut.h | 2 +- .../generated/GeneratedJITStubs_RVCT.h | 1177 - .../webkit/JavaScriptCore/generated/Grammar.cpp | 1542 +- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- .../JavaScriptCore/generated/JSONObject.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Lexer.lut.h | 2 +- .../JavaScriptCore/generated/MathObject.lut.h | 2 +- .../generated/NumberConstructor.lut.h | 2 +- .../generated/RegExpConstructor.lut.h | 2 +- .../JavaScriptCore/generated/RegExpObject.lut.h | 2 +- .../JavaScriptCore/generated/StringPrototype.lut.h | 2 +- .../webkit/JavaScriptCore/interpreter/CachedCall.h | 11 +- .../webkit/JavaScriptCore/interpreter/CallFrame.h | 23 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 278 +- .../webkit/JavaScriptCore/interpreter/Register.h | 65 +- .../JavaScriptCore/interpreter/RegisterFile.cpp | 2 +- .../JavaScriptCore/interpreter/RegisterFile.h | 8 +- .../JavaScriptCore/jit/ExecutableAllocator.h | 28 +- .../jit/ExecutableAllocatorFixedVMPool.cpp | 2 +- .../jit/ExecutableAllocatorPosix.cpp | 6 +- .../jit/ExecutableAllocatorSymbian.cpp | 4 +- .../JavaScriptCore/jit/ExecutableAllocatorWin.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 14 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.h | 116 +- .../webkit/JavaScriptCore/jit/JITArithmetic.cpp | 399 +- src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp | 6 - .../webkit/JavaScriptCore/jit/JITInlineMethods.h | 34 +- .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 377 +- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 1026 +- .../JavaScriptCore/jit/JITPropertyAccess32_64.cpp | 1026 - .../webkit/JavaScriptCore/jit/JITStubCall.h | 17 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 348 +- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 40 +- src/3rdparty/webkit/JavaScriptCore/jsc.cpp | 69 +- .../webkit/JavaScriptCore/os-win32/WinMain.cpp | 81 - .../webkit/JavaScriptCore/parser/Grammar.y | 10 +- .../webkit/JavaScriptCore/parser/Lexer.cpp | 5 +- .../JavaScriptCore/parser/NodeConstructors.h | 6 +- .../webkit/JavaScriptCore/parser/Nodes.cpp | 1891 +- src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h | 10 - .../webkit/JavaScriptCore/parser/Parser.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/pcre/dftables | 1 - src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri | 23 + .../webkit/JavaScriptCore/pcre/pcre_exec.cpp | 4 +- .../JavaScriptCore/profiler/HeavyProfile.cpp | 0 .../webkit/JavaScriptCore/profiler/HeavyProfile.h | 0 .../webkit/JavaScriptCore/profiler/Profile.cpp | 2 +- .../JavaScriptCore/profiler/ProfileGenerator.cpp | 4 +- .../webkit/JavaScriptCore/profiler/ProfileNode.cpp | 8 +- .../webkit/JavaScriptCore/profiler/Profiler.cpp | 22 +- .../webkit/JavaScriptCore/profiler/Profiler.h | 2 +- .../webkit/JavaScriptCore/profiler/TreeProfile.cpp | 0 .../webkit/JavaScriptCore/profiler/TreeProfile.h | 0 .../webkit/JavaScriptCore/qt/api/QtScript.pro | 36 - .../JavaScriptCore/qt/api/qscriptconverter_p.h | 50 - .../webkit/JavaScriptCore/qt/api/qscriptengine.cpp | 108 - .../webkit/JavaScriptCore/qt/api/qscriptengine.h | 49 - .../JavaScriptCore/qt/api/qscriptengine_p.cpp | 54 - .../webkit/JavaScriptCore/qt/api/qscriptengine_p.h | 98 - .../webkit/JavaScriptCore/qt/api/qscriptvalue.cpp | 556 - .../webkit/JavaScriptCore/qt/api/qscriptvalue.h | 99 - .../webkit/JavaScriptCore/qt/api/qscriptvalue_p.h | 744 - .../webkit/JavaScriptCore/qt/api/qtscriptglobal.h | 44 - .../qt/tests/qscriptengine/qscriptengine.pro | 7 - .../qt/tests/qscriptengine/tst_qscriptengine.cpp | 77 - .../qt/tests/qscriptvalue/qscriptvalue.pro | 11 - .../qt/tests/qscriptvalue/tst_qscriptvalue.cpp | 435 - .../qt/tests/qscriptvalue/tst_qscriptvalue.h | 189 - .../qscriptvalue/tst_qscriptvalue_generated.cpp | 1450 - .../webkit/JavaScriptCore/qt/tests/tests.pri | 28 - .../webkit/JavaScriptCore/qt/tests/tests.pro | 3 - .../webkit/JavaScriptCore/runtime/ArgList.h | 10 +- .../webkit/JavaScriptCore/runtime/Arguments.cpp | 13 - .../webkit/JavaScriptCore/runtime/Arguments.h | 3 +- .../JavaScriptCore/runtime/ArrayPrototype.cpp | 98 +- .../runtime/BatchedTransitionOptimizer.h | 2 +- .../webkit/JavaScriptCore/runtime/BooleanObject.h | 2 +- .../webkit/JavaScriptCore/runtime/Collector.cpp | 768 +- .../webkit/JavaScriptCore/runtime/Collector.h | 144 +- .../JavaScriptCore/runtime/CollectorHeapIterator.h | 126 +- .../JavaScriptCore/runtime/CommonIdentifiers.cpp | 3 +- .../JavaScriptCore/runtime/CommonIdentifiers.h | 2 +- .../webkit/JavaScriptCore/runtime/Completion.cpp | 2 - .../JavaScriptCore/runtime/DateConstructor.cpp | 23 +- .../JavaScriptCore/runtime/DateConversion.cpp | 59 +- .../webkit/JavaScriptCore/runtime/DateConversion.h | 19 +- .../webkit/JavaScriptCore/runtime/DateInstance.cpp | 42 +- .../webkit/JavaScriptCore/runtime/DateInstance.h | 19 +- .../JavaScriptCore/runtime/DateInstanceCache.h | 11 +- .../JavaScriptCore/runtime/DatePrototype.cpp | 259 +- .../webkit/JavaScriptCore/runtime/DatePrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/Error.cpp | 8 +- .../JavaScriptCore/runtime/ErrorPrototype.cpp | 23 +- .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 76 +- .../JavaScriptCore/runtime/ExceptionHelpers.h | 1 - .../webkit/JavaScriptCore/runtime/Executable.cpp | 12 +- .../JavaScriptCore/runtime/FunctionConstructor.cpp | 22 +- .../JavaScriptCore/runtime/FunctionPrototype.cpp | 9 +- .../JavaScriptCore/runtime/FunctionPrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/GetterSetter.h | 2 +- .../JavaScriptCore/runtime/GlobalEvalFunction.h | 2 +- .../webkit/JavaScriptCore/runtime/Identifier.cpp | 82 +- .../webkit/JavaScriptCore/runtime/Identifier.h | 68 +- .../JavaScriptCore/runtime/InitializeThreading.cpp | 7 +- .../JavaScriptCore/runtime/InternalFunction.cpp | 18 +- .../JavaScriptCore/runtime/InternalFunction.h | 8 +- .../JavaScriptCore/runtime/JSAPIValueWrapper.h | 2 +- .../webkit/JavaScriptCore/runtime/JSActivation.h | 2 +- .../webkit/JavaScriptCore/runtime/JSArray.cpp | 36 +- .../webkit/JavaScriptCore/runtime/JSArray.h | 5 +- .../webkit/JavaScriptCore/runtime/JSByteArray.cpp | 16 +- .../webkit/JavaScriptCore/runtime/JSByteArray.h | 8 +- .../webkit/JavaScriptCore/runtime/JSCell.cpp | 17 +- .../webkit/JavaScriptCore/runtime/JSCell.h | 48 +- .../webkit/JavaScriptCore/runtime/JSFunction.cpp | 13 - .../webkit/JavaScriptCore/runtime/JSFunction.h | 5 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.cpp | 67 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.h | 49 +- .../JavaScriptCore/runtime/JSGlobalObject.cpp | 2 - .../webkit/JavaScriptCore/runtime/JSGlobalObject.h | 20 +- .../runtime/JSGlobalObjectFunctions.cpp | 48 +- .../JavaScriptCore/runtime/JSNotAnObject.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSNotAnObject.h | 4 +- .../webkit/JavaScriptCore/runtime/JSNumberCell.h | 12 +- .../webkit/JavaScriptCore/runtime/JSONObject.cpp | 23 +- .../webkit/JavaScriptCore/runtime/JSONObject.h | 2 +- .../webkit/JavaScriptCore/runtime/JSObject.cpp | 61 +- .../webkit/JavaScriptCore/runtime/JSObject.h | 34 +- .../runtime/JSPropertyNameIterator.cpp | 23 +- .../runtime/JSPropertyNameIterator.h | 36 +- .../JavaScriptCore/runtime/JSStaticScopeObject.h | 2 +- .../webkit/JavaScriptCore/runtime/JSString.cpp | 93 +- .../webkit/JavaScriptCore/runtime/JSString.h | 324 +- .../JavaScriptCore/runtime/JSStringBuilder.h | 105 - .../webkit/JavaScriptCore/runtime/JSValue.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSValue.h | 44 +- .../JavaScriptCore/runtime/JSVariableObject.cpp | 16 +- .../JavaScriptCore/runtime/JSVariableObject.h | 6 +- .../JavaScriptCore/runtime/JSWrapperObject.h | 6 +- .../webkit/JavaScriptCore/runtime/JSZombie.cpp | 48 - .../webkit/JavaScriptCore/runtime/JSZombie.h | 78 - .../JavaScriptCore/runtime/LiteralParser.cpp | 24 +- .../webkit/JavaScriptCore/runtime/Lookup.cpp | 2 +- .../webkit/JavaScriptCore/runtime/Lookup.h | 2 +- .../webkit/JavaScriptCore/runtime/MarkStack.h | 2 +- .../JavaScriptCore/runtime/MarkStackNone.cpp | 49 - .../JavaScriptCore/runtime/MarkStackPosix.cpp | 6 +- .../JavaScriptCore/runtime/MarkStackSymbian.cpp | 4 - .../webkit/JavaScriptCore/runtime/MarkStackWin.cpp | 6 +- .../webkit/JavaScriptCore/runtime/MathObject.cpp | 26 +- .../webkit/JavaScriptCore/runtime/MathObject.h | 2 +- .../runtime/NativeErrorConstructor.cpp | 2 +- .../JavaScriptCore/runtime/NumberConstructor.h | 2 +- .../webkit/JavaScriptCore/runtime/NumberObject.h | 2 +- .../JavaScriptCore/runtime/NumberPrototype.cpp | 59 +- .../JavaScriptCore/runtime/ObjectConstructor.cpp | 28 +- .../JavaScriptCore/runtime/ObjectPrototype.cpp | 3 +- .../webkit/JavaScriptCore/runtime/Operations.cpp | 26 +- .../webkit/JavaScriptCore/runtime/Operations.h | 271 +- .../JavaScriptCore/runtime/PropertyDescriptor.cpp | 8 +- .../JavaScriptCore/runtime/PropertyDescriptor.h | 2 +- .../JavaScriptCore/runtime/PropertyMapHashTable.h | 1 + .../JavaScriptCore/runtime/PropertyNameArray.cpp | 2 +- .../webkit/JavaScriptCore/runtime/PropertySlot.cpp | 4 +- .../webkit/JavaScriptCore/runtime/PropertySlot.h | 32 +- .../webkit/JavaScriptCore/runtime/RegExp.cpp | 11 +- .../webkit/JavaScriptCore/runtime/RegExp.h | 2 + .../JavaScriptCore/runtime/RegExpConstructor.cpp | 4 +- .../JavaScriptCore/runtime/RegExpConstructor.h | 2 +- .../JavaScriptCore/runtime/RegExpMatchesArray.h | 4 +- .../webkit/JavaScriptCore/runtime/RegExpObject.cpp | 2 +- .../webkit/JavaScriptCore/runtime/RegExpObject.h | 2 +- .../JavaScriptCore/runtime/RegExpPrototype.cpp | 17 +- .../webkit/JavaScriptCore/runtime/SmallStrings.cpp | 59 +- .../webkit/JavaScriptCore/runtime/SmallStrings.h | 1 - .../webkit/JavaScriptCore/runtime/StringBuilder.h | 83 - .../JavaScriptCore/runtime/StringConstructor.cpp | 12 +- .../webkit/JavaScriptCore/runtime/StringObject.cpp | 12 +- .../webkit/JavaScriptCore/runtime/StringObject.h | 4 +- .../StringObjectThatMasqueradesAsUndefined.h | 2 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 231 +- .../webkit/JavaScriptCore/runtime/Structure.cpp | 350 +- .../webkit/JavaScriptCore/runtime/Structure.h | 119 +- .../runtime/StructureTransitionTable.h | 145 +- .../JavaScriptCore/runtime/TimeoutChecker.cpp | 17 +- .../webkit/JavaScriptCore/runtime/Tracing.h | 2 +- .../webkit/JavaScriptCore/runtime/UString.cpp | 1185 +- .../webkit/JavaScriptCore/runtime/UString.h | 710 +- .../webkit/JavaScriptCore/runtime/UStringImpl.cpp | 172 - .../webkit/JavaScriptCore/runtime/UStringImpl.h | 364 - .../webkit/JavaScriptCore/runtime/WeakGCMap.h | 122 - .../webkit/JavaScriptCore/runtime/WeakGCPtr.h | 132 - .../webkit/JavaScriptCore/runtime/WeakRandom.h | 86 - src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h | 2 +- .../webkit/JavaScriptCore/wrec/WRECGenerator.cpp | 6 +- .../webkit/JavaScriptCore/wrec/WRECGenerator.h | 4 +- src/3rdparty/webkit/JavaScriptCore/wscript | 9 +- .../webkit/JavaScriptCore/wtf/AlwaysInline.h | 6 +- .../webkit/JavaScriptCore/wtf/Assertions.cpp | 10 +- .../webkit/JavaScriptCore/wtf/Assertions.h | 102 +- src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h | 46 - .../webkit/JavaScriptCore/wtf/CurrentTime.cpp | 24 +- .../webkit/JavaScriptCore/wtf/CurrentTime.h | 24 +- .../webkit/JavaScriptCore/wtf/DateMath.cpp | 361 +- src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h | 65 +- .../webkit/JavaScriptCore/wtf/FastMalloc.cpp | 193 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 35 +- src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp | 65 + src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h | 98 + .../webkit/JavaScriptCore/wtf/HashFunctions.h | 3 + src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h | 77 +- src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h | 4 +- src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h | 39 +- .../webkit/JavaScriptCore/wtf/ListHashSet.h | 2 +- .../webkit/JavaScriptCore/wtf/MainThread.cpp | 24 +- .../webkit/JavaScriptCore/wtf/MainThread.h | 4 - .../webkit/JavaScriptCore/wtf/MathExtras.h | 54 +- .../webkit/JavaScriptCore/wtf/MessageQueue.h | 90 +- .../webkit/JavaScriptCore/wtf/PassRefPtr.h | 25 +- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 824 +- .../webkit/JavaScriptCore/wtf/PtrAndFlags.h | 79 + .../webkit/JavaScriptCore/wtf/RandomNumber.cpp | 30 +- .../webkit/JavaScriptCore/wtf/RandomNumberSeed.h | 10 +- src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h | 19 +- .../webkit/JavaScriptCore/wtf/RefPtrHashMap.h | 2 +- .../webkit/JavaScriptCore/wtf/StdLibExtras.h | 12 - .../webkit/JavaScriptCore/wtf/StringExtras.cpp | 62 - .../webkit/JavaScriptCore/wtf/StringExtras.h | 15 +- .../JavaScriptCore/wtf/StringHashFunctions.h | 157 - .../webkit/JavaScriptCore/wtf/TCSpinLock.h | 14 +- .../webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp | 2 +- .../wtf/ThreadIdentifierDataPthreads.cpp | 97 - .../wtf/ThreadIdentifierDataPthreads.h | 77 - .../webkit/JavaScriptCore/wtf/ThreadSpecific.h | 57 +- .../webkit/JavaScriptCore/wtf/Threading.cpp | 9 +- src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h | 27 +- .../webkit/JavaScriptCore/wtf/ThreadingNone.cpp | 6 +- .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 47 +- .../webkit/JavaScriptCore/wtf/ThreadingWin.cpp | 14 +- .../webkit/JavaScriptCore/wtf/TypeTraits.cpp | 16 +- .../webkit/JavaScriptCore/wtf/TypeTraits.h | 36 +- src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h | 6 +- .../webkit/JavaScriptCore/wtf/ValueCheck.h | 64 - src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h | 33 +- src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h | 138 - .../webkit/JavaScriptCore/wtf/VectorTraits.h | 2 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp | 103 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h | 12 +- .../webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp | 30 +- .../webkit/JavaScriptCore/wtf/unicode/UTF8.cpp | 1 - .../wtf/unicode/glib/UnicodeGLib.cpp | 1 - .../JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h | 7 +- .../JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp | 6 +- .../JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h | 5 - .../JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 138 +- .../wtf/unicode/wince/UnicodeWince.cpp | 1 - .../JavaScriptCore/wtf/wince/FastMallocWince.h | 1 + .../JavaScriptCore/wtf/wince/MemoryManager.cpp | 8 +- .../webkit/JavaScriptCore/yarr/RegexCompiler.cpp | 2 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 18 +- src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h | 2 +- .../webkit/JavaScriptCore/yarr/RegexPattern.h | 2 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 65237 ++++++++++-- src/3rdparty/webkit/WebCore/ChangeLog-2010-01-29 | 98486 ------------------- src/3rdparty/webkit/WebCore/DerivedSources.cpp | 9 +- .../ForwardingHeaders/runtime/StringBuilder.h | 4 - .../ForwardingHeaders/runtime/UStringImpl.h | 4 - .../WebCore/ForwardingHeaders/runtime/WeakGCMap.h | 4 - .../WebCore/ForwardingHeaders/runtime/WeakGCPtr.h | 4 - .../WebCore/ForwardingHeaders/wtf/PtrAndFlags.h | 5 + .../ForwardingHeaders/wtf/StringHashFunctions.h | 4 - .../WebCore/ForwardingHeaders/wtf/ValueCheck.h | 4 - src/3rdparty/webkit/WebCore/Info.plist | 4 +- .../WebCore/WebCore.ClientBasedGeolocation.exp | 2 - src/3rdparty/webkit/WebCore/WebCore.Video.exp | 23 +- src/3rdparty/webkit/WebCore/WebCore.gypi | 419 +- src/3rdparty/webkit/WebCore/WebCore.order | 2 + src/3rdparty/webkit/WebCore/WebCore.pri | 698 - src/3rdparty/webkit/WebCore/WebCore.pro | 1059 +- src/3rdparty/webkit/WebCore/WebCore.qrc | 1 - src/3rdparty/webkit/WebCore/WebCorePrefix.cpp | 3 +- src/3rdparty/webkit/WebCore/WebCorePrefix.h | 20 +- .../webkit/WebCore/accessibility/AXObjectCache.cpp | 157 +- .../webkit/WebCore/accessibility/AXObjectCache.h | 203 +- .../accessibility/AccessibilityARIAGrid.cpp | 4 +- .../WebCore/accessibility/AccessibilityARIAGrid.h | 3 - .../accessibility/AccessibilityARIAGridRow.cpp | 66 - .../accessibility/AccessibilityARIAGridRow.h | 6 - .../accessibility/AccessibilityAllInOne.cpp | 89 +- .../accessibility/AccessibilityImageMapLink.cpp | 26 +- .../accessibility/AccessibilityImageMapLink.h | 16 +- .../WebCore/accessibility/AccessibilityList.cpp | 10 +- .../WebCore/accessibility/AccessibilityList.h | 2 +- .../WebCore/accessibility/AccessibilityListBox.cpp | 6 +- .../WebCore/accessibility/AccessibilityListBox.h | 2 +- .../accessibility/AccessibilityListBoxOption.cpp | 4 +- .../accessibility/AccessibilityListBoxOption.h | 2 +- .../accessibility/AccessibilityMediaControls.cpp | 8 - .../accessibility/AccessibilityMediaControls.h | 98 +- .../accessibility/AccessibilityMenuList.cpp | 86 - .../WebCore/accessibility/AccessibilityMenuList.h | 59 - .../accessibility/AccessibilityMenuListOption.cpp | 113 - .../accessibility/AccessibilityMenuListOption.h | 69 - .../accessibility/AccessibilityMenuListPopup.cpp | 126 - .../accessibility/AccessibilityMenuListPopup.h | 68 - .../WebCore/accessibility/AccessibilityObject.cpp | 210 +- .../WebCore/accessibility/AccessibilityObject.h | 182 +- .../accessibility/AccessibilityRenderObject.cpp | 1015 +- .../accessibility/AccessibilityRenderObject.h | 63 +- .../accessibility/AccessibilityScrollbar.cpp | 53 - .../WebCore/accessibility/AccessibilityScrollbar.h | 64 - .../WebCore/accessibility/AccessibilitySlider.cpp | 22 +- .../WebCore/accessibility/AccessibilitySlider.h | 76 +- .../WebCore/accessibility/AccessibilityTable.cpp | 16 +- .../WebCore/accessibility/AccessibilityTable.h | 1 - .../accessibility/AccessibilityTableColumn.cpp | 4 +- .../AccessibilityTableHeaderContainer.cpp | 5 +- .../accessibility/AccessibilityTableRow.cpp | 2 +- .../accessibility/qt/AccessibilityObjectQt.cpp | 7 +- .../WebCore/bindings/ScriptControllerBase.cpp | 20 +- .../WebCore/bindings/generic/BindingDOMWindow.h | 126 - .../WebCore/bindings/generic/BindingElement.h | 102 - .../WebCore/bindings/generic/BindingSecurity.h | 132 - .../bindings/generic/BindingSecurityBase.cpp | 108 - .../WebCore/bindings/generic/BindingSecurityBase.h | 52 - .../WebCore/bindings/generic/GenericBinding.h | 52 - .../bindings/generic/RuntimeEnabledFeatures.cpp | 98 - .../bindings/generic/RuntimeEnabledFeatures.h | 94 - .../WebCore/bindings/js/DOMObjectWithSVGContext.h | 57 + .../webkit/WebCore/bindings/js/GCController.cpp | 12 +- .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSAttrCustom.cpp | 6 +- .../WebCore/bindings/js/JSAudioConstructor.cpp | 35 +- .../WebCore/bindings/js/JSBindingsAllInOne.cpp | 9 +- .../webkit/WebCore/bindings/js/JSCSSRuleCustom.cpp | 2 +- .../WebCore/bindings/js/JSCSSValueCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSCallbackData.cpp | 11 +- .../webkit/WebCore/bindings/js/JSCallbackData.h | 2 + .../bindings/js/JSCanvasArrayBufferConstructor.cpp | 70 + .../bindings/js/JSCanvasArrayBufferConstructor.h | 97 + .../WebCore/bindings/js/JSCanvasArrayCustom.cpp | 67 + .../bindings/js/JSCanvasByteArrayConstructor.cpp | 67 + .../bindings/js/JSCanvasByteArrayConstructor.h | 46 + .../bindings/js/JSCanvasByteArrayCustom.cpp | 50 + .../bindings/js/JSCanvasFloatArrayConstructor.cpp | 67 + .../bindings/js/JSCanvasFloatArrayConstructor.h | 46 + .../bindings/js/JSCanvasFloatArrayCustom.cpp | 50 + .../bindings/js/JSCanvasIntArrayConstructor.cpp | 67 + .../bindings/js/JSCanvasIntArrayConstructor.h | 46 + .../WebCore/bindings/js/JSCanvasIntArrayCustom.cpp | 50 + .../js/JSCanvasRenderingContext2DCustom.cpp | 16 +- .../js/JSCanvasRenderingContext3DCustom.cpp | 443 + .../bindings/js/JSCanvasRenderingContextCustom.cpp | 6 +- .../bindings/js/JSCanvasShortArrayConstructor.cpp | 68 + .../bindings/js/JSCanvasShortArrayConstructor.h | 46 + .../bindings/js/JSCanvasShortArrayCustom.cpp | 50 + .../js/JSCanvasUnsignedByteArrayConstructor.cpp | 67 + .../js/JSCanvasUnsignedByteArrayConstructor.h | 46 + .../js/JSCanvasUnsignedByteArrayCustom.cpp | 50 + .../js/JSCanvasUnsignedIntArrayConstructor.cpp | 67 + .../js/JSCanvasUnsignedIntArrayConstructor.h | 46 + .../bindings/js/JSCanvasUnsignedIntArrayCustom.cpp | 50 + .../js/JSCanvasUnsignedShortArrayConstructor.cpp | 67 + .../js/JSCanvasUnsignedShortArrayConstructor.h | 46 + .../js/JSCanvasUnsignedShortArrayCustom.cpp | 50 + .../webkit/WebCore/bindings/js/JSConsoleCustom.cpp | 6 +- .../js/JSCustomSQLStatementErrorCallback.cpp | 2 +- .../bindings/js/JSCustomXPathNSResolver.cpp | 2 +- .../bindings/js/JSDOMApplicationCacheCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 342 +- .../webkit/WebCore/bindings/js/JSDOMBinding.h | 163 +- .../WebCore/bindings/js/JSDOMGlobalObject.cpp | 21 +- .../webkit/WebCore/bindings/js/JSDOMGlobalObject.h | 24 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 17 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.h | 11 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 202 +- .../WebCore/bindings/js/JSDOMWindowShell.cpp | 16 +- .../webkit/WebCore/bindings/js/JSDOMWindowShell.h | 12 +- .../WebCore/bindings/js/JSDocumentCustom.cpp | 16 +- .../webkit/WebCore/bindings/js/JSElementCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSEventCustom.cpp | 19 +- .../webkit/WebCore/bindings/js/JSEventListener.cpp | 23 +- .../webkit/WebCore/bindings/js/JSEventListener.h | 53 +- .../WebCore/bindings/js/JSEventSourceCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSExceptionBase.cpp | 128 +- .../webkit/WebCore/bindings/js/JSExceptionBase.h | 86 +- .../bindings/js/JSHTMLCanvasElementCustom.cpp | 36 +- .../WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 2 +- .../WebCore/bindings/js/JSHTMLDocumentCustom.cpp | 2 +- .../bindings/js/JSHTMLFormElementCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSHistoryCustom.cpp | 73 +- .../WebCore/bindings/js/JSImageConstructor.cpp | 40 +- .../WebCore/bindings/js/JSImageDataCustom.cpp | 2 +- .../bindings/js/JSInjectedScriptHostCustom.cpp | 237 - .../bindings/js/JSInspectedObjectWrapper.cpp | 131 + .../WebCore/bindings/js/JSInspectedObjectWrapper.h | 59 + .../bindings/js/JSInspectorBackendCustom.cpp | 346 + .../bindings/js/JSInspectorCallbackWrapper.cpp | 111 + .../bindings/js/JSInspectorCallbackWrapper.h | 53 + .../bindings/js/JSInspectorFrontendHostCustom.cpp | 80 - .../bindings/js/JSJavaScriptCallFrameCustom.cpp | 4 +- .../WebCore/bindings/js/JSLazyEventListener.cpp | 75 +- .../WebCore/bindings/js/JSLazyEventListener.h | 11 +- .../WebCore/bindings/js/JSLocationCustom.cpp | 29 +- .../WebCore/bindings/js/JSMessagePortCustom.cpp | 6 +- .../WebCore/bindings/js/JSNamedNodeMapCustom.cpp | 6 +- .../webkit/WebCore/bindings/js/JSNodeCustom.cpp | 41 +- .../WebCore/bindings/js/JSNodeFilterCondition.cpp | 2 +- .../WebCore/bindings/js/JSOptionConstructor.cpp | 23 +- .../bindings/js/JSPluginElementFunctions.cpp | 2 +- .../WebCore/bindings/js/JSPopStateEventCustom.cpp | 48 - .../bindings/js/JSQuarantinedObjectWrapper.cpp | 336 + .../bindings/js/JSQuarantinedObjectWrapper.h | 106 + .../webkit/WebCore/bindings/js/JSSVGContextCache.h | 97 - .../bindings/js/JSSVGElementInstanceCustom.cpp | 8 +- .../WebCore/bindings/js/JSSVGLengthCustom.cpp | 16 +- .../WebCore/bindings/js/JSSVGMatrixCustom.cpp | 32 +- .../WebCore/bindings/js/JSSVGPODListCustom.h | 199 - .../WebCore/bindings/js/JSSVGPODTypeWrapper.h | 108 +- .../WebCore/bindings/js/JSSVGPathSegCustom.cpp | 11 +- .../WebCore/bindings/js/JSSVGPathSegListCustom.cpp | 53 +- .../WebCore/bindings/js/JSSVGPointListCustom.cpp | 153 + .../bindings/js/JSSVGTransformListCustom.cpp | 153 + .../webkit/WebCore/bindings/js/JSStorageCustom.cpp | 4 +- .../WebCore/bindings/js/JSStyleSheetCustom.cpp | 8 +- .../bindings/js/JSWebGLArrayBufferConstructor.cpp | 70 - .../bindings/js/JSWebGLArrayBufferConstructor.h | 97 - .../WebCore/bindings/js/JSWebGLArrayCustom.cpp | 72 - .../WebCore/bindings/js/JSWebGLArrayHelper.h | 69 - .../bindings/js/JSWebGLByteArrayConstructor.cpp | 67 - .../bindings/js/JSWebGLByteArrayConstructor.h | 46 - .../WebCore/bindings/js/JSWebGLByteArrayCustom.cpp | 80 - .../bindings/js/JSWebGLFloatArrayConstructor.cpp | 67 - .../bindings/js/JSWebGLFloatArrayConstructor.h | 46 - .../bindings/js/JSWebGLFloatArrayCustom.cpp | 78 - .../bindings/js/JSWebGLIntArrayConstructor.cpp | 67 - .../bindings/js/JSWebGLIntArrayConstructor.h | 46 - .../WebCore/bindings/js/JSWebGLIntArrayCustom.cpp | 78 - .../bindings/js/JSWebGLRenderingContextCustom.cpp | 835 - .../bindings/js/JSWebGLShortArrayConstructor.cpp | 68 - .../bindings/js/JSWebGLShortArrayConstructor.h | 46 - .../bindings/js/JSWebGLShortArrayCustom.cpp | 78 - .../js/JSWebGLUnsignedByteArrayConstructor.cpp | 67 - .../js/JSWebGLUnsignedByteArrayConstructor.h | 46 - .../bindings/js/JSWebGLUnsignedByteArrayCustom.cpp | 78 - .../js/JSWebGLUnsignedIntArrayConstructor.cpp | 67 - .../js/JSWebGLUnsignedIntArrayConstructor.h | 46 - .../bindings/js/JSWebGLUnsignedIntArrayCustom.cpp | 78 - .../js/JSWebGLUnsignedShortArrayConstructor.cpp | 67 - .../js/JSWebGLUnsignedShortArrayConstructor.h | 46 - .../js/JSWebGLUnsignedShortArrayCustom.cpp | 78 - .../WebCore/bindings/js/JSWebSocketConstructor.h | 8 +- .../WebCore/bindings/js/JSWebSocketCustom.cpp | 5 +- .../WebCore/bindings/js/JSWorkerContextBase.cpp | 4 +- .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 27 +- .../WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 14 +- .../bindings/js/JSXMLHttpRequestUploadCustom.cpp | 6 +- .../WebCore/bindings/js/JavaScriptProfile.cpp | 183 - .../webkit/WebCore/bindings/js/JavaScriptProfile.h | 46 - .../WebCore/bindings/js/JavaScriptProfileNode.cpp | 236 - .../WebCore/bindings/js/JavaScriptProfileNode.h | 48 - .../webkit/WebCore/bindings/js/ScheduledAction.cpp | 8 +- .../webkit/WebCore/bindings/js/ScheduledAction.h | 7 +- .../webkit/WebCore/bindings/js/ScriptArray.cpp | 4 - .../WebCore/bindings/js/ScriptCachedFrameData.cpp | 51 +- .../WebCore/bindings/js/ScriptCachedFrameData.h | 8 +- .../webkit/WebCore/bindings/js/ScriptCallStack.cpp | 9 +- .../webkit/WebCore/bindings/js/ScriptCallStack.h | 1 - .../WebCore/bindings/js/ScriptController.cpp | 172 +- .../webkit/WebCore/bindings/js/ScriptController.h | 26 +- .../WebCore/bindings/js/ScriptControllerGtk.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerHaiku.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerMac.mm | 11 +- .../WebCore/bindings/js/ScriptControllerQt.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerWin.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerWx.cpp | 2 +- .../WebCore/bindings/js/ScriptDebugServer.cpp | 49 - .../webkit/WebCore/bindings/js/ScriptDebugServer.h | 46 - .../WebCore/bindings/js/ScriptEventListener.cpp | 31 +- .../WebCore/bindings/js/ScriptFunctionCall.cpp | 33 +- .../WebCore/bindings/js/ScriptFunctionCall.h | 11 +- .../webkit/WebCore/bindings/js/ScriptInstance.h | 2 +- .../webkit/WebCore/bindings/js/ScriptObject.cpp | 43 +- .../webkit/WebCore/bindings/js/ScriptObject.h | 7 - .../WebCore/bindings/js/ScriptObjectQuarantine.cpp | 131 + .../WebCore/bindings/js/ScriptObjectQuarantine.h | 58 + .../webkit/WebCore/bindings/js/ScriptProfile.h | 41 - .../webkit/WebCore/bindings/js/ScriptProfiler.cpp | 49 - .../webkit/WebCore/bindings/js/ScriptProfiler.h | 48 - .../webkit/WebCore/bindings/js/ScriptState.cpp | 16 +- .../webkit/WebCore/bindings/js/ScriptState.h | 7 +- .../webkit/WebCore/bindings/js/ScriptString.h | 6 +- .../webkit/WebCore/bindings/js/ScriptValue.cpp | 16 +- .../webkit/WebCore/bindings/js/ScriptValue.h | 7 +- .../webkit/WebCore/bindings/js/ScriptWrappable.h | 43 - .../WebCore/bindings/js/SerializedScriptValue.cpp | 192 +- .../WebCore/bindings/js/SerializedScriptValue.h | 48 +- .../WebCore/bindings/js/WorkerScriptController.cpp | 5 +- .../WebCore/bindings/scripts/CodeGenerator.pm | 28 +- .../WebCore/bindings/scripts/CodeGeneratorCOM.pm | 1319 + .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 293 +- .../WebCore/bindings/scripts/CodeGeneratorObjC.pm | 16 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 1425 +- .../webkit/WebCore/bindings/scripts/IDLParser.pm | 7 +- .../WebCore/bindings/scripts/IDLStructure.pm | 2 + .../WebCore/bindings/scripts/generate-bindings.pl | 1 + src/3rdparty/webkit/WebCore/bridge/Bridge.h | 48 - src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h | 3 +- src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp | 87 +- src/3rdparty/webkit/WebCore/bridge/c/c_class.h | 2 +- .../webkit/WebCore/bridge/c/c_instance.cpp | 6 +- src/3rdparty/webkit/WebCore/bridge/c/c_instance.h | 6 +- src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp | 2 - src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h | 2 +- .../webkit/WebCore/bridge/jni/JNIBridge.cpp | 181 - src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h | 123 - .../webkit/WebCore/bridge/jni/JNIUtility.cpp | 343 - .../webkit/WebCore/bridge/jni/JNIUtility.h | 275 - .../webkit/WebCore/bridge/jni/jni_class.cpp | 141 + src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h | 62 + .../webkit/WebCore/bridge/jni/jni_instance.cpp | 330 + .../webkit/WebCore/bridge/jni/jni_instance.h | 108 + .../webkit/WebCore/bridge/jni/jni_jsobject.mm | 104 +- src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm | 3 +- .../webkit/WebCore/bridge/jni/jni_runtime.cpp | 547 + .../webkit/WebCore/bridge/jni/jni_runtime.h | 191 + .../webkit/WebCore/bridge/jni/jni_utility.cpp | 584 + .../webkit/WebCore/bridge/jni/jni_utility.h | 288 + .../webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 442 - .../webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h | 89 - .../WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp | 291 - .../WebCore/bridge/jni/jsc/JNIUtilityPrivate.h | 51 - .../webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp | 150 - .../webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h | 62 - .../WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp | 335 - .../WebCore/bridge/jni/jsc/JavaInstanceJSC.h | 108 - .../webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h | 84 - .../webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp | 44 - .../webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h | 56 - .../WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp | 255 - .../WebCore/bridge/jni/v8/JNIUtilityPrivate.h | 43 - .../webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp | 111 - .../webkit/WebCore/bridge/jni/v8/JavaClassV8.h | 61 - .../WebCore/bridge/jni/v8/JavaInstanceV8.cpp | 169 - .../webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h | 100 - .../WebCore/bridge/jni/v8/JavaNPObjectV8.cpp | 168 - .../webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h | 56 - .../webkit/WebCore/bridge/jni/v8/JavaStringV8.h | 61 - .../webkit/WebCore/bridge/jsc/BridgeJSC.cpp | 126 - src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h | 151 - src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h | 3 +- .../webkit/WebCore/bridge/qt/qt_instance.cpp | 8 - .../webkit/WebCore/bridge/qt/qt_instance.h | 6 +- .../webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp | 353 - .../webkit/WebCore/bridge/qt/qt_pixmapruntime.h | 52 - .../webkit/WebCore/bridge/qt/qt_runtime.cpp | 114 +- src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h | 10 +- src/3rdparty/webkit/WebCore/bridge/runtime.cpp | 121 + src/3rdparty/webkit/WebCore/bridge/runtime.h | 153 + .../webkit/WebCore/bridge/runtime_array.cpp | 13 - src/3rdparty/webkit/WebCore/bridge/runtime_array.h | 7 +- .../webkit/WebCore/bridge/runtime_method.h | 4 +- .../webkit/WebCore/bridge/runtime_object.cpp | 7 +- .../webkit/WebCore/bridge/runtime_object.h | 7 +- .../webkit/WebCore/bridge/runtime_root.cpp | 14 +- src/3rdparty/webkit/WebCore/bridge/runtime_root.h | 11 +- .../webkit/WebCore/bridge/testbindings.cpp | 14 +- src/3rdparty/webkit/WebCore/bridge/testbindings.mm | 14 +- .../webkit/WebCore/bridge/testqtbindings.cpp | 17 +- src/3rdparty/webkit/WebCore/config.h | 43 +- src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl | 6 +- .../WebCore/css/CSSComputedStyleDeclaration.cpp | 16 +- .../webkit/WebCore/css/CSSCursorImageValue.cpp | 1 + src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp | 22 +- src/3rdparty/webkit/WebCore/css/CSSFontFace.h | 2 - .../webkit/WebCore/css/CSSFontFaceRule.idl | 6 +- .../webkit/WebCore/css/CSSFontFaceSource.cpp | 8 +- .../webkit/WebCore/css/CSSFontSelector.cpp | 3 +- .../webkit/WebCore/css/CSSGradientValue.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 119 +- src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp | 1 + src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp | 38 +- src/3rdparty/webkit/WebCore/css/CSSImportRule.h | 2 +- src/3rdparty/webkit/WebCore/css/CSSImportRule.idl | 6 +- .../webkit/WebCore/css/CSSInheritedValue.cpp | 2 + .../webkit/WebCore/css/CSSInitialValue.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl | 6 +- .../WebCore/css/CSSMutableStyleDeclaration.cpp | 37 +- src/3rdparty/webkit/WebCore/css/CSSNamespace.h | 4 +- src/3rdparty/webkit/WebCore/css/CSSPageRule.idl | 6 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 371 +- src/3rdparty/webkit/WebCore/css/CSSParser.h | 14 +- .../webkit/WebCore/css/CSSPrimitiveValue.cpp | 105 +- .../webkit/WebCore/css/CSSPrimitiveValue.idl | 9 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 334 +- src/3rdparty/webkit/WebCore/css/CSSProperty.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSProperty.h | 2 + .../webkit/WebCore/css/CSSPropertyNames.in | 1 - src/3rdparty/webkit/WebCore/css/CSSRule.cpp | 1 + src/3rdparty/webkit/WebCore/css/CSSRule.idl | 5 +- src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSRuleList.h | 2 + src/3rdparty/webkit/WebCore/css/CSSRuleList.idl | 5 +- src/3rdparty/webkit/WebCore/css/CSSSelector.cpp | 16 +- src/3rdparty/webkit/WebCore/css/CSSSelector.h | 9 +- .../webkit/WebCore/css/CSSStyleDeclaration.idl | 7 +- src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl | 6 +- .../webkit/WebCore/css/CSSStyleSelector.cpp | 175 +- src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h | 16 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp | 36 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h | 35 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl | 6 +- src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl | 3 +- src/3rdparty/webkit/WebCore/css/CSSValue.idl | 5 +- .../webkit/WebCore/css/CSSValueKeywords.in | 63 - src/3rdparty/webkit/WebCore/css/CSSValueList.cpp | 2 + src/3rdparty/webkit/WebCore/css/CSSValueList.idl | 5 +- .../webkit/WebCore/css/CSSVariablesDeclaration.idl | 1 + .../webkit/WebCore/css/CSSVariablesRule.idl | 4 +- src/3rdparty/webkit/WebCore/css/Counter.idl | 6 +- src/3rdparty/webkit/WebCore/css/FontValue.cpp | 2 + src/3rdparty/webkit/WebCore/css/Media.cpp | 23 +- src/3rdparty/webkit/WebCore/css/Media.h | 12 +- src/3rdparty/webkit/WebCore/css/Media.idl | 4 +- .../webkit/WebCore/css/MediaFeatureNames.cpp | 2 + .../webkit/WebCore/css/MediaFeatureNames.h | 2 + src/3rdparty/webkit/WebCore/css/MediaList.idl | 5 +- src/3rdparty/webkit/WebCore/css/MediaQuery.h | 2 +- .../webkit/WebCore/css/MediaQueryEvaluator.h | 2 +- src/3rdparty/webkit/WebCore/css/MediaQueryExp.h | 2 +- src/3rdparty/webkit/WebCore/css/Pair.h | 2 + src/3rdparty/webkit/WebCore/css/RGBColor.idl | 6 +- src/3rdparty/webkit/WebCore/css/Rect.idl | 6 +- .../WebCore/css/SVGCSSComputedStyleDeclaration.cpp | 2 +- src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp | 2 +- .../webkit/WebCore/css/SVGCSSPropertyNames.in | 2 +- .../webkit/WebCore/css/SVGCSSStyleSelector.cpp | 17 +- .../webkit/WebCore/css/SVGCSSValueKeywords.in | 2 +- src/3rdparty/webkit/WebCore/css/ShadowValue.cpp | 2 + src/3rdparty/webkit/WebCore/css/StyleBase.cpp | 6 +- src/3rdparty/webkit/WebCore/css/StyleSheet.cpp | 18 +- src/3rdparty/webkit/WebCore/css/StyleSheet.h | 20 +- src/3rdparty/webkit/WebCore/css/StyleSheet.idl | 5 +- src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp | 2 + src/3rdparty/webkit/WebCore/css/StyleSheetList.idl | 5 +- .../webkit/WebCore/css/WebKitCSSKeyframeRule.idl | 6 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.cpp | 10 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.h | 2 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.idl | 5 +- .../webkit/WebCore/css/WebKitCSSMatrix.idl | 2 +- .../webkit/WebCore/css/WebKitCSSTransformValue.idl | 3 + src/3rdparty/webkit/WebCore/css/html.css | 30 +- src/3rdparty/webkit/WebCore/css/maketokenizer | 2 + src/3rdparty/webkit/WebCore/css/mathml.css | 100 +- src/3rdparty/webkit/WebCore/css/mediaControls.css | 7 - .../webkit/WebCore/css/mediaControlsGtk.css | 65 - .../webkit/WebCore/css/mediaControlsQuickTime.css | 12 +- src/3rdparty/webkit/WebCore/css/svg.css | 17 +- src/3rdparty/webkit/WebCore/css/view-source.css | 2 +- src/3rdparty/webkit/WebCore/dom/Attr.cpp | 16 +- src/3rdparty/webkit/WebCore/dom/Attr.h | 2 - src/3rdparty/webkit/WebCore/dom/Attr.idl | 13 +- .../webkit/WebCore/dom/BeforeLoadEvent.idl | 4 +- .../webkit/WebCore/dom/BeforeUnloadEvent.cpp | 2 + .../webkit/WebCore/dom/BeforeUnloadEvent.h | 2 + src/3rdparty/webkit/WebCore/dom/CDATASection.idl | 6 +- .../WebCore/dom/CSSMappedAttributeDeclaration.cpp | 2 + src/3rdparty/webkit/WebCore/dom/CharacterData.idl | 6 +- .../webkit/WebCore/dom/CheckedRadioButtons.cpp | 4 - src/3rdparty/webkit/WebCore/dom/ClassNames.cpp | 92 + src/3rdparty/webkit/WebCore/dom/ClassNames.h | 89 + src/3rdparty/webkit/WebCore/dom/ClassNodeList.h | 4 +- src/3rdparty/webkit/WebCore/dom/ClientRect.idl | 4 +- src/3rdparty/webkit/WebCore/dom/ClientRectList.idl | 1 + src/3rdparty/webkit/WebCore/dom/Clipboard.cpp | 43 +- src/3rdparty/webkit/WebCore/dom/Clipboard.h | 5 +- src/3rdparty/webkit/WebCore/dom/Clipboard.idl | 4 +- src/3rdparty/webkit/WebCore/dom/Comment.idl | 6 +- .../webkit/WebCore/dom/CompositionEvent.cpp | 63 - src/3rdparty/webkit/WebCore/dom/CompositionEvent.h | 61 - .../webkit/WebCore/dom/CompositionEvent.idl | 41 - src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 15 - .../webkit/WebCore/dom/DOMCoreException.idl | 4 +- .../webkit/WebCore/dom/DOMImplementation.cpp | 3 +- .../webkit/WebCore/dom/DOMImplementation.idl | 8 +- src/3rdparty/webkit/WebCore/dom/Document.cpp | 543 +- src/3rdparty/webkit/WebCore/dom/Document.h | 142 +- src/3rdparty/webkit/WebCore/dom/Document.idl | 30 +- .../webkit/WebCore/dom/DocumentFragment.idl | 6 +- src/3rdparty/webkit/WebCore/dom/DocumentType.idl | 5 +- .../webkit/WebCore/dom/DynamicNodeList.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 192 +- src/3rdparty/webkit/WebCore/dom/Element.h | 59 +- src/3rdparty/webkit/WebCore/dom/Element.idl | 15 +- src/3rdparty/webkit/WebCore/dom/ElementRareData.h | 4 - src/3rdparty/webkit/WebCore/dom/Entity.idl | 6 +- .../webkit/WebCore/dom/EntityReference.idl | 6 +- src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl | 1 + src/3rdparty/webkit/WebCore/dom/Event.cpp | 43 +- src/3rdparty/webkit/WebCore/dom/Event.h | 6 - src/3rdparty/webkit/WebCore/dom/Event.idl | 8 +- src/3rdparty/webkit/WebCore/dom/EventException.idl | 1 + src/3rdparty/webkit/WebCore/dom/EventListener.h | 2 +- src/3rdparty/webkit/WebCore/dom/EventListener.idl | 2 +- src/3rdparty/webkit/WebCore/dom/EventNames.cpp | 2 + src/3rdparty/webkit/WebCore/dom/EventNames.h | 21 +- src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 35 +- src/3rdparty/webkit/WebCore/dom/EventTarget.h | 24 +- src/3rdparty/webkit/WebCore/dom/EventTarget.idl | 2 +- src/3rdparty/webkit/WebCore/dom/InputElement.cpp | 1 - src/3rdparty/webkit/WebCore/dom/InputElement.h | 8 +- src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp | 1 + src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h | 4 +- src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl | 4 +- .../webkit/WebCore/dom/MappedAttributeEntry.h | 6 +- src/3rdparty/webkit/WebCore/dom/MessageChannel.idl | 2 +- src/3rdparty/webkit/WebCore/dom/MessageEvent.idl | 3 +- src/3rdparty/webkit/WebCore/dom/MessagePort.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/MessagePort.h | 6 +- src/3rdparty/webkit/WebCore/dom/MessagePort.idl | 1 + .../webkit/WebCore/dom/MessagePortChannel.h | 4 +- src/3rdparty/webkit/WebCore/dom/MouseEvent.idl | 4 +- .../webkit/WebCore/dom/MouseRelatedEvent.cpp | 2 +- .../webkit/WebCore/dom/MouseRelatedEvent.h | 2 + src/3rdparty/webkit/WebCore/dom/MutationEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp | 39 +- src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h | 33 - .../webkit/WebCore/dom/NamedMappedAttrMap.h | 6 +- src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl | 5 +- src/3rdparty/webkit/WebCore/dom/Node.cpp | 319 +- src/3rdparty/webkit/WebCore/dom/Node.h | 27 +- src/3rdparty/webkit/WebCore/dom/Node.idl | 7 +- src/3rdparty/webkit/WebCore/dom/NodeFilter.h | 5 +- src/3rdparty/webkit/WebCore/dom/NodeFilter.idl | 2 +- src/3rdparty/webkit/WebCore/dom/NodeIterator.h | 7 +- src/3rdparty/webkit/WebCore/dom/NodeIterator.idl | 3 +- src/3rdparty/webkit/WebCore/dom/NodeList.idl | 5 +- src/3rdparty/webkit/WebCore/dom/NodeRareData.h | 4 +- src/3rdparty/webkit/WebCore/dom/Notation.idl | 6 +- src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl | 4 +- .../webkit/WebCore/dom/PageTransitionEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp | 50 - src/3rdparty/webkit/WebCore/dom/PopStateEvent.h | 57 - src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl | 38 - src/3rdparty/webkit/WebCore/dom/Position.cpp | 102 +- src/3rdparty/webkit/WebCore/dom/Position.h | 12 +- .../webkit/WebCore/dom/PositionIterator.cpp | 12 +- .../webkit/WebCore/dom/ProcessingInstruction.cpp | 17 +- .../webkit/WebCore/dom/ProcessingInstruction.h | 4 +- .../webkit/WebCore/dom/ProcessingInstruction.idl | 9 +- src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp | 12 +- src/3rdparty/webkit/WebCore/dom/QualifiedName.h | 6 +- src/3rdparty/webkit/WebCore/dom/Range.cpp | 44 +- src/3rdparty/webkit/WebCore/dom/Range.h | 8 - src/3rdparty/webkit/WebCore/dom/Range.idl | 2 +- src/3rdparty/webkit/WebCore/dom/RangeException.h | 2 + src/3rdparty/webkit/WebCore/dom/RangeException.idl | 4 +- src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp | 16 +- .../webkit/WebCore/dom/ScriptExecutionContext.cpp | 72 +- .../webkit/WebCore/dom/ScriptExecutionContext.h | 33 +- src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 35 +- src/3rdparty/webkit/WebCore/dom/SelectElement.h | 2 +- .../webkit/WebCore/dom/SelectorNodeList.cpp | 1 + .../webkit/WebCore/dom/SpaceSplitString.cpp | 92 - src/3rdparty/webkit/WebCore/dom/SpaceSplitString.h | 89 - src/3rdparty/webkit/WebCore/dom/StyleElement.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/StyleElement.h | 2 + src/3rdparty/webkit/WebCore/dom/StyledElement.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/StyledElement.h | 2 +- src/3rdparty/webkit/WebCore/dom/Text.idl | 6 +- src/3rdparty/webkit/WebCore/dom/TextEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/Tokenizer.h | 4 +- src/3rdparty/webkit/WebCore/dom/Touch.cpp | 72 - src/3rdparty/webkit/WebCore/dom/Touch.h | 75 - src/3rdparty/webkit/WebCore/dom/Touch.idl | 40 - src/3rdparty/webkit/WebCore/dom/TouchEvent.cpp | 67 - src/3rdparty/webkit/WebCore/dom/TouchEvent.h | 82 - src/3rdparty/webkit/WebCore/dom/TouchEvent.idl | 53 - src/3rdparty/webkit/WebCore/dom/TouchList.cpp | 43 - src/3rdparty/webkit/WebCore/dom/TouchList.h | 60 - src/3rdparty/webkit/WebCore/dom/TouchList.idl | 36 - .../webkit/WebCore/dom/TransformSourceLibxslt.cpp | 4 - src/3rdparty/webkit/WebCore/dom/TreeWalker.h | 17 +- src/3rdparty/webkit/WebCore/dom/TreeWalker.idl | 3 +- src/3rdparty/webkit/WebCore/dom/UIEvent.idl | 4 +- .../webkit/WebCore/dom/WebKitAnimationEvent.idl | 4 +- .../webkit/WebCore/dom/WebKitTransitionEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/WheelEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp | 7 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h | 28 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 113 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 143 +- .../dom/default/PlatformMessagePortChannel.cpp | 3 +- .../dom/default/PlatformMessagePortChannel.h | 21 +- src/3rdparty/webkit/WebCore/dom/make_names.pl | 197 +- .../webkit/WebCore/editing/AppendNodeCommand.cpp | 6 - .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 12 +- .../WebCore/editing/CompositeEditCommand.cpp | 24 +- .../WebCore/editing/DeleteButtonController.cpp | 8 +- .../WebCore/editing/DeleteButtonController.h | 2 +- .../WebCore/editing/DeleteFromTextNodeCommand.cpp | 6 - .../WebCore/editing/DeleteSelectionCommand.cpp | 17 +- src/3rdparty/webkit/WebCore/editing/Editor.cpp | 89 +- .../webkit/WebCore/editing/EditorCommand.cpp | 5 +- .../WebCore/editing/IndentOutdentCommand.cpp | 82 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 4 +- .../WebCore/editing/InsertIntoTextNodeCommand.cpp | 6 - .../WebCore/editing/InsertNodeBeforeCommand.cpp | 5 +- .../editing/InsertParagraphSeparatorCommand.cpp | 24 +- .../WebCore/editing/JoinTextNodesCommand.cpp | 6 +- .../editing/MergeIdenticalElementsCommand.cpp | 4 +- .../webkit/WebCore/editing/RemoveNodeCommand.cpp | 4 +- .../WebCore/editing/ReplaceSelectionCommand.cpp | 114 +- .../WebCore/editing/ReplaceSelectionCommand.h | 2 - .../webkit/WebCore/editing/SelectionController.cpp | 347 +- .../webkit/WebCore/editing/SelectionController.h | 86 +- .../webkit/WebCore/editing/SplitElementCommand.cpp | 35 +- .../webkit/WebCore/editing/SplitElementCommand.h | 2 - .../WebCore/editing/SplitTextNodeCommand.cpp | 9 +- .../webkit/WebCore/editing/TextIterator.cpp | 319 +- .../webkit/WebCore/editing/TypingCommand.cpp | 8 +- .../webkit/WebCore/editing/VisibleSelection.cpp | 4 +- .../webkit/WebCore/editing/VisibleSelection.h | 6 +- .../editing/WrapContentsInDummySpanCommand.cpp | 40 +- .../editing/WrapContentsInDummySpanCommand.h | 2 - .../WebCore/editing/android/EditorAndroid.cpp | 39 + .../WebCore/editing/chromium/EditorChromium.cpp | 44 + .../WebCore/editing/gtk/SelectionControllerGtk.cpp | 45 + .../webkit/WebCore/editing/htmlediting.cpp | 43 +- src/3rdparty/webkit/WebCore/editing/htmlediting.h | 5 +- src/3rdparty/webkit/WebCore/editing/markup.cpp | 31 +- src/3rdparty/webkit/WebCore/editing/markup.h | 5 +- .../webkit/WebCore/editing/visible_units.cpp | 11 +- .../webkit/WebCore/generated/ArrayPrototype.lut.h | 34 + .../webkit/WebCore/generated/CSSGrammar.cpp | 3041 +- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 110 +- .../webkit/WebCore/generated/CSSPropertyNames.cpp | 1204 +- .../webkit/WebCore/generated/CSSPropertyNames.h | 224 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 2844 +- .../webkit/WebCore/generated/CSSValueKeywords.h | 847 +- src/3rdparty/webkit/WebCore/generated/ColorData.c | 5 +- .../webkit/WebCore/generated/DatePrototype.lut.h | 59 + .../webkit/WebCore/generated/DocTypeStrings.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 5607 ++ src/3rdparty/webkit/WebCore/generated/Grammar.h | 173 + .../webkit/WebCore/generated/HTMLEntityNames.c | 5 +- .../webkit/WebCore/generated/HTMLNames.cpp | 1181 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 29 +- .../webkit/WebCore/generated/JSAbstractWorker.cpp | 19 +- .../webkit/WebCore/generated/JSAbstractWorker.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSAttr.cpp | 29 +- src/3rdparty/webkit/WebCore/generated/JSAttr.h | 5 +- .../webkit/WebCore/generated/JSBarInfo.cpp | 3 +- src/3rdparty/webkit/WebCore/generated/JSBarInfo.h | 5 +- .../webkit/WebCore/generated/JSBeforeLoadEvent.cpp | 5 +- .../webkit/WebCore/generated/JSBeforeLoadEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSBlob.cpp | 174 - src/3rdparty/webkit/WebCore/generated/JSBlob.h | 82 - .../webkit/WebCore/generated/JSCDATASection.cpp | 2 +- .../webkit/WebCore/generated/JSCDATASection.h | 4 +- .../webkit/WebCore/generated/JSCSSCharsetRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSCharsetRule.h | 4 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.h | 4 +- .../webkit/WebCore/generated/JSCSSImportRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSImportRule.h | 4 +- .../webkit/WebCore/generated/JSCSSMediaRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSMediaRule.h | 4 +- .../webkit/WebCore/generated/JSCSSPageRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSPageRule.h | 4 +- .../WebCore/generated/JSCSSPrimitiveValue.cpp | 5 +- .../webkit/WebCore/generated/JSCSSPrimitiveValue.h | 4 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 17 +- src/3rdparty/webkit/WebCore/generated/JSCSSRule.h | 5 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 9 +- .../webkit/WebCore/generated/JSCSSRuleList.h | 7 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 23 +- .../WebCore/generated/JSCSSStyleDeclaration.h | 7 +- .../webkit/WebCore/generated/JSCSSStyleRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSStyleRule.h | 4 +- .../webkit/WebCore/generated/JSCSSStyleSheet.cpp | 11 +- .../webkit/WebCore/generated/JSCSSStyleSheet.h | 4 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSCSSValue.h | 5 +- .../webkit/WebCore/generated/JSCSSValueList.cpp | 9 +- .../webkit/WebCore/generated/JSCSSValueList.h | 6 +- .../generated/JSCSSVariablesDeclaration.cpp | 20 +- .../WebCore/generated/JSCSSVariablesDeclaration.h | 7 +- .../WebCore/generated/JSCSSVariablesRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSVariablesRule.h | 4 +- .../webkit/WebCore/generated/JSCanvasArray.cpp | 155 + .../webkit/WebCore/generated/JSCanvasArray.h | 91 + .../WebCore/generated/JSCanvasArrayBuffer.cpp | 120 + .../webkit/WebCore/generated/JSCanvasArrayBuffer.h | 85 + .../webkit/WebCore/generated/JSCanvasByteArray.cpp | 137 + .../webkit/WebCore/generated/JSCanvasByteArray.h | 85 + .../WebCore/generated/JSCanvasFloatArray.cpp | 137 + .../webkit/WebCore/generated/JSCanvasFloatArray.h | 85 + .../webkit/WebCore/generated/JSCanvasGradient.h | 5 +- .../webkit/WebCore/generated/JSCanvasIntArray.cpp | 137 + .../webkit/WebCore/generated/JSCanvasIntArray.h | 85 + .../webkit/WebCore/generated/JSCanvasPattern.h | 5 +- .../WebCore/generated/JSCanvasRenderingContext.cpp | 5 +- .../WebCore/generated/JSCanvasRenderingContext.h | 5 +- .../generated/JSCanvasRenderingContext2D.cpp | 80 +- .../WebCore/generated/JSCanvasRenderingContext2D.h | 4 +- .../generated/JSCanvasRenderingContext3D.cpp | 4528 + .../WebCore/generated/JSCanvasRenderingContext3D.h | 555 + .../WebCore/generated/JSCanvasShortArray.cpp | 137 + .../webkit/WebCore/generated/JSCanvasShortArray.h | 85 + .../generated/JSCanvasUnsignedByteArray.cpp | 137 + .../WebCore/generated/JSCanvasUnsignedByteArray.h | 85 + .../WebCore/generated/JSCanvasUnsignedIntArray.cpp | 137 + .../WebCore/generated/JSCanvasUnsignedIntArray.h | 85 + .../generated/JSCanvasUnsignedShortArray.cpp | 137 + .../WebCore/generated/JSCanvasUnsignedShortArray.h | 85 + .../webkit/WebCore/generated/JSCharacterData.cpp | 11 +- .../webkit/WebCore/generated/JSCharacterData.h | 4 +- .../webkit/WebCore/generated/JSClientRect.cpp | 20 +- .../webkit/WebCore/generated/JSClientRect.h | 5 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 9 +- .../webkit/WebCore/generated/JSClientRectList.h | 7 +- .../webkit/WebCore/generated/JSClipboard.cpp | 17 +- .../webkit/WebCore/generated/JSClipboard.h | 5 +- .../webkit/WebCore/generated/JSComment.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSComment.h | 4 +- .../WebCore/generated/JSCompositionEvent.cpp | 191 - .../webkit/WebCore/generated/JSCompositionEvent.h | 78 - .../webkit/WebCore/generated/JSConsole.cpp | 18 +- src/3rdparty/webkit/WebCore/generated/JSConsole.h | 6 +- .../webkit/WebCore/generated/JSCoordinates.cpp | 9 +- .../webkit/WebCore/generated/JSCoordinates.h | 5 +- .../webkit/WebCore/generated/JSCounter.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSCounter.h | 5 +- .../WebCore/generated/JSDOMApplicationCache.cpp | 97 +- .../WebCore/generated/JSDOMApplicationCache.h | 5 +- .../WebCore/generated/JSDOMCoreException.cpp | 11 +- .../webkit/WebCore/generated/JSDOMCoreException.h | 5 +- .../WebCore/generated/JSDOMImplementation.cpp | 2 +- .../webkit/WebCore/generated/JSDOMImplementation.h | 5 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 2 +- .../webkit/WebCore/generated/JSDOMParser.h | 5 +- .../webkit/WebCore/generated/JSDOMSelection.cpp | 33 +- .../webkit/WebCore/generated/JSDOMSelection.h | 5 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 4285 +- .../webkit/WebCore/generated/JSDOMWindow.h | 286 +- .../webkit/WebCore/generated/JSDOMWindowBase.lut.h | 0 .../webkit/WebCore/generated/JSDataGridColumn.cpp | 38 +- .../webkit/WebCore/generated/JSDataGridColumn.h | 5 +- .../WebCore/generated/JSDataGridColumnList.cpp | 15 +- .../WebCore/generated/JSDataGridColumnList.h | 7 +- .../webkit/WebCore/generated/JSDatabase.cpp | 3 +- src/3rdparty/webkit/WebCore/generated/JSDatabase.h | 5 +- .../WebCore/generated/JSDedicatedWorkerContext.cpp | 9 +- .../WebCore/generated/JSDedicatedWorkerContext.h | 4 +- .../webkit/WebCore/generated/JSDocument.cpp | 653 +- src/3rdparty/webkit/WebCore/generated/JSDocument.h | 13 +- .../WebCore/generated/JSDocumentFragment.cpp | 2 +- .../webkit/WebCore/generated/JSDocumentFragment.h | 4 +- .../webkit/WebCore/generated/JSDocumentType.cpp | 20 +- .../webkit/WebCore/generated/JSDocumentType.h | 4 +- .../webkit/WebCore/generated/JSElement.cpp | 591 +- src/3rdparty/webkit/WebCore/generated/JSElement.h | 12 +- src/3rdparty/webkit/WebCore/generated/JSEntity.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSEntity.h | 4 +- .../webkit/WebCore/generated/JSEntityReference.cpp | 2 +- .../webkit/WebCore/generated/JSEntityReference.h | 4 +- .../webkit/WebCore/generated/JSErrorEvent.cpp | 11 +- .../webkit/WebCore/generated/JSErrorEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 38 +- src/3rdparty/webkit/WebCore/generated/JSEvent.h | 5 +- .../webkit/WebCore/generated/JSEventException.cpp | 11 +- .../webkit/WebCore/generated/JSEventException.h | 5 +- .../webkit/WebCore/generated/JSEventSource.cpp | 45 +- .../webkit/WebCore/generated/JSEventSource.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 36 +- src/3rdparty/webkit/WebCore/generated/JSFile.h | 24 +- .../webkit/WebCore/generated/JSFileList.cpp | 9 +- src/3rdparty/webkit/WebCore/generated/JSFileList.h | 7 +- .../webkit/WebCore/generated/JSGeolocation.cpp | 3 +- .../webkit/WebCore/generated/JSGeolocation.h | 5 +- .../webkit/WebCore/generated/JSGeoposition.cpp | 6 +- .../webkit/WebCore/generated/JSGeoposition.h | 5 +- .../WebCore/generated/JSHTMLAllCollection.cpp | 9 +- .../webkit/WebCore/generated/JSHTMLAllCollection.h | 7 +- .../WebCore/generated/JSHTMLAnchorElement.cpp | 155 +- .../webkit/WebCore/generated/JSHTMLAnchorElement.h | 11 +- .../WebCore/generated/JSHTMLAppletElement.cpp | 68 +- .../webkit/WebCore/generated/JSHTMLAppletElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLAreaElement.cpp | 65 +- .../webkit/WebCore/generated/JSHTMLAreaElement.h | 4 +- .../WebCore/generated/JSHTMLAudioElement.cpp | 2 +- .../webkit/WebCore/generated/JSHTMLAudioElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBRElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLBRElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBaseElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLBaseElement.h | 4 +- .../WebCore/generated/JSHTMLBaseFontElement.cpp | 20 +- .../WebCore/generated/JSHTMLBaseFontElement.h | 4 +- .../WebCore/generated/JSHTMLBlockquoteElement.cpp | 8 +- .../WebCore/generated/JSHTMLBlockquoteElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 152 +- .../webkit/WebCore/generated/JSHTMLBodyElement.h | 6 +- .../WebCore/generated/JSHTMLButtonElement.cpp | 62 +- .../webkit/WebCore/generated/JSHTMLButtonElement.h | 5 +- .../WebCore/generated/JSHTMLCanvasElement.cpp | 22 +- .../webkit/WebCore/generated/JSHTMLCanvasElement.h | 7 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 9 +- .../webkit/WebCore/generated/JSHTMLCollection.h | 7 +- .../WebCore/generated/JSHTMLDListElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLDListElement.h | 4 +- .../generated/JSHTMLDataGridCellElement.cpp | 32 +- .../WebCore/generated/JSHTMLDataGridCellElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridColElement.cpp | 32 +- .../WebCore/generated/JSHTMLDataGridColElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridElement.cpp | 23 +- .../WebCore/generated/JSHTMLDataGridElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridRowElement.cpp | 20 +- .../WebCore/generated/JSHTMLDataGridRowElement.h | 4 +- .../WebCore/generated/JSHTMLDataListElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataListElement.h | 4 +- .../WebCore/generated/JSHTMLDirectoryElement.cpp | 8 +- .../WebCore/generated/JSHTMLDirectoryElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLDivElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLDivElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLDocument.cpp | 65 +- .../webkit/WebCore/generated/JSHTMLDocument.h | 4 +- .../webkit/WebCore/generated/JSHTMLElement.cpp | 80 +- .../webkit/WebCore/generated/JSHTMLElement.h | 4 +- .../generated/JSHTMLElementWrapperFactory.cpp | 2 +- .../WebCore/generated/JSHTMLEmbedElement.cpp | 38 +- .../webkit/WebCore/generated/JSHTMLEmbedElement.h | 4 +- .../WebCore/generated/JSHTMLFieldSetElement.cpp | 27 +- .../WebCore/generated/JSHTMLFieldSetElement.h | 5 +- .../webkit/WebCore/generated/JSHTMLFontElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLFontElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLFormElement.cpp | 60 +- .../webkit/WebCore/generated/JSHTMLFormElement.h | 6 +- .../WebCore/generated/JSHTMLFrameElement.cpp | 59 +- .../webkit/WebCore/generated/JSHTMLFrameElement.h | 4 +- .../WebCore/generated/JSHTMLFrameSetElement.cpp | 128 +- .../WebCore/generated/JSHTMLFrameSetElement.h | 6 +- .../webkit/WebCore/generated/JSHTMLHRElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLHRElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLHeadElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLHeadElement.h | 4 +- .../WebCore/generated/JSHTMLHeadingElement.cpp | 8 +- .../WebCore/generated/JSHTMLHeadingElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.h | 4 +- .../WebCore/generated/JSHTMLIFrameElement.cpp | 81 +- .../webkit/WebCore/generated/JSHTMLIFrameElement.h | 6 +- .../WebCore/generated/JSHTMLImageElement.cpp | 95 +- .../webkit/WebCore/generated/JSHTMLImageElement.h | 4 +- .../WebCore/generated/JSHTMLInputElement.cpp | 290 +- .../webkit/WebCore/generated/JSHTMLInputElement.h | 13 +- .../WebCore/generated/JSHTMLIsIndexElement.cpp | 11 +- .../WebCore/generated/JSHTMLIsIndexElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLLIElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLLIElement.h | 4 +- .../WebCore/generated/JSHTMLLabelElement.cpp | 17 +- .../webkit/WebCore/generated/JSHTMLLabelElement.h | 4 +- .../WebCore/generated/JSHTMLLegendElement.cpp | 17 +- .../webkit/WebCore/generated/JSHTMLLegendElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLLinkElement.cpp | 59 +- .../webkit/WebCore/generated/JSHTMLLinkElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLMapElement.cpp | 11 +- .../webkit/WebCore/generated/JSHTMLMapElement.h | 4 +- .../WebCore/generated/JSHTMLMarqueeElement.cpp | 2 +- .../WebCore/generated/JSHTMLMarqueeElement.h | 4 +- .../WebCore/generated/JSHTMLMediaElement.cpp | 141 +- .../webkit/WebCore/generated/JSHTMLMediaElement.h | 7 +- .../webkit/WebCore/generated/JSHTMLMenuElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLMenuElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLMetaElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLMetaElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLModElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLModElement.h | 4 +- .../WebCore/generated/JSHTMLOListElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLOListElement.h | 4 +- .../WebCore/generated/JSHTMLObjectElement.cpp | 104 +- .../webkit/WebCore/generated/JSHTMLObjectElement.h | 4 +- .../WebCore/generated/JSHTMLOptGroupElement.cpp | 14 +- .../WebCore/generated/JSHTMLOptGroupElement.h | 4 +- .../WebCore/generated/JSHTMLOptionElement.cpp | 44 +- .../webkit/WebCore/generated/JSHTMLOptionElement.h | 4 +- .../WebCore/generated/JSHTMLOptionsCollection.cpp | 70 +- .../WebCore/generated/JSHTMLOptionsCollection.h | 6 +- .../WebCore/generated/JSHTMLParagraphElement.cpp | 8 +- .../WebCore/generated/JSHTMLParagraphElement.h | 4 +- .../WebCore/generated/JSHTMLParamElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLParamElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLPreElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLPreElement.h | 4 +- .../WebCore/generated/JSHTMLQuoteElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLQuoteElement.h | 4 +- .../WebCore/generated/JSHTMLScriptElement.cpp | 44 +- .../webkit/WebCore/generated/JSHTMLScriptElement.h | 4 +- .../WebCore/generated/JSHTMLSelectElement.cpp | 81 +- .../webkit/WebCore/generated/JSHTMLSelectElement.h | 7 +- .../WebCore/generated/JSHTMLSourceElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLSourceElement.h | 4 +- .../WebCore/generated/JSHTMLStyleElement.cpp | 23 +- .../webkit/WebCore/generated/JSHTMLStyleElement.h | 4 +- .../generated/JSHTMLTableCaptionElement.cpp | 8 +- .../WebCore/generated/JSHTMLTableCaptionElement.h | 4 +- .../WebCore/generated/JSHTMLTableCellElement.cpp | 89 +- .../WebCore/generated/JSHTMLTableCellElement.h | 4 +- .../WebCore/generated/JSHTMLTableColElement.cpp | 38 +- .../WebCore/generated/JSHTMLTableColElement.h | 4 +- .../WebCore/generated/JSHTMLTableElement.cpp | 80 +- .../webkit/WebCore/generated/JSHTMLTableElement.h | 4 +- .../WebCore/generated/JSHTMLTableRowElement.cpp | 41 +- .../WebCore/generated/JSHTMLTableRowElement.h | 4 +- .../generated/JSHTMLTableSectionElement.cpp | 29 +- .../WebCore/generated/JSHTMLTableSectionElement.h | 4 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 117 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 5 +- .../WebCore/generated/JSHTMLTitleElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLTitleElement.h | 4 +- .../WebCore/generated/JSHTMLUListElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLUListElement.h | 4 +- .../WebCore/generated/JSHTMLVideoElement.cpp | 95 +- .../webkit/WebCore/generated/JSHTMLVideoElement.h | 14 +- .../webkit/WebCore/generated/JSHistory.cpp | 27 +- src/3rdparty/webkit/WebCore/generated/JSHistory.h | 13 +- .../webkit/WebCore/generated/JSImageData.cpp | 8 +- .../webkit/WebCore/generated/JSImageData.h | 5 +- .../WebCore/generated/JSInjectedScriptHost.cpp | 316 - .../WebCore/generated/JSInjectedScriptHost.h | 111 - .../WebCore/generated/JSInspectorBackend.cpp | 528 +- .../webkit/WebCore/generated/JSInspectorBackend.h | 77 +- .../WebCore/generated/JSInspectorFrontendHost.cpp | 355 - .../WebCore/generated/JSInspectorFrontendHost.h | 105 - .../WebCore/generated/JSJavaScriptCallFrame.cpp | 12 +- .../WebCore/generated/JSJavaScriptCallFrame.h | 5 +- .../webkit/WebCore/generated/JSKeyboardEvent.cpp | 23 +- .../webkit/WebCore/generated/JSKeyboardEvent.h | 4 +- .../webkit/WebCore/generated/JSLocation.cpp | 24 +- src/3rdparty/webkit/WebCore/generated/JSLocation.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSMedia.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSMedia.h | 5 +- .../webkit/WebCore/generated/JSMediaError.cpp | 5 +- .../webkit/WebCore/generated/JSMediaError.h | 5 +- .../webkit/WebCore/generated/JSMediaList.cpp | 17 +- .../webkit/WebCore/generated/JSMediaList.h | 7 +- .../webkit/WebCore/generated/JSMessageChannel.cpp | 6 +- .../webkit/WebCore/generated/JSMessageChannel.h | 5 +- .../webkit/WebCore/generated/JSMessageEvent.cpp | 19 +- .../webkit/WebCore/generated/JSMessageEvent.h | 9 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 17 +- .../webkit/WebCore/generated/JSMessagePort.h | 5 +- .../webkit/WebCore/generated/JSMimeType.cpp | 14 +- src/3rdparty/webkit/WebCore/generated/JSMimeType.h | 5 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 9 +- .../webkit/WebCore/generated/JSMimeTypeArray.h | 7 +- .../webkit/WebCore/generated/JSMouseEvent.cpp | 53 +- .../webkit/WebCore/generated/JSMouseEvent.h | 4 +- .../webkit/WebCore/generated/JSMutationEvent.cpp | 17 +- .../webkit/WebCore/generated/JSMutationEvent.h | 4 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 9 +- .../webkit/WebCore/generated/JSNamedNodeMap.h | 7 +- .../webkit/WebCore/generated/JSNavigator.cpp | 84 +- .../webkit/WebCore/generated/JSNavigator.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 64 +- src/3rdparty/webkit/WebCore/generated/JSNode.h | 5 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 2 +- .../webkit/WebCore/generated/JSNodeFilter.h | 5 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 20 +- .../webkit/WebCore/generated/JSNodeIterator.h | 5 +- .../webkit/WebCore/generated/JSNodeList.cpp | 9 +- src/3rdparty/webkit/WebCore/generated/JSNodeList.h | 7 +- .../webkit/WebCore/generated/JSNotation.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSNotation.h | 4 +- .../webkit/WebCore/generated/JSONObject.lut.h | 15 + .../webkit/WebCore/generated/JSOverflowEvent.cpp | 11 +- .../webkit/WebCore/generated/JSOverflowEvent.h | 4 +- .../WebCore/generated/JSPageTransitionEvent.cpp | 5 +- .../WebCore/generated/JSPageTransitionEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 18 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.h | 7 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 9 +- .../webkit/WebCore/generated/JSPluginArray.h | 7 +- .../webkit/WebCore/generated/JSPopStateEvent.cpp | 181 - .../webkit/WebCore/generated/JSPopStateEvent.h | 81 - .../webkit/WebCore/generated/JSPositionError.cpp | 23 +- .../webkit/WebCore/generated/JSPositionError.h | 6 +- .../WebCore/generated/JSProcessingInstruction.cpp | 14 +- .../WebCore/generated/JSProcessingInstruction.h | 4 +- .../webkit/WebCore/generated/JSProgressEvent.cpp | 11 +- .../webkit/WebCore/generated/JSProgressEvent.h | 4 +- .../webkit/WebCore/generated/JSRGBColor.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSRGBColor.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSRange.h | 5 +- .../webkit/WebCore/generated/JSRangeException.cpp | 11 +- .../webkit/WebCore/generated/JSRangeException.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 14 +- src/3rdparty/webkit/WebCore/generated/JSRect.h | 5 +- .../webkit/WebCore/generated/JSSQLError.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSSQLError.h | 5 +- .../webkit/WebCore/generated/JSSQLResultSet.cpp | 6 +- .../webkit/WebCore/generated/JSSQLResultSet.h | 5 +- .../WebCore/generated/JSSQLResultSetRowList.cpp | 3 +- .../WebCore/generated/JSSQLResultSetRowList.h | 5 +- .../webkit/WebCore/generated/JSSQLTransaction.h | 5 +- .../webkit/WebCore/generated/JSSVGAElement.cpp | 115 +- .../webkit/WebCore/generated/JSSVGAElement.h | 6 +- .../WebCore/generated/JSSVGAltGlyphElement.cpp | 77 +- .../WebCore/generated/JSSVGAltGlyphElement.h | 6 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 78 +- src/3rdparty/webkit/WebCore/generated/JSSVGAngle.h | 23 +- .../WebCore/generated/JSSVGAnimateColorElement.cpp | 84 +- .../WebCore/generated/JSSVGAnimateColorElement.h | 12 +- .../WebCore/generated/JSSVGAnimateElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGAnimateElement.h | 12 +- .../generated/JSSVGAnimateTransformElement.cpp | 84 +- .../generated/JSSVGAnimateTransformElement.h | 12 +- .../WebCore/generated/JSSVGAnimatedAngle.cpp | 76 +- .../webkit/WebCore/generated/JSSVGAnimatedAngle.h | 13 +- .../WebCore/generated/JSSVGAnimatedBoolean.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedBoolean.h | 13 +- .../WebCore/generated/JSSVGAnimatedEnumeration.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedEnumeration.h | 13 +- .../WebCore/generated/JSSVGAnimatedInteger.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedInteger.h | 13 +- .../WebCore/generated/JSSVGAnimatedLength.cpp | 75 +- .../webkit/WebCore/generated/JSSVGAnimatedLength.h | 13 +- .../WebCore/generated/JSSVGAnimatedLengthList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedLengthList.h | 13 +- .../WebCore/generated/JSSVGAnimatedNumber.cpp | 81 +- .../webkit/WebCore/generated/JSSVGAnimatedNumber.h | 13 +- .../WebCore/generated/JSSVGAnimatedNumberList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedNumberList.h | 13 +- .../generated/JSSVGAnimatedPreserveAspectRatio.cpp | 76 +- .../generated/JSSVGAnimatedPreserveAspectRatio.h | 13 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.cpp | 75 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.h | 13 +- .../WebCore/generated/JSSVGAnimatedString.cpp | 81 +- .../webkit/WebCore/generated/JSSVGAnimatedString.h | 13 +- .../generated/JSSVGAnimatedTransformList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedTransformList.h | 13 +- .../WebCore/generated/JSSVGAnimationElement.cpp | 15 +- .../WebCore/generated/JSSVGAnimationElement.h | 4 +- .../WebCore/generated/JSSVGCircleElement.cpp | 118 +- .../webkit/WebCore/generated/JSSVGCircleElement.h | 6 +- .../WebCore/generated/JSSVGClipPathElement.cpp | 112 +- .../WebCore/generated/JSSVGClipPathElement.h | 6 +- .../webkit/WebCore/generated/JSSVGColor.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSSVGColor.h | 4 +- .../JSSVGComponentTransferFunctionElement.cpp | 23 +- .../JSSVGComponentTransferFunctionElement.h | 4 +- .../WebCore/generated/JSSVGCursorElement.cpp | 85 +- .../webkit/WebCore/generated/JSSVGCursorElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDefsElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGDefsElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDescElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGDescElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDocument.cpp | 67 +- .../webkit/WebCore/generated/JSSVGDocument.h | 6 +- .../webkit/WebCore/generated/JSSVGElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGElement.h | 6 +- .../WebCore/generated/JSSVGElementInstance.cpp | 526 +- .../WebCore/generated/JSSVGElementInstance.h | 7 +- .../WebCore/generated/JSSVGElementInstanceList.cpp | 67 +- .../WebCore/generated/JSSVGElementInstanceList.h | 7 +- .../generated/JSSVGElementWrapperFactory.cpp | 194 +- .../WebCore/generated/JSSVGEllipseElement.cpp | 121 +- .../webkit/WebCore/generated/JSSVGEllipseElement.h | 6 +- .../webkit/WebCore/generated/JSSVGException.cpp | 20 +- .../webkit/WebCore/generated/JSSVGException.h | 11 +- .../WebCore/generated/JSSVGFEBlendElement.cpp | 32 +- .../webkit/WebCore/generated/JSSVGFEBlendElement.h | 4 +- .../generated/JSSVGFEColorMatrixElement.cpp | 32 +- .../WebCore/generated/JSSVGFEColorMatrixElement.h | 4 +- .../generated/JSSVGFEComponentTransferElement.cpp | 86 +- .../generated/JSSVGFEComponentTransferElement.h | 6 +- .../WebCore/generated/JSSVGFECompositeElement.cpp | 44 +- .../WebCore/generated/JSSVGFECompositeElement.h | 4 +- .../generated/JSSVGFEDiffuseLightingElement.cpp | 98 +- .../generated/JSSVGFEDiffuseLightingElement.h | 6 +- .../generated/JSSVGFEDisplacementMapElement.cpp | 38 +- .../generated/JSSVGFEDisplacementMapElement.h | 4 +- .../generated/JSSVGFEDistantLightElement.cpp | 68 +- .../WebCore/generated/JSSVGFEDistantLightElement.h | 6 +- .../WebCore/generated/JSSVGFEFloodElement.cpp | 23 +- .../webkit/WebCore/generated/JSSVGFEFloodElement.h | 4 +- .../WebCore/generated/JSSVGFEFuncAElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncAElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncBElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncBElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncGElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncGElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncRElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncRElement.h | 12 +- .../generated/JSSVGFEGaussianBlurElement.cpp | 90 +- .../WebCore/generated/JSSVGFEGaussianBlurElement.h | 6 +- .../WebCore/generated/JSSVGFEImageElement.cpp | 111 +- .../webkit/WebCore/generated/JSSVGFEImageElement.h | 7 +- .../WebCore/generated/JSSVGFEMergeElement.cpp | 83 +- .../webkit/WebCore/generated/JSSVGFEMergeElement.h | 6 +- .../WebCore/generated/JSSVGFEMergeNodeElement.cpp | 67 +- .../WebCore/generated/JSSVGFEMergeNodeElement.h | 6 +- .../WebCore/generated/JSSVGFEMorphologyElement.cpp | 35 +- .../WebCore/generated/JSSVGFEMorphologyElement.h | 4 +- .../WebCore/generated/JSSVGFEOffsetElement.cpp | 90 +- .../WebCore/generated/JSSVGFEOffsetElement.h | 6 +- .../WebCore/generated/JSSVGFEPointLightElement.cpp | 73 +- .../WebCore/generated/JSSVGFEPointLightElement.h | 6 +- .../generated/JSSVGFESpecularLightingElement.cpp | 93 +- .../generated/JSSVGFESpecularLightingElement.h | 6 +- .../WebCore/generated/JSSVGFESpotLightElement.cpp | 86 +- .../WebCore/generated/JSSVGFESpotLightElement.h | 6 +- .../WebCore/generated/JSSVGFETileElement.cpp | 86 +- .../webkit/WebCore/generated/JSSVGFETileElement.h | 6 +- .../WebCore/generated/JSSVGFETurbulenceElement.cpp | 41 +- .../WebCore/generated/JSSVGFETurbulenceElement.h | 4 +- .../WebCore/generated/JSSVGFilterElement.cpp | 108 +- .../webkit/WebCore/generated/JSSVGFilterElement.h | 6 +- .../webkit/WebCore/generated/JSSVGFontElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFontElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceElement.h | 12 +- .../generated/JSSVGFontFaceFormatElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceFormatElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceNameElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceNameElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceSrcElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceSrcElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceUriElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceUriElement.h | 12 +- .../generated/JSSVGForeignObjectElement.cpp | 121 +- .../WebCore/generated/JSSVGForeignObjectElement.h | 6 +- .../webkit/WebCore/generated/JSSVGGElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGGElement.h | 6 +- .../webkit/WebCore/generated/JSSVGGlyphElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGGlyphElement.h | 12 +- .../WebCore/generated/JSSVGGradientElement.cpp | 23 +- .../WebCore/generated/JSSVGGradientElement.h | 4 +- .../webkit/WebCore/generated/JSSVGHKernElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGHKernElement.h | 12 +- .../webkit/WebCore/generated/JSSVGImageElement.cpp | 125 +- .../webkit/WebCore/generated/JSSVGImageElement.h | 6 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 53 +- .../webkit/WebCore/generated/JSSVGLength.h | 13 +- .../webkit/WebCore/generated/JSSVGLengthList.cpp | 136 +- .../webkit/WebCore/generated/JSSVGLengthList.h | 13 +- .../webkit/WebCore/generated/JSSVGLineElement.cpp | 121 +- .../webkit/WebCore/generated/JSSVGLineElement.h | 6 +- .../generated/JSSVGLinearGradientElement.cpp | 74 +- .../WebCore/generated/JSSVGLinearGradientElement.h | 6 +- .../WebCore/generated/JSSVGMarkerElement.cpp | 52 +- .../webkit/WebCore/generated/JSSVGMarkerElement.h | 4 +- .../webkit/WebCore/generated/JSSVGMaskElement.cpp | 110 +- .../webkit/WebCore/generated/JSSVGMaskElement.h | 6 +- .../webkit/WebCore/generated/JSSVGMatrix.cpp | 211 +- .../webkit/WebCore/generated/JSSVGMatrix.h | 24 +- .../WebCore/generated/JSSVGMetadataElement.cpp | 84 +- .../WebCore/generated/JSSVGMetadataElement.h | 12 +- .../WebCore/generated/JSSVGMissingGlyphElement.cpp | 84 +- .../WebCore/generated/JSSVGMissingGlyphElement.h | 12 +- .../webkit/WebCore/generated/JSSVGNumber.cpp | 80 +- .../webkit/WebCore/generated/JSSVGNumber.h | 15 +- .../webkit/WebCore/generated/JSSVGNumberList.cpp | 136 +- .../webkit/WebCore/generated/JSSVGNumberList.h | 13 +- .../webkit/WebCore/generated/JSSVGPaint.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSSVGPaint.h | 4 +- .../webkit/WebCore/generated/JSSVGPathElement.cpp | 130 +- .../webkit/WebCore/generated/JSSVGPathElement.h | 6 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 17 +- .../webkit/WebCore/generated/JSSVGPathSeg.h | 11 +- .../WebCore/generated/JSSVGPathSegArcAbs.cpp | 131 +- .../webkit/WebCore/generated/JSSVGPathSegArcAbs.h | 8 +- .../WebCore/generated/JSSVGPathSegArcRel.cpp | 131 +- .../webkit/WebCore/generated/JSSVGPathSegArcRel.h | 8 +- .../WebCore/generated/JSSVGPathSegClosePath.cpp | 88 +- .../WebCore/generated/JSSVGPathSegClosePath.h | 14 +- .../generated/JSSVGPathSegCurvetoCubicAbs.cpp | 120 +- .../generated/JSSVGPathSegCurvetoCubicAbs.h | 8 +- .../generated/JSSVGPathSegCurvetoCubicRel.cpp | 120 +- .../generated/JSSVGPathSegCurvetoCubicRel.h | 8 +- .../JSSVGPathSegCurvetoCubicSmoothAbs.cpp | 104 +- .../generated/JSSVGPathSegCurvetoCubicSmoothAbs.h | 8 +- .../JSSVGPathSegCurvetoCubicSmoothRel.cpp | 104 +- .../generated/JSSVGPathSegCurvetoCubicSmoothRel.h | 8 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.cpp | 104 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.h | 8 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.cpp | 104 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.h | 8 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp | 86 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.h | 8 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.cpp | 86 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.h | 8 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.cpp | 86 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.h | 8 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.cpp | 77 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.h | 8 +- .../generated/JSSVGPathSegLinetoHorizontalRel.cpp | 77 +- .../generated/JSSVGPathSegLinetoHorizontalRel.h | 8 +- .../WebCore/generated/JSSVGPathSegLinetoRel.cpp | 86 +- .../WebCore/generated/JSSVGPathSegLinetoRel.h | 8 +- .../generated/JSSVGPathSegLinetoVerticalAbs.cpp | 77 +- .../generated/JSSVGPathSegLinetoVerticalAbs.h | 8 +- .../generated/JSSVGPathSegLinetoVerticalRel.cpp | 77 +- .../generated/JSSVGPathSegLinetoVerticalRel.h | 8 +- .../webkit/WebCore/generated/JSSVGPathSegList.cpp | 72 +- .../webkit/WebCore/generated/JSSVGPathSegList.h | 13 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.cpp | 86 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.h | 8 +- .../WebCore/generated/JSSVGPathSegMovetoRel.cpp | 86 +- .../WebCore/generated/JSSVGPathSegMovetoRel.h | 8 +- .../WebCore/generated/JSSVGPatternElement.cpp | 120 +- .../webkit/WebCore/generated/JSSVGPatternElement.h | 6 +- .../webkit/WebCore/generated/JSSVGPoint.cpp | 101 +- src/3rdparty/webkit/WebCore/generated/JSSVGPoint.h | 15 +- .../webkit/WebCore/generated/JSSVGPointList.cpp | 88 +- .../webkit/WebCore/generated/JSSVGPointList.h | 22 +- .../WebCore/generated/JSSVGPolygonElement.cpp | 115 +- .../webkit/WebCore/generated/JSSVGPolygonElement.h | 6 +- .../WebCore/generated/JSSVGPolylineElement.cpp | 115 +- .../WebCore/generated/JSSVGPolylineElement.h | 6 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 47 +- .../WebCore/generated/JSSVGPreserveAspectRatio.h | 23 +- .../generated/JSSVGRadialGradientElement.cpp | 75 +- .../WebCore/generated/JSSVGRadialGradientElement.h | 6 +- .../webkit/WebCore/generated/JSSVGRect.cpp | 114 +- src/3rdparty/webkit/WebCore/generated/JSSVGRect.h | 15 +- .../webkit/WebCore/generated/JSSVGRectElement.cpp | 125 +- .../webkit/WebCore/generated/JSSVGRectElement.h | 6 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 11 +- .../WebCore/generated/JSSVGRenderingIntent.h | 11 +- .../webkit/WebCore/generated/JSSVGSVGElement.cpp | 191 +- .../webkit/WebCore/generated/JSSVGSVGElement.h | 6 +- .../WebCore/generated/JSSVGScriptElement.cpp | 76 +- .../webkit/WebCore/generated/JSSVGScriptElement.h | 6 +- .../webkit/WebCore/generated/JSSVGSetElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGSetElement.h | 12 +- .../webkit/WebCore/generated/JSSVGStopElement.cpp | 69 +- .../webkit/WebCore/generated/JSSVGStopElement.h | 6 +- .../webkit/WebCore/generated/JSSVGStringList.cpp | 72 +- .../webkit/WebCore/generated/JSSVGStringList.h | 13 +- .../webkit/WebCore/generated/JSSVGStyleElement.cpp | 90 +- .../webkit/WebCore/generated/JSSVGStyleElement.h | 6 +- .../WebCore/generated/JSSVGSwitchElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGSwitchElement.h | 6 +- .../WebCore/generated/JSSVGSymbolElement.cpp | 87 +- .../webkit/WebCore/generated/JSSVGSymbolElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTRefElement.cpp | 67 +- .../webkit/WebCore/generated/JSSVGTRefElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTSpanElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGTSpanElement.h | 12 +- .../WebCore/generated/JSSVGTextContentElement.cpp | 44 +- .../WebCore/generated/JSSVGTextContentElement.h | 4 +- .../webkit/WebCore/generated/JSSVGTextElement.cpp | 81 +- .../webkit/WebCore/generated/JSSVGTextElement.h | 6 +- .../WebCore/generated/JSSVGTextPathElement.cpp | 14 +- .../WebCore/generated/JSSVGTextPathElement.h | 4 +- .../generated/JSSVGTextPositioningElement.cpp | 79 +- .../generated/JSSVGTextPositioningElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTitleElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGTitleElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 70 +- .../webkit/WebCore/generated/JSSVGTransform.h | 13 +- .../WebCore/generated/JSSVGTransformList.cpp | 93 +- .../webkit/WebCore/generated/JSSVGTransformList.h | 22 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 11 +- .../webkit/WebCore/generated/JSSVGUnitTypes.h | 11 +- .../webkit/WebCore/generated/JSSVGUseElement.cpp | 128 +- .../webkit/WebCore/generated/JSSVGUseElement.h | 6 +- .../webkit/WebCore/generated/JSSVGViewElement.cpp | 81 +- .../webkit/WebCore/generated/JSSVGViewElement.h | 6 +- .../webkit/WebCore/generated/JSSVGZoomEvent.cpp | 75 +- .../webkit/WebCore/generated/JSSVGZoomEvent.h | 6 +- src/3rdparty/webkit/WebCore/generated/JSScreen.cpp | 24 +- src/3rdparty/webkit/WebCore/generated/JSScreen.h | 5 +- .../webkit/WebCore/generated/JSSharedWorker.cpp | 3 +- .../webkit/WebCore/generated/JSSharedWorker.h | 4 +- .../WebCore/generated/JSSharedWorkerContext.cpp | 12 +- .../WebCore/generated/JSSharedWorkerContext.h | 4 +- .../webkit/WebCore/generated/JSStorage.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSStorage.h | 7 +- .../webkit/WebCore/generated/JSStorageEvent.cpp | 17 +- .../webkit/WebCore/generated/JSStorageEvent.h | 4 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 26 +- .../webkit/WebCore/generated/JSStyleSheet.h | 5 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 9 +- .../webkit/WebCore/generated/JSStyleSheetList.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSText.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSText.h | 4 +- .../webkit/WebCore/generated/JSTextEvent.cpp | 5 +- .../webkit/WebCore/generated/JSTextEvent.h | 4 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 5 +- .../webkit/WebCore/generated/JSTextMetrics.h | 5 +- .../webkit/WebCore/generated/JSTimeRanges.cpp | 3 +- .../webkit/WebCore/generated/JSTimeRanges.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSTouch.cpp | 251 - src/3rdparty/webkit/WebCore/generated/JSTouch.h | 93 - .../webkit/WebCore/generated/JSTouchEvent.cpp | 264 - .../webkit/WebCore/generated/JSTouchEvent.h | 88 - .../webkit/WebCore/generated/JSTouchList.cpp | 256 - .../webkit/WebCore/generated/JSTouchList.h | 94 - .../webkit/WebCore/generated/JSTreeWalker.cpp | 20 +- .../webkit/WebCore/generated/JSTreeWalker.h | 5 +- .../webkit/WebCore/generated/JSUIEvent.cpp | 29 +- src/3rdparty/webkit/WebCore/generated/JSUIEvent.h | 4 +- .../webkit/WebCore/generated/JSValidityState.cpp | 27 +- .../webkit/WebCore/generated/JSValidityState.h | 5 +- .../webkit/WebCore/generated/JSVoidCallback.h | 5 +- .../webkit/WebCore/generated/JSWebGLArray.cpp | 177 - .../webkit/WebCore/generated/JSWebGLArray.h | 92 - .../WebCore/generated/JSWebGLArrayBuffer.cpp | 121 - .../webkit/WebCore/generated/JSWebGLArrayBuffer.h | 84 - .../webkit/WebCore/generated/JSWebGLByteArray.cpp | 174 - .../webkit/WebCore/generated/JSWebGLByteArray.h | 94 - .../webkit/WebCore/generated/JSWebGLFloatArray.cpp | 174 - .../webkit/WebCore/generated/JSWebGLFloatArray.h | 94 - .../webkit/WebCore/generated/JSWebGLIntArray.cpp | 174 - .../webkit/WebCore/generated/JSWebGLIntArray.h | 94 - .../WebCore/generated/JSWebGLRenderingContext.cpp | 4252 - .../WebCore/generated/JSWebGLRenderingContext.h | 546 - .../webkit/WebCore/generated/JSWebGLShortArray.cpp | 174 - .../webkit/WebCore/generated/JSWebGLShortArray.h | 94 - .../WebCore/generated/JSWebGLUnsignedByteArray.cpp | 174 - .../WebCore/generated/JSWebGLUnsignedByteArray.h | 94 - .../WebCore/generated/JSWebGLUnsignedIntArray.cpp | 174 - .../WebCore/generated/JSWebGLUnsignedIntArray.h | 94 - .../generated/JSWebGLUnsignedShortArray.cpp | 174 - .../WebCore/generated/JSWebGLUnsignedShortArray.h | 94 - .../WebCore/generated/JSWebKitAnimationEvent.cpp | 8 +- .../WebCore/generated/JSWebKitAnimationEvent.h | 4 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.cpp | 11 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.h | 4 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.cpp | 15 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.h | 6 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.cpp | 132 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.h | 5 +- .../generated/JSWebKitCSSTransformValue.cpp | 54 +- .../WebCore/generated/JSWebKitCSSTransformValue.h | 9 +- .../webkit/WebCore/generated/JSWebKitPoint.cpp | 12 +- .../webkit/WebCore/generated/JSWebKitPoint.h | 5 +- .../WebCore/generated/JSWebKitTransitionEvent.cpp | 8 +- .../WebCore/generated/JSWebKitTransitionEvent.h | 4 +- .../webkit/WebCore/generated/JSWebSocket.cpp | 48 +- .../webkit/WebCore/generated/JSWebSocket.h | 5 +- .../webkit/WebCore/generated/JSWheelEvent.cpp | 47 +- .../webkit/WebCore/generated/JSWheelEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSWorker.cpp | 13 +- src/3rdparty/webkit/WebCore/generated/JSWorker.h | 4 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 36 +- .../webkit/WebCore/generated/JSWorkerContext.h | 7 +- .../WebCore/generated/JSWorkerContextBase.lut.h | 0 .../webkit/WebCore/generated/JSWorkerLocation.cpp | 26 +- .../webkit/WebCore/generated/JSWorkerLocation.h | 5 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 15 +- .../webkit/WebCore/generated/JSWorkerNavigator.h | 5 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 85 +- .../webkit/WebCore/generated/JSXMLHttpRequest.h | 5 +- .../generated/JSXMLHttpRequestException.cpp | 11 +- .../WebCore/generated/JSXMLHttpRequestException.h | 5 +- .../generated/JSXMLHttpRequestProgressEvent.cpp | 8 +- .../generated/JSXMLHttpRequestProgressEvent.h | 4 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 61 +- .../WebCore/generated/JSXMLHttpRequestUpload.h | 5 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 2 +- .../webkit/WebCore/generated/JSXMLSerializer.h | 5 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 2 +- .../webkit/WebCore/generated/JSXPathEvaluator.h | 5 +- .../webkit/WebCore/generated/JSXPathException.cpp | 11 +- .../webkit/WebCore/generated/JSXPathException.h | 5 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 2 +- .../webkit/WebCore/generated/JSXPathExpression.h | 5 +- .../webkit/WebCore/generated/JSXPathNSResolver.h | 5 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 8 +- .../webkit/WebCore/generated/JSXPathResult.h | 5 +- .../webkit/WebCore/generated/JSXSLTProcessor.h | 5 +- src/3rdparty/webkit/WebCore/generated/Lexer.lut.h | 49 + .../webkit/WebCore/generated/MathObject.lut.h | 31 + .../WebCore/generated/NumberConstructor.lut.h | 18 + .../WebCore/generated/RegExpConstructor.lut.h | 34 + .../webkit/WebCore/generated/RegExpObject.lut.h | 18 + .../webkit/WebCore/generated/SVGElementFactory.cpp | 168 - src/3rdparty/webkit/WebCore/generated/SVGNames.cpp | 969 +- src/3rdparty/webkit/WebCore/generated/SVGNames.h | 321 +- .../webkit/WebCore/generated/StringPrototype.lut.h | 48 + .../WebCore/generated/UserAgentStyleSheets.h | 8 +- .../WebCore/generated/UserAgentStyleSheetsData.cpp | 1144 +- .../webkit/WebCore/generated/WebKitVersion.h | 4 +- .../webkit/WebCore/generated/XLinkNames.cpp | 23 +- src/3rdparty/webkit/WebCore/generated/XLinkNames.h | 7 + .../webkit/WebCore/generated/XMLNSNames.cpp | 81 - src/3rdparty/webkit/WebCore/generated/XMLNSNames.h | 54 - src/3rdparty/webkit/WebCore/generated/XMLNames.cpp | 11 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 514 +- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- src/3rdparty/webkit/WebCore/generated/chartables.c | 96 + .../webkit/WebCore/generated/tokenizer.cpp | 4 +- .../webkit/WebCore/history/BackForwardList.cpp | 44 +- .../webkit/WebCore/history/BackForwardList.h | 7 +- .../WebCore/history/BackForwardListChromium.cpp | 10 - .../webkit/WebCore/history/CachedFrame.cpp | 23 +- src/3rdparty/webkit/WebCore/history/CachedFrame.h | 16 +- src/3rdparty/webkit/WebCore/history/CachedPage.cpp | 1 - src/3rdparty/webkit/WebCore/history/CachedPage.h | 11 +- .../webkit/WebCore/history/HistoryItem.cpp | 56 +- src/3rdparty/webkit/WebCore/history/HistoryItem.h | 29 +- src/3rdparty/webkit/WebCore/html/Blob.cpp | 53 - src/3rdparty/webkit/WebCore/html/Blob.h | 62 - src/3rdparty/webkit/WebCore/html/Blob.idl | 37 - .../webkit/WebCore/html/CollectionCache.cpp | 8 - src/3rdparty/webkit/WebCore/html/CollectionCache.h | 8 +- .../webkit/WebCore/html/DataGridColumn.idl | 1 + .../webkit/WebCore/html/DataGridColumnList.idl | 1 + .../webkit/WebCore/html/DateComponents.cpp | 681 - src/3rdparty/webkit/WebCore/html/DateComponents.h | 190 - src/3rdparty/webkit/WebCore/html/File.cpp | 16 +- src/3rdparty/webkit/WebCore/html/File.h | 30 +- src/3rdparty/webkit/WebCore/html/File.idl | 8 +- src/3rdparty/webkit/WebCore/html/FileList.idl | 1 + .../webkit/WebCore/html/HTMLAllCollection.idl | 1 + .../webkit/WebCore/html/HTMLAnchorElement.cpp | 132 +- .../webkit/WebCore/html/HTMLAnchorElement.h | 14 - .../webkit/WebCore/html/HTMLAnchorElement.idl | 18 +- .../webkit/WebCore/html/HTMLAppletElement.cpp | 21 +- .../webkit/WebCore/html/HTMLAppletElement.h | 1 - .../webkit/WebCore/html/HTMLAppletElement.idl | 5 +- .../webkit/WebCore/html/HTMLAreaElement.cpp | 73 +- src/3rdparty/webkit/WebCore/html/HTMLAreaElement.h | 13 +- .../webkit/WebCore/html/HTMLAreaElement.idl | 6 +- .../webkit/WebCore/html/HTMLAttributeNames.in | 25 +- .../webkit/WebCore/html/HTMLAudioElement.cpp | 20 +- .../webkit/WebCore/html/HTMLAudioElement.h | 10 +- .../webkit/WebCore/html/HTMLAudioElement.idl | 2 +- src/3rdparty/webkit/WebCore/html/HTMLBRElement.idl | 6 +- .../webkit/WebCore/html/HTMLBaseElement.idl | 6 +- .../webkit/WebCore/html/HTMLBaseFontElement.idl | 6 +- .../webkit/WebCore/html/HTMLBlockquoteElement.idl | 6 +- .../webkit/WebCore/html/HTMLBodyElement.cpp | 2 - src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h | 4 +- .../webkit/WebCore/html/HTMLBodyElement.idl | 10 +- .../webkit/WebCore/html/HTMLButtonElement.idl | 9 +- .../webkit/WebCore/html/HTMLCanvasElement.cpp | 39 +- .../webkit/WebCore/html/HTMLCanvasElement.h | 7 +- .../webkit/WebCore/html/HTMLCanvasElement.idl | 8 +- .../webkit/WebCore/html/HTMLCollection.cpp | 10 +- .../webkit/WebCore/html/HTMLCollection.idl | 5 +- .../webkit/WebCore/html/HTMLDListElement.idl | 6 +- .../WebCore/html/HTMLDataGridCellElement.idl | 1 + .../webkit/WebCore/html/HTMLDataGridColElement.cpp | 6 +- .../webkit/WebCore/html/HTMLDataGridColElement.idl | 1 + .../webkit/WebCore/html/HTMLDataGridElement.idl | 1 + .../webkit/WebCore/html/HTMLDataGridRowElement.idl | 1 + .../webkit/WebCore/html/HTMLDataListElement.idl | 1 + .../webkit/WebCore/html/HTMLDirectoryElement.idl | 6 +- .../webkit/WebCore/html/HTMLDivElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.cpp | 7 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.h | 1 + src/3rdparty/webkit/WebCore/html/HTMLDocument.idl | 5 +- src/3rdparty/webkit/WebCore/html/HTMLElement.cpp | 79 +- src/3rdparty/webkit/WebCore/html/HTMLElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLElement.idl | 5 +- .../webkit/WebCore/html/HTMLEmbedElement.cpp | 14 +- .../webkit/WebCore/html/HTMLEmbedElement.idl | 7 +- .../webkit/WebCore/html/HTMLFieldSetElement.idl | 9 +- .../webkit/WebCore/html/HTMLFontElement.idl | 6 +- .../webkit/WebCore/html/HTMLFormCollection.cpp | 14 +- .../webkit/WebCore/html/HTMLFormControlElement.cpp | 56 +- .../webkit/WebCore/html/HTMLFormControlElement.h | 15 +- .../webkit/WebCore/html/HTMLFormElement.cpp | 17 +- src/3rdparty/webkit/WebCore/html/HTMLFormElement.h | 5 +- .../webkit/WebCore/html/HTMLFormElement.idl | 5 +- .../webkit/WebCore/html/HTMLFrameElement.idl | 8 +- .../webkit/WebCore/html/HTMLFrameElementBase.cpp | 59 +- .../webkit/WebCore/html/HTMLFrameElementBase.h | 12 - .../webkit/WebCore/html/HTMLFrameOwnerElement.cpp | 12 - .../webkit/WebCore/html/HTMLFrameOwnerElement.h | 11 +- .../webkit/WebCore/html/HTMLFrameSetElement.cpp | 2 - .../webkit/WebCore/html/HTMLFrameSetElement.h | 1 - .../webkit/WebCore/html/HTMLFrameSetElement.idl | 9 +- src/3rdparty/webkit/WebCore/html/HTMLHRElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h | 2 + .../webkit/WebCore/html/HTMLHeadElement.idl | 6 +- .../webkit/WebCore/html/HTMLHeadingElement.cpp | 2 + .../webkit/WebCore/html/HTMLHeadingElement.h | 2 + .../webkit/WebCore/html/HTMLHeadingElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h | 2 + .../webkit/WebCore/html/HTMLHtmlElement.idl | 6 +- .../webkit/WebCore/html/HTMLIFrameElement.cpp | 52 +- .../webkit/WebCore/html/HTMLIFrameElement.h | 2 + .../webkit/WebCore/html/HTMLIFrameElement.idl | 9 +- .../webkit/WebCore/html/HTMLImageElement.cpp | 53 +- .../webkit/WebCore/html/HTMLImageElement.h | 14 +- .../webkit/WebCore/html/HTMLImageElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLImageLoader.h | 2 + .../webkit/WebCore/html/HTMLInputElement.cpp | 1305 +- .../webkit/WebCore/html/HTMLInputElement.h | 78 +- .../webkit/WebCore/html/HTMLInputElement.idl | 36 +- .../webkit/WebCore/html/HTMLIsIndexElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLLIElement.idl | 6 +- .../webkit/WebCore/html/HTMLLabelElement.idl | 6 +- .../webkit/WebCore/html/HTMLLegendElement.idl | 6 +- .../webkit/WebCore/html/HTMLLinkElement.cpp | 35 +- src/3rdparty/webkit/WebCore/html/HTMLLinkElement.h | 2 +- .../webkit/WebCore/html/HTMLLinkElement.idl | 8 +- .../webkit/WebCore/html/HTMLMapElement.cpp | 24 +- src/3rdparty/webkit/WebCore/html/HTMLMapElement.h | 6 +- .../webkit/WebCore/html/HTMLMapElement.idl | 6 +- .../webkit/WebCore/html/HTMLMarqueeElement.cpp | 25 +- .../webkit/WebCore/html/HTMLMarqueeElement.h | 4 - .../webkit/WebCore/html/HTMLMarqueeElement.idl | 6 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 338 +- .../webkit/WebCore/html/HTMLMediaElement.h | 43 +- .../webkit/WebCore/html/HTMLMediaElement.idl | 13 +- .../webkit/WebCore/html/HTMLMenuElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h | 2 + .../webkit/WebCore/html/HTMLMetaElement.idl | 6 +- .../webkit/WebCore/html/HTMLModElement.cpp | 2 + src/3rdparty/webkit/WebCore/html/HTMLModElement.h | 2 + .../webkit/WebCore/html/HTMLModElement.idl | 6 +- .../webkit/WebCore/html/HTMLNameCollection.cpp | 8 +- .../webkit/WebCore/html/HTMLOListElement.idl | 6 +- .../webkit/WebCore/html/HTMLObjectElement.cpp | 18 +- .../webkit/WebCore/html/HTMLObjectElement.idl | 7 +- .../webkit/WebCore/html/HTMLOptGroupElement.idl | 6 +- .../webkit/WebCore/html/HTMLOptionElement.cpp | 46 +- .../webkit/WebCore/html/HTMLOptionElement.h | 11 +- .../webkit/WebCore/html/HTMLOptionElement.idl | 5 +- .../webkit/WebCore/html/HTMLOptionsCollection.cpp | 2 + .../webkit/WebCore/html/HTMLOptionsCollection.idl | 4 +- .../webkit/WebCore/html/HTMLParagraphElement.idl | 6 +- .../webkit/WebCore/html/HTMLParamElement.cpp | 2 +- .../webkit/WebCore/html/HTMLParamElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLParser.cpp | 77 +- src/3rdparty/webkit/WebCore/html/HTMLParser.h | 10 +- .../webkit/WebCore/html/HTMLPlugInElement.cpp | 9 +- .../webkit/WebCore/html/HTMLPreElement.cpp | 2 + src/3rdparty/webkit/WebCore/html/HTMLPreElement.h | 2 + .../webkit/WebCore/html/HTMLPreElement.idl | 6 +- .../webkit/WebCore/html/HTMLQuoteElement.idl | 6 +- .../webkit/WebCore/html/HTMLScriptElement.idl | 6 +- .../webkit/WebCore/html/HTMLSelectElement.cpp | 8 +- .../webkit/WebCore/html/HTMLSelectElement.h | 4 +- .../webkit/WebCore/html/HTMLSelectElement.idl | 8 +- .../webkit/WebCore/html/HTMLSourceElement.idl | 2 +- .../webkit/WebCore/html/HTMLStyleElement.idl | 8 +- .../WebCore/html/HTMLTableCaptionElement.idl | 5 +- .../webkit/WebCore/html/HTMLTableCellElement.cpp | 2 + .../webkit/WebCore/html/HTMLTableCellElement.h | 2 + .../webkit/WebCore/html/HTMLTableCellElement.idl | 6 +- .../webkit/WebCore/html/HTMLTableColElement.cpp | 2 + .../webkit/WebCore/html/HTMLTableColElement.h | 2 + .../webkit/WebCore/html/HTMLTableColElement.idl | 6 +- .../webkit/WebCore/html/HTMLTableElement.idl | 6 +- .../webkit/WebCore/html/HTMLTablePartElement.cpp | 2 + .../webkit/WebCore/html/HTMLTablePartElement.h | 2 + .../webkit/WebCore/html/HTMLTableRowElement.idl | 6 +- .../WebCore/html/HTMLTableSectionElement.idl | 5 +- src/3rdparty/webkit/WebCore/html/HTMLTagNames.in | 11 +- .../webkit/WebCore/html/HTMLTextAreaElement.cpp | 26 +- .../webkit/WebCore/html/HTMLTextAreaElement.h | 1 - .../webkit/WebCore/html/HTMLTextAreaElement.idl | 9 +- .../webkit/WebCore/html/HTMLTitleElement.h | 2 + .../webkit/WebCore/html/HTMLTitleElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 86 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h | 13 +- .../webkit/WebCore/html/HTMLUListElement.idl | 6 +- .../webkit/WebCore/html/HTMLVideoElement.cpp | 85 +- .../webkit/WebCore/html/HTMLVideoElement.h | 20 +- .../webkit/WebCore/html/HTMLVideoElement.idl | 10 +- src/3rdparty/webkit/WebCore/html/ImageData.idl | 3 +- src/3rdparty/webkit/WebCore/html/MediaError.idl | 2 +- src/3rdparty/webkit/WebCore/html/TextMetrics.idl | 4 +- src/3rdparty/webkit/WebCore/html/TimeRanges.idl | 2 +- src/3rdparty/webkit/WebCore/html/ValidityState.cpp | 122 +- src/3rdparty/webkit/WebCore/html/ValidityState.h | 56 +- src/3rdparty/webkit/WebCore/html/ValidityState.idl | 2 +- src/3rdparty/webkit/WebCore/html/VoidCallback.idl | 2 +- .../webkit/WebCore/html/canvas/CanvasActiveInfo.h | 62 + .../WebCore/html/canvas/CanvasActiveInfo.idl | 36 + .../webkit/WebCore/html/canvas/CanvasArray.cpp | 52 + .../webkit/WebCore/html/canvas/CanvasArray.h | 75 + .../webkit/WebCore/html/canvas/CanvasArray.idl | 32 + .../WebCore/html/canvas/CanvasArrayBuffer.cpp | 57 + .../webkit/WebCore/html/canvas/CanvasArrayBuffer.h | 51 + .../WebCore/html/canvas/CanvasArrayBuffer.idl | 30 + .../webkit/WebCore/html/canvas/CanvasBuffer.cpp | 53 + .../webkit/WebCore/html/canvas/CanvasBuffer.h | 50 + .../webkit/WebCore/html/canvas/CanvasBuffer.idl | 29 + .../webkit/WebCore/html/canvas/CanvasByteArray.cpp | 77 + .../webkit/WebCore/html/canvas/CanvasByteArray.h | 90 + .../webkit/WebCore/html/canvas/CanvasByteArray.idl | 36 + .../html/canvas/CanvasContextAttributes.cpp | 41 - .../WebCore/html/canvas/CanvasContextAttributes.h | 48 - .../WebCore/html/canvas/CanvasFloatArray.cpp | 78 + .../webkit/WebCore/html/canvas/CanvasFloatArray.h | 86 + .../WebCore/html/canvas/CanvasFloatArray.idl | 36 + .../WebCore/html/canvas/CanvasFramebuffer.cpp | 53 + .../webkit/WebCore/html/canvas/CanvasFramebuffer.h | 50 + .../WebCore/html/canvas/CanvasFramebuffer.idl | 29 + .../webkit/WebCore/html/canvas/CanvasGradient.idl | 3 +- .../webkit/WebCore/html/canvas/CanvasIntArray.cpp | 82 + .../webkit/WebCore/html/canvas/CanvasIntArray.h | 88 + .../webkit/WebCore/html/canvas/CanvasIntArray.idl | 36 + .../WebCore/html/canvas/CanvasNumberArray.idl | 1 + .../webkit/WebCore/html/canvas/CanvasObject.cpp | 18 +- .../webkit/WebCore/html/canvas/CanvasObject.h | 17 +- .../webkit/WebCore/html/canvas/CanvasPattern.idl | 3 +- .../webkit/WebCore/html/canvas/CanvasPixelArray.h | 1 - .../WebCore/html/canvas/CanvasPixelArray.idl | 1 - .../webkit/WebCore/html/canvas/CanvasProgram.cpp | 53 + .../webkit/WebCore/html/canvas/CanvasProgram.h | 50 + .../webkit/WebCore/html/canvas/CanvasProgram.idl | 29 + .../WebCore/html/canvas/CanvasRenderbuffer.cpp | 53 + .../WebCore/html/canvas/CanvasRenderbuffer.h | 50 + .../WebCore/html/canvas/CanvasRenderbuffer.idl | 29 + .../WebCore/html/canvas/CanvasRenderingContext.idl | 1 + .../html/canvas/CanvasRenderingContext2D.cpp | 59 +- .../WebCore/html/canvas/CanvasRenderingContext2D.h | 4 +- .../html/canvas/CanvasRenderingContext2D.idl | 1 + .../html/canvas/CanvasRenderingContext3D.cpp | 1441 + .../WebCore/html/canvas/CanvasRenderingContext3D.h | 327 + .../html/canvas/CanvasRenderingContext3D.idl | 689 + .../webkit/WebCore/html/canvas/CanvasShader.cpp | 53 + .../webkit/WebCore/html/canvas/CanvasShader.h | 50 + .../webkit/WebCore/html/canvas/CanvasShader.idl | 29 + .../WebCore/html/canvas/CanvasShortArray.cpp | 82 + .../webkit/WebCore/html/canvas/CanvasShortArray.h | 86 + .../WebCore/html/canvas/CanvasShortArray.idl | 36 + .../webkit/WebCore/html/canvas/CanvasStyle.cpp | 28 +- .../webkit/WebCore/html/canvas/CanvasTexture.cpp | 54 + .../webkit/WebCore/html/canvas/CanvasTexture.h | 61 + .../webkit/WebCore/html/canvas/CanvasTexture.idl | 29 + .../html/canvas/CanvasUnsignedByteArray.cpp | 78 + .../WebCore/html/canvas/CanvasUnsignedByteArray.h | 86 + .../html/canvas/CanvasUnsignedByteArray.idl | 36 + .../WebCore/html/canvas/CanvasUnsignedIntArray.cpp | 83 + .../WebCore/html/canvas/CanvasUnsignedIntArray.h | 86 + .../WebCore/html/canvas/CanvasUnsignedIntArray.idl | 36 + .../html/canvas/CanvasUnsignedShortArray.cpp | 85 + .../WebCore/html/canvas/CanvasUnsignedShortArray.h | 87 + .../html/canvas/CanvasUnsignedShortArray.idl | 36 + .../webkit/WebCore/html/canvas/WebGLActiveInfo.h | 62 - .../webkit/WebCore/html/canvas/WebGLActiveInfo.idl | 37 - .../webkit/WebCore/html/canvas/WebGLArray.cpp | 60 - .../webkit/WebCore/html/canvas/WebGLArray.h | 81 - .../webkit/WebCore/html/canvas/WebGLArray.idl | 35 - .../WebCore/html/canvas/WebGLArrayBuffer.cpp | 71 - .../webkit/WebCore/html/canvas/WebGLArrayBuffer.h | 53 - .../WebCore/html/canvas/WebGLArrayBuffer.idl | 30 - .../webkit/WebCore/html/canvas/WebGLBuffer.cpp | 166 - .../webkit/WebCore/html/canvas/WebGLBuffer.h | 94 - .../webkit/WebCore/html/canvas/WebGLBuffer.idl | 29 - .../webkit/WebCore/html/canvas/WebGLByteArray.cpp | 93 - .../webkit/WebCore/html/canvas/WebGLByteArray.h | 100 - .../webkit/WebCore/html/canvas/WebGLByteArray.idl | 42 - .../WebCore/html/canvas/WebGLContextAttributes.cpp | 117 - .../WebCore/html/canvas/WebGLContextAttributes.h | 82 - .../WebCore/html/canvas/WebGLContextAttributes.idl | 38 - .../webkit/WebCore/html/canvas/WebGLFloatArray.cpp | 95 - .../webkit/WebCore/html/canvas/WebGLFloatArray.h | 95 - .../webkit/WebCore/html/canvas/WebGLFloatArray.idl | 42 - .../WebCore/html/canvas/WebGLFramebuffer.cpp | 53 - .../webkit/WebCore/html/canvas/WebGLFramebuffer.h | 50 - .../WebCore/html/canvas/WebGLFramebuffer.idl | 29 - .../webkit/WebCore/html/canvas/WebGLGetInfo.cpp | 215 - .../webkit/WebCore/html/canvas/WebGLGetInfo.h | 131 - .../webkit/WebCore/html/canvas/WebGLIntArray.cpp | 99 - .../webkit/WebCore/html/canvas/WebGLIntArray.h | 97 - .../webkit/WebCore/html/canvas/WebGLIntArray.idl | 42 - .../webkit/WebCore/html/canvas/WebGLProgram.cpp | 53 - .../webkit/WebCore/html/canvas/WebGLProgram.h | 50 - .../webkit/WebCore/html/canvas/WebGLProgram.idl | 29 - .../WebCore/html/canvas/WebGLRenderbuffer.cpp | 64 - .../webkit/WebCore/html/canvas/WebGLRenderbuffer.h | 55 - .../WebCore/html/canvas/WebGLRenderbuffer.idl | 29 - .../WebCore/html/canvas/WebGLRenderingContext.cpp | 2531 - .../WebCore/html/canvas/WebGLRenderingContext.h | 360 - .../WebCore/html/canvas/WebGLRenderingContext.idl | 676 - .../webkit/WebCore/html/canvas/WebGLShader.cpp | 53 - .../webkit/WebCore/html/canvas/WebGLShader.h | 50 - .../webkit/WebCore/html/canvas/WebGLShader.idl | 29 - .../webkit/WebCore/html/canvas/WebGLShortArray.cpp | 98 - .../webkit/WebCore/html/canvas/WebGLShortArray.h | 94 - .../webkit/WebCore/html/canvas/WebGLShortArray.idl | 41 - .../webkit/WebCore/html/canvas/WebGLTexture.cpp | 66 - .../webkit/WebCore/html/canvas/WebGLTexture.h | 66 - .../webkit/WebCore/html/canvas/WebGLTexture.idl | 29 - .../WebCore/html/canvas/WebGLUniformLocation.cpp | 48 - .../WebCore/html/canvas/WebGLUniformLocation.h | 58 - .../WebCore/html/canvas/WebGLUniformLocation.idl | 30 - .../WebCore/html/canvas/WebGLUnsignedByteArray.cpp | 95 - .../WebCore/html/canvas/WebGLUnsignedByteArray.h | 95 - .../WebCore/html/canvas/WebGLUnsignedByteArray.idl | 42 - .../WebCore/html/canvas/WebGLUnsignedIntArray.cpp | 100 - .../WebCore/html/canvas/WebGLUnsignedIntArray.h | 95 - .../WebCore/html/canvas/WebGLUnsignedIntArray.idl | 42 - .../html/canvas/WebGLUnsignedShortArray.cpp | 102 - .../WebCore/html/canvas/WebGLUnsignedShortArray.h | 96 - .../html/canvas/WebGLUnsignedShortArray.idl | 42 - .../webkit/WebCore/inspector/ConsoleMessage.cpp | 18 +- .../webkit/WebCore/inspector/ConsoleMessage.h | 5 +- .../webkit/WebCore/inspector/InjectedScript.cpp | 91 - .../webkit/WebCore/inspector/InjectedScript.h | 66 - .../WebCore/inspector/InjectedScriptHost.cpp | 208 - .../webkit/WebCore/inspector/InjectedScriptHost.h | 107 - .../WebCore/inspector/InjectedScriptHost.idl | 60 - .../webkit/WebCore/inspector/InspectorBackend.cpp | 419 +- .../webkit/WebCore/inspector/InspectorBackend.h | 101 +- .../webkit/WebCore/inspector/InspectorBackend.idl | 81 +- .../webkit/WebCore/inspector/InspectorClient.h | 5 +- .../WebCore/inspector/InspectorController.cpp | 569 +- .../webkit/WebCore/inspector/InspectorController.h | 177 +- .../webkit/WebCore/inspector/InspectorDOMAgent.cpp | 218 +- .../webkit/WebCore/inspector/InspectorDOMAgent.h | 14 +- .../inspector/InspectorDatabaseResource.cpp | 4 + .../webkit/WebCore/inspector/InspectorFrontend.cpp | 472 +- .../webkit/WebCore/inspector/InspectorFrontend.h | 47 +- .../WebCore/inspector/InspectorFrontendHost.cpp | 185 - .../WebCore/inspector/InspectorFrontendHost.h | 139 - .../WebCore/inspector/InspectorFrontendHost.idl | 53 - .../webkit/WebCore/inspector/InspectorResource.cpp | 121 +- .../webkit/WebCore/inspector/InspectorResource.h | 33 +- .../WebCore/inspector/InspectorTimelineAgent.cpp | 112 +- .../WebCore/inspector/InspectorTimelineAgent.h | 43 +- .../WebCore/inspector/JavaScriptCallFrame.cpp | 4 +- .../webkit/WebCore/inspector/JavaScriptCallFrame.h | 2 +- .../WebCore/inspector/JavaScriptCallFrame.idl | 2 +- .../WebCore/inspector/JavaScriptDebugListener.h | 2 +- .../WebCore/inspector/JavaScriptDebugServer.cpp | 14 +- .../WebCore/inspector/JavaScriptDebugServer.h | 17 +- .../webkit/WebCore/inspector/JavaScriptProfile.cpp | 183 + .../webkit/WebCore/inspector/JavaScriptProfile.h | 46 + .../WebCore/inspector/JavaScriptProfileNode.cpp | 236 + .../WebCore/inspector/JavaScriptProfileNode.h | 48 + .../WebCore/inspector/TimelineRecordFactory.cpp | 101 +- .../WebCore/inspector/TimelineRecordFactory.h | 29 +- .../inspector/front-end/AbstractTimelinePanel.js | 152 +- .../WebCore/inspector/front-end/AuditCategories.js | 70 - .../inspector/front-end/AuditLauncherView.js | 224 - .../WebCore/inspector/front-end/AuditResultView.js | 138 - .../WebCore/inspector/front-end/AuditRules.js | 1213 - .../WebCore/inspector/front-end/AuditsPanel.js | 480 - .../front-end/BottomUpProfileDataGridTree.js | 22 +- .../WebCore/inspector/front-end/Breakpoint.js | 2 +- .../inspector/front-end/BreakpointsSidebarPane.js | 28 +- .../inspector/front-end/CallStackSidebarPane.js | 3 +- .../WebCore/inspector/front-end/ConsolePanel.js | 88 - .../WebCore/inspector/front-end/ConsoleView.js | 341 +- .../WebCore/inspector/front-end/ContextMenu.js | 83 - .../WebCore/inspector/front-end/CookieItemsView.js | 318 +- .../webkit/WebCore/inspector/front-end/DOMAgent.js | 83 +- .../WebCore/inspector/front-end/DOMStorage.js | 6 +- .../inspector/front-end/DOMStorageDataGrid.js | 161 + .../inspector/front-end/DOMStorageItemsView.js | 76 +- .../inspector/front-end/DOMSyntaxHighlighter.js | 79 - .../webkit/WebCore/inspector/front-end/DataGrid.js | 283 +- .../webkit/WebCore/inspector/front-end/Database.js | 5 +- .../inspector/front-end/DatabaseQueryView.js | 6 +- .../inspector/front-end/DatabaseTableView.js | 1 - .../webkit/WebCore/inspector/front-end/Drawer.js | 144 +- .../WebCore/inspector/front-end/ElementsPanel.js | 189 +- .../inspector/front-end/ElementsTreeOutline.js | 519 +- .../front-end/EventListenersSidebarPane.js | 22 +- .../webkit/WebCore/inspector/front-end/FontView.js | 2 +- .../inspector/front-end/Images/consoleIcon.png | Bin 2930 -> 0 bytes .../inspector/front-end/Images/gearButtonGlyph.png | Bin 323 -> 0 bytes .../inspector/front-end/Images/popoverArrows.png | Bin 784 -> 0 bytes .../front-end/Images/popoverBackground.png | Bin 2233 -> 0 bytes .../front-end/Images/thumbActiveHoriz.png | Bin 647 -> 0 bytes .../inspector/front-end/Images/thumbActiveVert.png | Bin 599 -> 0 bytes .../inspector/front-end/Images/thumbHoriz.png | Bin 657 -> 0 bytes .../inspector/front-end/Images/thumbHoverHoriz.png | Bin 667 -> 0 bytes .../inspector/front-end/Images/thumbHoverVert.png | Bin 583 -> 0 bytes .../inspector/front-end/Images/thumbVert.png | Bin 568 -> 0 bytes .../inspector/front-end/Images/tipBalloon.png | Bin 0 -> 3689 bytes .../front-end/Images/tipBalloonBottom.png | Bin 0 -> 3139 bytes .../WebCore/inspector/front-end/Images/tipIcon.png | Bin 0 -> 1212 bytes .../inspector/front-end/Images/tipIconPressed.png | Bin 0 -> 1224 bytes .../inspector/front-end/Images/trackHoriz.png | Bin 520 -> 0 bytes .../inspector/front-end/Images/trackVert.png | Bin 523 -> 0 bytes .../WebCore/inspector/front-end/InjectedScript.js | 467 +- .../inspector/front-end/InjectedScriptAccess.js | 30 +- .../inspector/front-end/InspectorBackendStub.js | 266 - .../inspector/front-end/InspectorControllerStub.js | 296 + .../front-end/InspectorFrontendHostStub.js | 101 - .../inspector/front-end/KeyboardShortcut.js | 16 +- .../inspector/front-end/MetricsSidebarPane.js | 26 +- .../inspector/front-end/ObjectPropertiesSection.js | 21 +- .../WebCore/inspector/front-end/ObjectProxy.js | 22 +- .../webkit/WebCore/inspector/front-end/Panel.js | 68 +- .../inspector/front-end/PanelEnablerView.js | 11 +- .../webkit/WebCore/inspector/front-end/Popover.js | 147 - .../webkit/WebCore/inspector/front-end/Popup.js | 168 + .../inspector/front-end/ProfileDataGridTree.js | 1 - .../WebCore/inspector/front-end/ProfileView.js | 40 +- .../WebCore/inspector/front-end/ProfilesPanel.js | 78 +- .../inspector/front-end/PropertiesSection.js | 112 +- .../inspector/front-end/PropertiesSidebarPane.js | 15 +- .../webkit/WebCore/inspector/front-end/Resource.js | 145 +- .../WebCore/inspector/front-end/ResourceView.js | 164 +- .../WebCore/inspector/front-end/ResourcesPanel.js | 129 +- .../WebCore/inspector/front-end/ScriptView.js | 25 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 201 +- .../webkit/WebCore/inspector/front-end/Section.js | 140 - .../webkit/WebCore/inspector/front-end/Settings.js | 99 - .../WebCore/inspector/front-end/SidebarPane.js | 8 - .../inspector/front-end/SourceCSSTokenizer.js | 1473 - .../inspector/front-end/SourceCSSTokenizer.re2js | 318 - .../WebCore/inspector/front-end/SourceFrame.js | 1578 +- .../inspector/front-end/SourceHTMLTokenizer.js | 658 - .../inspector/front-end/SourceHTMLTokenizer.re2js | 274 - .../front-end/SourceJavaScriptTokenizer.js | 2416 - .../front-end/SourceJavaScriptTokenizer.re2js | 177 - .../WebCore/inspector/front-end/SourceTokenizer.js | 105 - .../WebCore/inspector/front-end/SourceView.js | 132 +- .../WebCore/inspector/front-end/StatusBarButton.js | 54 +- .../WebCore/inspector/front-end/StoragePanel.js | 70 +- .../inspector/front-end/StylesSidebarPane.js | 78 +- .../WebCore/inspector/front-end/TestController.js | 29 +- .../inspector/front-end/TextEditorHighlighter.js | 169 - .../WebCore/inspector/front-end/TextEditorModel.js | 309 - .../WebCore/inspector/front-end/TextPrompt.js | 138 +- .../WebCore/inspector/front-end/TextViewer.js | 688 - .../WebCore/inspector/front-end/TimelineAgent.js | 24 +- .../WebCore/inspector/front-end/TimelineGrid.js | 144 - .../inspector/front-end/TimelineOverviewPane.js | 388 - .../WebCore/inspector/front-end/TimelinePanel.js | 561 +- .../front-end/TopDownProfileDataGridTree.js | 11 - .../front-end/WatchExpressionsSidebarPane.js | 98 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 45 +- .../WebCore/inspector/front-end/WelcomeView.js | 73 - .../webkit/WebCore/inspector/front-end/audits.css | 272 - .../WebCore/inspector/front-end/inspector.css | 596 +- .../WebCore/inspector/front-end/inspector.html | 35 +- .../WebCore/inspector/front-end/inspector.js | 755 +- .../front-end/inspectorSyntaxHighlight.css | 58 +- .../webkit/WebCore/inspector/front-end/popover.css | 200 - .../WebCore/inspector/front-end/textViewer.css | 148 - .../WebCore/inspector/front-end/treeoutline.js | 28 +- .../WebCore/inspector/front-end/utilities.js | 135 +- src/3rdparty/webkit/WebCore/loader/Cache.cpp | 27 +- src/3rdparty/webkit/WebCore/loader/Cache.h | 2 +- src/3rdparty/webkit/WebCore/loader/CachePolicy.h | 3 +- .../webkit/WebCore/loader/CachedCSSStyleSheet.cpp | 21 +- .../webkit/WebCore/loader/CachedCSSStyleSheet.h | 4 +- src/3rdparty/webkit/WebCore/loader/CachedFont.cpp | 4 +- src/3rdparty/webkit/WebCore/loader/CachedImage.cpp | 3 +- .../webkit/WebCore/loader/CachedResource.cpp | 6 +- .../webkit/WebCore/loader/CachedResource.h | 9 +- .../webkit/WebCore/loader/CachedResourceClient.h | 5 +- .../webkit/WebCore/loader/CachedResourceHandle.h | 2 +- .../webkit/WebCore/loader/CachedXSLStyleSheet.cpp | 5 +- .../WebCore/loader/CrossOriginAccessControl.cpp | 3 - .../loader/CrossOriginPreflightResultCache.h | 2 - src/3rdparty/webkit/WebCore/loader/DocLoader.cpp | 10 +- src/3rdparty/webkit/WebCore/loader/DocLoader.h | 2 +- .../webkit/WebCore/loader/DocumentLoader.cpp | 69 +- .../webkit/WebCore/loader/DocumentLoader.h | 4 +- .../WebCore/loader/DocumentThreadableLoader.cpp | 17 +- .../WebCore/loader/DocumentThreadableLoader.h | 5 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 38 +- .../webkit/WebCore/loader/FTPDirectoryDocument.cpp | 53 +- .../webkit/WebCore/loader/FTPDirectoryParser.cpp | 29 +- src/3rdparty/webkit/WebCore/loader/FormState.cpp | 7 +- src/3rdparty/webkit/WebCore/loader/FormState.h | 11 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 519 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 23 +- .../webkit/WebCore/loader/FrameLoaderClient.h | 18 +- .../webkit/WebCore/loader/FrameLoaderTypes.h | 17 - .../webkit/WebCore/loader/HistoryController.cpp | 45 +- .../webkit/WebCore/loader/HistoryController.h | 6 +- .../webkit/WebCore/loader/ImageDocument.cpp | 8 +- src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp | 76 +- src/3rdparty/webkit/WebCore/loader/ImageLoader.h | 7 +- .../webkit/WebCore/loader/MainResourceLoader.cpp | 31 - .../webkit/WebCore/loader/MainResourceLoader.h | 6 +- .../webkit/WebCore/loader/MediaDocument.cpp | 8 +- .../webkit/WebCore/loader/PlaceholderDocument.cpp | 5 + .../webkit/WebCore/loader/PlaceholderDocument.h | 2 +- .../webkit/WebCore/loader/ProgressTracker.cpp | 14 +- .../webkit/WebCore/loader/RedirectScheduler.cpp | 38 +- src/3rdparty/webkit/WebCore/loader/Request.cpp | 4 +- src/3rdparty/webkit/WebCore/loader/Request.h | 9 +- .../webkit/WebCore/loader/ResourceLoadNotifier.cpp | 13 +- .../webkit/WebCore/loader/ResourceLoadNotifier.h | 2 +- .../webkit/WebCore/loader/ResourceLoader.cpp | 2 +- .../webkit/WebCore/loader/SubresourceLoader.cpp | 6 +- .../webkit/WebCore/loader/SubresourceLoader.h | 7 +- .../WebCore/loader/SubresourceLoaderClient.h | 2 +- .../webkit/WebCore/loader/ThreadableLoader.h | 2 +- .../webkit/WebCore/loader/ThreadableLoaderClient.h | 2 +- .../WebCore/loader/WorkerThreadableLoader.cpp | 6 +- .../webkit/WebCore/loader/WorkerThreadableLoader.h | 8 +- .../WebCore/loader/appcache/ApplicationCache.h | 2 +- .../loader/appcache/ApplicationCacheGroup.cpp | 7 +- .../loader/appcache/ApplicationCacheHost.cpp | 21 - .../WebCore/loader/appcache/ApplicationCacheHost.h | 9 +- .../loader/appcache/ApplicationCacheStorage.cpp | 2 +- .../loader/appcache/ApplicationCacheStorage.h | 2 +- .../loader/appcache/DOMApplicationCache.cpp | 6 +- .../loader/appcache/DOMApplicationCache.idl | 3 +- .../WebCore/loader/archive/ArchiveFactory.cpp | 15 +- .../WebCore/loader/icon/IconDatabaseClient.h | 4 +- src/3rdparty/webkit/WebCore/loader/loader.cpp | 38 +- src/3rdparty/webkit/WebCore/loader/loader.h | 3 +- .../webkit/WebCore/mathml/MathMLElement.cpp | 39 +- src/3rdparty/webkit/WebCore/mathml/MathMLElement.h | 39 +- .../mathml/MathMLInlineContainerElement.cpp | 47 +- .../WebCore/mathml/MathMLInlineContainerElement.h | 39 +- .../webkit/WebCore/mathml/MathMLMathElement.cpp | 39 +- .../webkit/WebCore/mathml/MathMLMathElement.h | 39 +- .../webkit/WebCore/mathml/MathMLTextElement.cpp | 58 - .../webkit/WebCore/mathml/MathMLTextElement.h | 48 - .../webkit/WebCore/mathml/RenderMathMLBlock.cpp | 113 - .../webkit/WebCore/mathml/RenderMathMLBlock.h | 75 - src/3rdparty/webkit/WebCore/mathml/mathattrs.in | 13 - src/3rdparty/webkit/WebCore/mathml/mathtags.in | 1 + .../webkit/WebCore/notifications/Notification.cpp | 12 +- .../webkit/WebCore/notifications/Notification.idl | 3 +- .../WebCore/notifications/NotificationCenter.cpp | 26 +- .../WebCore/notifications/NotificationCenter.h | 14 +- .../WebCore/notifications/NotificationCenter.idl | 3 +- .../WebCore/notifications/NotificationPresenter.h | 30 +- src/3rdparty/webkit/WebCore/page/AbstractView.idl | 3 +- src/3rdparty/webkit/WebCore/page/BarInfo.cpp | 22 +- src/3rdparty/webkit/WebCore/page/BarInfo.idl | 2 +- src/3rdparty/webkit/WebCore/page/Chrome.cpp | 25 +- src/3rdparty/webkit/WebCore/page/Chrome.h | 7 - src/3rdparty/webkit/WebCore/page/ChromeClient.h | 12 - src/3rdparty/webkit/WebCore/page/Console.cpp | 41 +- src/3rdparty/webkit/WebCore/page/Console.h | 145 +- src/3rdparty/webkit/WebCore/page/Console.idl | 6 +- .../webkit/WebCore/page/ContextMenuController.cpp | 46 +- .../webkit/WebCore/page/ContextMenuController.h | 9 - .../webkit/WebCore/page/ContextMenuProvider.h | 52 - src/3rdparty/webkit/WebCore/page/Coordinates.idl | 2 +- src/3rdparty/webkit/WebCore/page/DOMSelection.idl | 2 +- src/3rdparty/webkit/WebCore/page/DOMTimer.cpp | 11 +- src/3rdparty/webkit/WebCore/page/DOMTimer.h | 7 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 104 +- src/3rdparty/webkit/WebCore/page/DOMWindow.h | 69 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 175 +- .../webkit/WebCore/page/DragController.cpp | 46 +- src/3rdparty/webkit/WebCore/page/DragController.h | 2 +- src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 311 +- src/3rdparty/webkit/WebCore/page/EventHandler.h | 28 +- src/3rdparty/webkit/WebCore/page/EventSource.cpp | 18 +- src/3rdparty/webkit/WebCore/page/EventSource.h | 2 +- src/3rdparty/webkit/WebCore/page/EventSource.idl | 1 - .../webkit/WebCore/page/FocusController.cpp | 9 +- src/3rdparty/webkit/WebCore/page/FocusController.h | 48 +- src/3rdparty/webkit/WebCore/page/Frame.cpp | 356 +- src/3rdparty/webkit/WebCore/page/Frame.h | 49 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 192 +- src/3rdparty/webkit/WebCore/page/FrameView.h | 25 +- src/3rdparty/webkit/WebCore/page/Geolocation.cpp | 213 +- src/3rdparty/webkit/WebCore/page/Geolocation.h | 41 +- src/3rdparty/webkit/WebCore/page/Geolocation.idl | 2 +- .../webkit/WebCore/page/GeolocationController.cpp | 93 - .../webkit/WebCore/page/GeolocationController.h | 67 - .../WebCore/page/GeolocationControllerClient.h | 47 - .../webkit/WebCore/page/GeolocationError.h | 65 - .../webkit/WebCore/page/GeolocationPosition.h | 111 - src/3rdparty/webkit/WebCore/page/Geoposition.h | 7 +- src/3rdparty/webkit/WebCore/page/Geoposition.idl | 2 +- src/3rdparty/webkit/WebCore/page/HaltablePlugin.h | 2 - src/3rdparty/webkit/WebCore/page/History.cpp | 45 - src/3rdparty/webkit/WebCore/page/History.h | 42 +- src/3rdparty/webkit/WebCore/page/History.idl | 8 +- src/3rdparty/webkit/WebCore/page/Location.idl | 3 +- .../webkit/WebCore/page/MediaCanStartListener.h | 40 - .../WebCore/page/MouseEventWithHitTestResults.h | 2 +- src/3rdparty/webkit/WebCore/page/Navigator.cpp | 92 - src/3rdparty/webkit/WebCore/page/Navigator.h | 5 - src/3rdparty/webkit/WebCore/page/Navigator.idl | 10 +- src/3rdparty/webkit/WebCore/page/NavigatorBase.cpp | 12 +- src/3rdparty/webkit/WebCore/page/Page.cpp | 104 +- src/3rdparty/webkit/WebCore/page/Page.h | 58 +- src/3rdparty/webkit/WebCore/page/PageGroup.cpp | 47 +- src/3rdparty/webkit/WebCore/page/PageGroup.h | 12 +- src/3rdparty/webkit/WebCore/page/PluginHalter.cpp | 3 +- src/3rdparty/webkit/WebCore/page/PluginHalter.h | 2 +- .../webkit/WebCore/page/PluginHalterClient.h | 3 +- src/3rdparty/webkit/WebCore/page/PositionError.h | 1 + src/3rdparty/webkit/WebCore/page/PositionError.idl | 5 +- src/3rdparty/webkit/WebCore/page/PrintContext.cpp | 84 +- src/3rdparty/webkit/WebCore/page/PrintContext.h | 10 - src/3rdparty/webkit/WebCore/page/Screen.idl | 2 +- .../webkit/WebCore/page/SecurityOrigin.cpp | 122 +- src/3rdparty/webkit/WebCore/page/SecurityOrigin.h | 305 +- src/3rdparty/webkit/WebCore/page/Settings.cpp | 63 +- src/3rdparty/webkit/WebCore/page/Settings.h | 42 +- src/3rdparty/webkit/WebCore/page/UserScript.h | 7 +- src/3rdparty/webkit/WebCore/page/UserScriptTypes.h | 3 +- src/3rdparty/webkit/WebCore/page/UserStyleSheet.h | 8 +- .../webkit/WebCore/page/UserStyleSheetTypes.h | 3 +- src/3rdparty/webkit/WebCore/page/WebKitPoint.idl | 2 +- .../webkit/WebCore/page/WorkerNavigator.idl | 3 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 156 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.h | 45 +- .../WebCore/page/android/DragControllerAndroid.cpp | 58 + .../WebCore/page/android/EventHandlerAndroid.cpp | 128 + .../page/android/InspectorControllerAndroid.cpp | 106 + .../WebCore/page/animation/AnimationBase.cpp | 50 +- .../webkit/WebCore/page/animation/AnimationBase.h | 9 +- .../WebCore/page/animation/AnimationController.cpp | 2 +- .../page/animation/AnimationControllerPrivate.h | 2 +- .../WebCore/page/animation/CompositeAnimation.cpp | 15 - .../WebCore/page/animation/ImplicitAnimation.cpp | 14 +- .../WebCore/page/animation/ImplicitAnimation.h | 5 +- .../WebCore/page/animation/KeyframeAnimation.cpp | 57 +- .../WebCore/page/animation/KeyframeAnimation.h | 8 +- .../webkit/WebCore/page/qt/DragControllerQt.cpp | 1 - .../webkit/WebCore/page/win/EventHandlerWin.cpp | 2 +- .../webkit/WebCore/page/win/FrameCGWin.cpp | 11 +- .../webkit/WebCore/page/win/FrameCairoWin.cpp | 1 - src/3rdparty/webkit/WebCore/page/win/FrameWin.cpp | 64 +- src/3rdparty/webkit/WebCore/page/win/FrameWin.h | 7 +- src/3rdparty/webkit/WebCore/page/win/PageWin.cpp | 31 +- .../webkit/WebCore/platform/ContextMenu.cpp | 25 +- src/3rdparty/webkit/WebCore/platform/ContextMenu.h | 2 - .../webkit/WebCore/platform/ContextMenuItem.h | 19 +- src/3rdparty/webkit/WebCore/platform/CookieJar.h | 2 - .../webkit/WebCore/platform/CrossThreadCopier.cpp | 14 +- .../webkit/WebCore/platform/CrossThreadCopier.h | 43 +- src/3rdparty/webkit/WebCore/platform/Cursor.h | 7 +- .../webkit/WebCore/platform/DeprecatedPtrList.h | 3 +- .../WebCore/platform/DeprecatedPtrListImpl.cpp | 3 +- src/3rdparty/webkit/WebCore/platform/DragImage.h | 4 - .../webkit/WebCore/platform/FileChooser.cpp | 39 +- src/3rdparty/webkit/WebCore/platform/FileChooser.h | 16 +- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 15 +- .../webkit/WebCore/platform/GeolocationService.cpp | 7 +- .../webkit/WebCore/platform/GeolocationService.h | 7 +- src/3rdparty/webkit/WebCore/platform/KURL.cpp | 198 +- src/3rdparty/webkit/WebCore/platform/KURL.h | 24 +- .../webkit/WebCore/platform/KURLGoogle.cpp | 179 +- .../webkit/WebCore/platform/KeyboardCodes.h | 18 +- src/3rdparty/webkit/WebCore/platform/Length.h | 3 +- src/3rdparty/webkit/WebCore/platform/LinkHash.cpp | 6 +- .../webkit/WebCore/platform/LocalizedStrings.h | 11 - src/3rdparty/webkit/WebCore/platform/Logging.cpp | 10 +- src/3rdparty/webkit/WebCore/platform/Logging.h | 3 +- .../webkit/WebCore/platform/MIMETypeRegistry.cpp | 2 +- src/3rdparty/webkit/WebCore/platform/Pasteboard.h | 1 - .../WebCore/platform/PlatformKeyboardEvent.h | 13 +- .../webkit/WebCore/platform/PlatformMouseEvent.h | 17 +- .../webkit/WebCore/platform/PlatformTouchEvent.h | 83 - .../webkit/WebCore/platform/PlatformTouchPoint.h | 69 - .../webkit/WebCore/platform/PlatformWheelEvent.h | 14 - src/3rdparty/webkit/WebCore/platform/PopupMenu.h | 13 +- .../webkit/WebCore/platform/PurgeableBuffer.h | 2 +- .../webkit/WebCore/platform/ScrollView.cpp | 35 +- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 11 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp | 23 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.h | 15 +- .../webkit/WebCore/platform/ScrollbarTheme.h | 8 +- .../WebCore/platform/ScrollbarThemeComposite.cpp | 3 +- .../webkit/WebCore/platform/SharedBuffer.cpp | 139 +- .../webkit/WebCore/platform/SharedBuffer.h | 37 +- src/3rdparty/webkit/WebCore/platform/SharedTimer.h | 4 +- .../webkit/WebCore/platform/StaticConstructors.h | 2 + src/3rdparty/webkit/WebCore/platform/ThemeTypes.h | 7 +- .../webkit/WebCore/platform/ThreadGlobalData.cpp | 24 +- .../webkit/WebCore/platform/ThreadGlobalData.h | 34 +- src/3rdparty/webkit/WebCore/platform/Timer.cpp | 7 + src/3rdparty/webkit/WebCore/platform/Timer.h | 6 - src/3rdparty/webkit/WebCore/platform/TreeShared.h | 22 +- src/3rdparty/webkit/WebCore/platform/Widget.h | 4 +- .../WebCore/platform/android/ClipboardAndroid.cpp | 105 + .../WebCore/platform/android/ClipboardAndroid.h | 64 + .../WebCore/platform/android/CursorAndroid.cpp | 298 + .../WebCore/platform/android/DragDataAndroid.cpp | 96 + .../WebCore/platform/android/EventLoopAndroid.cpp | 38 + .../platform/android/FileChooserAndroid.cpp | 60 + .../WebCore/platform/android/FileSystemAndroid.cpp | 131 + .../WebCore/platform/android/KeyEventAndroid.cpp | 273 + .../WebCore/platform/android/KeyboardCodes.h | 545 + .../platform/android/LocalizedStringsAndroid.cpp | 54 + .../WebCore/platform/android/PopupMenuAndroid.cpp | 57 + .../platform/android/RenderThemeAndroid.cpp | 334 + .../WebCore/platform/android/RenderThemeAndroid.h | 109 + .../WebCore/platform/android/ScreenAndroid.cpp | 107 + .../WebCore/platform/android/ScrollViewAndroid.cpp | 105 + .../platform/android/SearchPopupMenuAndroid.cpp | 52 + .../WebCore/platform/android/SystemTimeAndroid.cpp | 37 + .../platform/android/TemporaryLinkStubs.cpp | 677 + .../WebCore/platform/android/WidgetAndroid.cpp | 128 + .../WebCore/platform/animation/AnimationList.h | 2 +- .../WebCore/platform/cf/BinaryPropertyList.cpp | 832 - .../WebCore/platform/cf/BinaryPropertyList.h | 110 - .../webkit/WebCore/platform/cf/FileSystemCF.cpp | 57 - .../webkit/WebCore/platform/cf/KURLCFNet.cpp | 95 - .../webkit/WebCore/platform/cf/RunLoopTimerCF.cpp | 84 - .../webkit/WebCore/platform/cf/SchedulePair.cpp | 52 - .../webkit/WebCore/platform/cf/SchedulePair.h | 88 - .../webkit/WebCore/platform/cf/SharedBufferCF.cpp | 92 - .../WebCore/platform/graphics/BitmapImage.cpp | 34 +- .../webkit/WebCore/platform/graphics/BitmapImage.h | 12 +- .../webkit/WebCore/platform/graphics/Color.h | 3 +- .../webkit/WebCore/platform/graphics/ColorSpace.h | 35 - .../WebCore/platform/graphics/FloatPoint.cpp | 7 - .../webkit/WebCore/platform/graphics/FloatPoint.h | 6 +- .../webkit/WebCore/platform/graphics/FloatQuad.cpp | 6 - .../webkit/WebCore/platform/graphics/FloatQuad.h | 6 - .../webkit/WebCore/platform/graphics/FloatRect.cpp | 10 +- .../webkit/WebCore/platform/graphics/FloatRect.h | 17 +- .../webkit/WebCore/platform/graphics/FloatSize.h | 11 +- .../webkit/WebCore/platform/graphics/Font.cpp | 17 +- .../webkit/WebCore/platform/graphics/Font.h | 22 - .../webkit/WebCore/platform/graphics/FontCache.cpp | 23 +- .../webkit/WebCore/platform/graphics/FontCache.h | 19 +- .../WebCore/platform/graphics/FontFastPath.cpp | 15 +- .../WebCore/platform/graphics/GeneratedImage.cpp | 47 +- .../WebCore/platform/graphics/GeneratedImage.h | 6 +- .../webkit/WebCore/platform/graphics/Generator.h | 1 - .../webkit/WebCore/platform/graphics/GlyphBuffer.h | 10 +- .../webkit/WebCore/platform/graphics/Gradient.cpp | 40 +- .../webkit/WebCore/platform/graphics/Gradient.h | 29 +- .../WebCore/platform/graphics/GraphicsContext.cpp | 182 +- .../WebCore/platform/graphics/GraphicsContext.h | 98 +- .../platform/graphics/GraphicsContext3D.cpp | 130 - .../WebCore/platform/graphics/GraphicsContext3D.h | 601 +- .../platform/graphics/GraphicsContextPrivate.h | 37 +- .../WebCore/platform/graphics/GraphicsLayer.cpp | 52 +- .../WebCore/platform/graphics/GraphicsLayer.h | 45 +- .../platform/graphics/GraphicsLayerClient.h | 3 - .../webkit/WebCore/platform/graphics/Icon.h | 3 +- .../webkit/WebCore/platform/graphics/Image.cpp | 24 +- .../webkit/WebCore/platform/graphics/Image.h | 19 +- .../webkit/WebCore/platform/graphics/ImageBuffer.h | 6 +- .../WebCore/platform/graphics/ImageSource.cpp | 9 +- .../webkit/WebCore/platform/graphics/ImageSource.h | 4 +- .../webkit/WebCore/platform/graphics/IntPoint.h | 9 - .../webkit/WebCore/platform/graphics/IntRect.cpp | 35 +- .../webkit/WebCore/platform/graphics/IntRect.h | 33 +- .../webkit/WebCore/platform/graphics/IntSize.h | 12 +- .../WebCore/platform/graphics/MediaPlayer.cpp | 92 +- .../webkit/WebCore/platform/graphics/MediaPlayer.h | 51 +- .../WebCore/platform/graphics/MediaPlayerPrivate.h | 21 +- .../webkit/WebCore/platform/graphics/Path.h | 25 +- .../webkit/WebCore/platform/graphics/Pattern.cpp | 20 - .../webkit/WebCore/platform/graphics/Pattern.h | 54 +- .../WebCore/platform/graphics/SimpleFontData.h | 29 +- .../platform/graphics/TypesettingFeatures.h | 38 - .../WebCore/platform/graphics/filters/FEBlend.cpp | 4 +- .../platform/graphics/filters/FEColorMatrix.cpp | 3 +- .../graphics/filters/FEComponentTransfer.cpp | 6 +- .../graphics/filters/FEComponentTransfer.h | 1 + .../platform/graphics/filters/FEComposite.cpp | 28 +- .../platform/graphics/filters/FEGaussianBlur.cpp | 10 +- .../WebCore/platform/graphics/filters/Filter.h | 15 +- .../platform/graphics/filters/FilterEffect.cpp | 8 +- .../platform/graphics/filters/FilterEffect.h | 8 - .../graphics/filters/ImageBufferFilter.cpp | 43 - .../platform/graphics/filters/ImageBufferFilter.h | 57 - .../platform/graphics/filters/SourceAlpha.cpp | 4 +- .../platform/graphics/filters/SourceGraphic.cpp | 4 +- .../graphics/opentype/OpenTypeSanitizer.cpp | 68 - .../platform/graphics/opentype/OpenTypeSanitizer.h | 57 - .../graphics/opentype/OpenTypeUtilities.cpp | 4 +- .../platform/graphics/opentype/OpenTypeUtilities.h | 2 +- .../platform/graphics/openvg/EGLDisplayOpenVG.cpp | 431 - .../platform/graphics/openvg/EGLDisplayOpenVG.h | 89 - .../WebCore/platform/graphics/openvg/EGLUtils.h | 71 - .../graphics/openvg/GraphicsContextOpenVG.cpp | 566 - .../platform/graphics/openvg/PainterOpenVG.cpp | 957 - .../platform/graphics/openvg/PainterOpenVG.h | 121 - .../platform/graphics/openvg/SurfaceOpenVG.cpp | 243 - .../platform/graphics/openvg/SurfaceOpenVG.h | 137 - .../WebCore/platform/graphics/openvg/VGUtils.cpp | 100 - .../WebCore/platform/graphics/openvg/VGUtils.h | 87 - .../WebCore/platform/graphics/qt/FontCacheQt.cpp | 250 +- .../graphics/qt/FontCustomPlatformData.cpp | 65 + .../graphics/qt/FontCustomPlatformDataQt.cpp | 65 - .../platform/graphics/qt/FontFallbackListQt.cpp | 138 + .../platform/graphics/qt/FontPlatformData.h | 120 +- .../platform/graphics/qt/FontPlatformDataQt.cpp | 111 +- .../webkit/WebCore/platform/graphics/qt/FontQt.cpp | 48 +- .../WebCore/platform/graphics/qt/FontQt43.cpp | 354 + .../platform/graphics/qt/GraphicsContextQt.cpp | 290 +- .../platform/graphics/qt/GraphicsLayerQt.cpp | 1240 - .../WebCore/platform/graphics/qt/GraphicsLayerQt.h | 85 - .../webkit/WebCore/platform/graphics/qt/IconQt.cpp | 17 +- .../WebCore/platform/graphics/qt/ImageBufferQt.cpp | 2 +- .../platform/graphics/qt/ImageDecoderQt.cpp | 39 +- .../WebCore/platform/graphics/qt/ImageDecoderQt.h | 5 +- .../WebCore/platform/graphics/qt/ImageQt.cpp | 16 +- .../graphics/qt/MediaPlayerPrivatePhonon.cpp | 25 +- .../graphics/qt/MediaPlayerPrivatePhonon.h | 4 + .../webkit/WebCore/platform/graphics/qt/PathQt.cpp | 97 +- .../WebCore/platform/graphics/qt/PatternQt.cpp | 4 +- .../WebCore/platform/graphics/qt/StillImageQt.cpp | 2 +- .../WebCore/platform/graphics/qt/StillImageQt.h | 2 +- .../graphics/qt/TransformationMatrixQt.cpp | 6 - .../graphics/transforms/AffineTransform.cpp | 364 - .../platform/graphics/transforms/AffineTransform.h | 177 - .../graphics/transforms/TransformOperations.h | 2 +- .../graphics/transforms/TransformationMatrix.cpp | 6 - .../graphics/transforms/TransformationMatrix.h | 43 +- .../WebCore/platform/graphics/win/FontCGWin.cpp | 389 - .../WebCore/platform/graphics/win/FontCacheWin.cpp | 562 - .../graphics/win/FontCustomPlatformData.cpp | 242 - .../platform/graphics/win/FontCustomPlatformData.h | 56 - .../graphics/win/FontCustomPlatformDataCairo.cpp | 61 - .../graphics/win/FontCustomPlatformDataCairo.h | 49 - .../WebCore/platform/graphics/win/FontDatabase.cpp | 217 - .../WebCore/platform/graphics/win/FontDatabase.h | 38 - .../platform/graphics/win/FontPlatformData.h | 155 - .../graphics/win/FontPlatformDataCGWin.cpp | 151 - .../graphics/win/FontPlatformDataCairoWin.cpp | 133 - .../platform/graphics/win/FontPlatformDataWin.cpp | 95 - .../WebCore/platform/graphics/win/FontWin.cpp | 105 - .../graphics/win/GlyphPageTreeNodeCGWin.cpp | 59 - .../graphics/win/GlyphPageTreeNodeCairoWin.cpp | 72 - .../platform/graphics/win/GraphicsContextCGWin.cpp | 253 - .../graphics/win/GraphicsContextCairoWin.cpp | 147 - .../platform/graphics/win/GraphicsContextWin.cpp | 211 - .../platform/graphics/win/GraphicsLayerCACF.cpp | 722 - .../platform/graphics/win/GraphicsLayerCACF.h | 144 - .../WebCore/platform/graphics/win/IconWin.cpp | 101 - .../WebCore/platform/graphics/win/ImageCGWin.cpp | 110 - .../platform/graphics/win/ImageCairoWin.cpp | 114 - .../WebCore/platform/graphics/win/ImageWin.cpp | 58 - .../WebCore/platform/graphics/win/IntPointWin.cpp | 57 - .../WebCore/platform/graphics/win/IntRectWin.cpp | 45 - .../WebCore/platform/graphics/win/IntSizeWin.cpp | 45 - .../win/MediaPlayerPrivateQuickTimeWin.cpp | 877 - .../graphics/win/MediaPlayerPrivateQuickTimeWin.h | 188 - .../WebCore/platform/graphics/win/QTMovieWin.cpp | 1178 - .../WebCore/platform/graphics/win/QTMovieWin.h | 127 - .../platform/graphics/win/QTMovieWinTimer.cpp | 137 - .../platform/graphics/win/QTMovieWinTimer.h | 39 - .../platform/graphics/win/SimpleFontDataCGWin.cpp | 146 - .../graphics/win/SimpleFontDataCairoWin.cpp | 122 - .../platform/graphics/win/SimpleFontDataWin.cpp | 213 - .../graphics/win/TransformationMatrixWin.cpp | 46 - .../platform/graphics/win/UniscribeController.cpp | 441 - .../platform/graphics/win/UniscribeController.h | 83 - .../platform/graphics/win/WKCACFContextFlusher.cpp | 88 - .../platform/graphics/win/WKCACFContextFlusher.h | 60 - .../WebCore/platform/graphics/win/WKCACFLayer.cpp | 644 - .../WebCore/platform/graphics/win/WKCACFLayer.h | 265 - .../platform/graphics/win/WKCACFLayerRenderer.cpp | 456 - .../platform/graphics/win/WKCACFLayerRenderer.h | 110 - .../platform/image-decoders/ImageDecoder.cpp | 132 +- .../WebCore/platform/image-decoders/ImageDecoder.h | 143 +- .../platform/image-decoders/qt/RGBA32BufferQt.cpp | 39 +- .../platform/image-decoders/wx/ImageDecoderWx.cpp | 83 + .../webkit/WebCore/platform/mac/ClipboardMac.h | 1 - .../webkit/WebCore/platform/mac/ClipboardMac.mm | 7 +- .../webkit/WebCore/platform/mac/CookieJar.mm | 12 - .../WebCore/platform/mac/GeolocationServiceMac.mm | 2 +- .../webkit/WebCore/platform/mac/KeyEventMac.mm | 16 - .../WebCore/platform/mac/LocalizedStringsMac.mm | 72 - .../webkit/WebCore/platform/mac/LoggingMac.mm | 2 +- .../webkit/WebCore/platform/mac/PasteboardMac.mm | 20 +- .../WebCore/platform/mac/PlatformMouseEventMac.mm | 18 - .../webkit/WebCore/platform/mac/PopupMenuMac.mm | 21 +- .../platform/mac/RuntimeApplicationChecks.h | 1 - .../platform/mac/RuntimeApplicationChecks.mm | 6 - .../webkit/WebCore/platform/mac/ScrollViewMac.mm | 15 +- .../WebCore/platform/mac/ScrollbarThemeMac.h | 2 - .../WebCore/platform/mac/ScrollbarThemeMac.mm | 4 +- .../webkit/WebCore/platform/mac/ThemeMac.mm | 46 +- .../WebCore/platform/mac/WebCoreObjCExtras.mm | 5 - .../WebCore/platform/mac/WebCoreSystemInterface.h | 15 - .../WebCore/platform/mac/WebCoreSystemInterface.mm | 13 - .../webkit/WebCore/platform/mac/WheelEventMac.mm | 8 +- .../webkit/WebCore/platform/mac/WidgetMac.mm | 11 +- .../platform/network/AuthenticationClient.h | 53 - .../webkit/WebCore/platform/network/Credential.cpp | 80 +- .../webkit/WebCore/platform/network/Credential.h | 31 +- .../WebCore/platform/network/CredentialStorage.cpp | 21 +- .../WebCore/platform/network/CredentialStorage.h | 4 - .../WebCore/platform/network/FormDataBuilder.cpp | 21 +- .../WebCore/platform/network/HTTPHeaderMap.cpp | 36 - .../WebCore/platform/network/HTTPHeaderMap.h | 16 - .../platform/network/NetworkStateNotifier.h | 8 +- .../WebCore/platform/network/ProtectionSpace.cpp | 3 +- .../WebCore/platform/network/ProtectionSpaceHash.h | 11 +- .../WebCore/platform/network/ResourceHandle.cpp | 95 +- .../WebCore/platform/network/ResourceHandle.h | 26 +- .../platform/network/ResourceHandleClient.h | 2 +- .../platform/network/ResourceHandleInternal.h | 17 +- .../platform/network/ResourceRequestBase.cpp | 14 +- .../WebCore/platform/network/ResourceRequestBase.h | 28 +- .../platform/network/ResourceResponseBase.cpp | 7 - .../platform/network/ResourceResponseBase.h | 5 +- .../platform/network/SocketStreamHandleBase.cpp | 5 +- .../platform/network/SocketStreamHandleClient.h | 5 +- .../platform/network/cf/AuthenticationCF.cpp | 266 - .../WebCore/platform/network/cf/AuthenticationCF.h | 48 - .../platform/network/cf/AuthenticationChallenge.h | 57 - .../platform/network/cf/CredentialStorageCFNet.cpp | 44 - .../WebCore/platform/network/cf/DNSCFNet.cpp | 155 - .../platform/network/cf/FormDataStreamCFNet.cpp | 384 - .../platform/network/cf/FormDataStreamCFNet.h | 44 - .../platform/network/cf/LoaderRunLoopCF.cpp | 66 - .../WebCore/platform/network/cf/LoaderRunLoopCF.h | 39 - .../WebCore/platform/network/cf/ResourceError.h | 73 - .../platform/network/cf/ResourceErrorCF.cpp | 164 - .../platform/network/cf/ResourceHandleCFNet.cpp | 783 - .../WebCore/platform/network/cf/ResourceRequest.h | 77 - .../platform/network/cf/ResourceRequestCFNet.cpp | 191 - .../platform/network/cf/ResourceRequestCFNet.h | 39 - .../WebCore/platform/network/cf/ResourceResponse.h | 81 - .../platform/network/cf/ResourceResponseCFNet.cpp | 117 - .../platform/network/cf/SocketStreamError.h | 50 - .../platform/network/cf/SocketStreamHandle.h | 112 - .../network/cf/SocketStreamHandleCFNet.cpp | 639 - .../platform/network/qt/QNetworkReplyHandler.cpp | 53 +- .../platform/network/qt/QNetworkReplyHandler.h | 5 +- .../platform/network/qt/ResourceHandleQt.cpp | 22 + .../WebCore/platform/network/qt/ResourceRequest.h | 6 +- .../platform/network/qt/ResourceRequestQt.cpp | 18 +- .../platform/network/qt/SocketStreamHandle.h | 4 - .../network/qt/SocketStreamHandlePrivate.h | 72 - .../platform/network/qt/SocketStreamHandleQt.cpp | 208 - .../platform/network/qt/SocketStreamHandleSoup.cpp | 88 + .../webkit/WebCore/platform/qt/ClipboardQt.cpp | 27 +- .../webkit/WebCore/platform/qt/ClipboardQt.h | 1 - .../webkit/WebCore/platform/qt/CookieJarQt.cpp | 42 +- .../webkit/WebCore/platform/qt/CursorQt.cpp | 2 +- .../webkit/WebCore/platform/qt/DragDataQt.cpp | 2 +- src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp | 3 +- .../webkit/WebCore/platform/qt/Localizations.cpp | 54 - .../webkit/WebCore/platform/qt/PasteboardQt.cpp | 5 +- .../platform/qt/PlatformKeyboardEventQt.cpp | 20 +- .../WebCore/platform/qt/PlatformTouchEventQt.cpp | 49 - .../WebCore/platform/qt/PlatformTouchPointQt.cpp | 45 - .../webkit/WebCore/platform/qt/PopupMenuQt.cpp | 96 +- .../webkit/WebCore/platform/qt/QWebPageClient.h | 21 - .../webkit/WebCore/platform/qt/QWebPopup.cpp | 101 + .../webkit/WebCore/platform/qt/QWebPopup.h | 49 + .../WebCore/platform/qt/QtAbstractWebPopup.cpp | 60 - .../WebCore/platform/qt/QtAbstractWebPopup.h | 69 - .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 184 +- .../webkit/WebCore/platform/qt/RenderThemeQt.h | 13 +- .../WebCore/platform/qt/ScrollbarThemeQt.cpp | 4 +- .../webkit/WebCore/platform/qt/SharedBufferQt.cpp | 2 - .../webkit/WebCore/platform/qt/WheelEventQt.cpp | 2 - .../webkit/WebCore/platform/qt/WidgetQt.cpp | 8 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.cpp | 7 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.h | 1 - .../WebCore/platform/sql/SQLiteTransaction.cpp | 28 +- .../WebCore/platform/sql/SQLiteTransaction.h | 1 - .../webkit/WebCore/platform/text/AtomicString.cpp | 18 +- .../webkit/WebCore/platform/text/AtomicString.h | 16 +- .../WebCore/platform/text/AtomicStringImpl.h | 2 + .../webkit/WebCore/platform/text/Base64.cpp | 11 +- src/3rdparty/webkit/WebCore/platform/text/Base64.h | 1 - .../webkit/WebCore/platform/text/BidiContext.cpp | 2 +- .../webkit/WebCore/platform/text/CharacterNames.h | 3 - .../webkit/WebCore/platform/text/PlatformString.h | 26 +- .../WebCore/platform/text/RegularExpression.h | 2 +- .../webkit/WebCore/platform/text/String.cpp | 11 +- .../webkit/WebCore/platform/text/StringBuilder.cpp | 13 - .../webkit/WebCore/platform/text/StringBuilder.h | 3 - .../webkit/WebCore/platform/text/StringHash.h | 20 +- .../webkit/WebCore/platform/text/StringImpl.cpp | 118 +- .../webkit/WebCore/platform/text/StringImpl.h | 162 +- .../WebCore/platform/text/TextBoundaries.cpp | 79 - .../WebCore/platform/text/TextBoundariesICU.cpp | 77 + .../WebCore/platform/text/TextBreakIterator.h | 2 - .../WebCore/platform/text/TextBreakIteratorICU.cpp | 10 - .../webkit/WebCore/platform/text/TextCodecICU.cpp | 2 +- .../webkit/WebCore/platform/text/TextEncoding.cpp | 21 +- .../platform/text/TextEncodingDetectorICU.cpp | 2 +- .../WebCore/platform/text/TextEncodingRegistry.cpp | 25 +- .../webkit/WebCore/platform/text/TextStream.cpp | 9 +- .../webkit/WebCore/platform/text/TextStream.h | 3 +- .../text/android/TextBreakIteratorInternalICU.cpp | 43 + .../webkit/WebCore/platform/text/cf/StringCF.cpp | 4 +- .../WebCore/platform/text/cf/StringImplCF.cpp | 4 +- .../WebCore/platform/text/qt/TextBoundaries.cpp | 123 + .../WebCore/platform/text/qt/TextBoundariesQt.cpp | 77 - .../platform/text/qt/TextBreakIteratorQt.cpp | 183 + .../WebCore/platform/text/qt/TextCodecQt.cpp | 2 +- .../platform/text/wince/TextBoundariesWince.cpp | 75 - .../platform/text/wince/TextBreakIteratorWince.cpp | 312 - .../webkit/WebCore/platform/win/SystemTimeWin.cpp | 2 +- src/3rdparty/webkit/WebCore/plugins/MimeType.idl | 4 +- .../webkit/WebCore/plugins/MimeTypeArray.idl | 1 + src/3rdparty/webkit/WebCore/plugins/Plugin.idl | 1 + .../webkit/WebCore/plugins/PluginArray.idl | 1 + src/3rdparty/webkit/WebCore/plugins/PluginData.h | 4 +- .../webkit/WebCore/plugins/PluginDatabase.cpp | 9 +- .../webkit/WebCore/plugins/PluginDatabase.h | 6 +- .../webkit/WebCore/plugins/PluginInfoStore.cpp | 7 +- .../WebCore/plugins/PluginMainThreadScheduler.h | 2 +- .../webkit/WebCore/plugins/PluginPackage.cpp | 10 +- .../webkit/WebCore/plugins/PluginPackage.h | 11 +- .../webkit/WebCore/plugins/PluginStream.cpp | 10 +- src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 129 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 60 +- .../webkit/WebCore/plugins/PluginViewNone.cpp | 6 +- src/3rdparty/webkit/WebCore/plugins/PluginWidget.h | 55 - .../WebCore/plugins/mac/PluginPackageMac.cpp | 6 +- .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 190 +- .../webkit/WebCore/plugins/mac/PluginWidgetMac.mm | 49 - .../webkit/WebCore/plugins/qt/PluginDataQt.cpp | 5 +- .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 4 - .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 40 +- .../plugins/symbian/PluginPackageSymbian.cpp | 5 - .../WebCore/plugins/symbian/PluginViewSymbian.cpp | 11 +- .../WebCore/plugins/win/PluginDatabaseWin.cpp | 6 +- .../WebCore/plugins/win/PluginPackageWin.cpp | 8 +- .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 80 +- .../webkit/WebCore/rendering/AutoTableLayout.cpp | 6 +- .../webkit/WebCore/rendering/AutoTableLayout.h | 2 + src/3rdparty/webkit/WebCore/rendering/BidiRun.cpp | 74 - src/3rdparty/webkit/WebCore/rendering/BidiRun.h | 65 - .../webkit/WebCore/rendering/CounterNode.cpp | 221 +- .../webkit/WebCore/rendering/CounterNode.h | 27 +- .../webkit/WebCore/rendering/EllipsisBox.cpp | 49 +- .../webkit/WebCore/rendering/EllipsisBox.h | 8 +- .../webkit/WebCore/rendering/FixedTableLayout.cpp | 2 + .../webkit/WebCore/rendering/FixedTableLayout.h | 2 + .../webkit/WebCore/rendering/HitTestRequest.h | 2 + .../webkit/WebCore/rendering/HitTestResult.h | 2 + .../webkit/WebCore/rendering/InlineFlowBox.cpp | 52 +- .../webkit/WebCore/rendering/InlineIterator.h | 266 - .../webkit/WebCore/rendering/InlineRunBox.h | 2 + .../webkit/WebCore/rendering/InlineTextBox.cpp | 115 +- .../webkit/WebCore/rendering/InlineTextBox.h | 10 +- .../WebCore/rendering/MediaControlElements.cpp | 55 +- .../WebCore/rendering/MediaControlElements.h | 13 +- .../WebCore/rendering/PointerEventsHitRules.cpp | 2 + .../WebCore/rendering/PointerEventsHitRules.h | 2 + .../webkit/WebCore/rendering/RenderArena.cpp | 2 +- .../webkit/WebCore/rendering/RenderArena.h | 3 +- src/3rdparty/webkit/WebCore/rendering/RenderBR.cpp | 4 +- src/3rdparty/webkit/WebCore/rendering/RenderBR.h | 2 + .../webkit/WebCore/rendering/RenderBlock.cpp | 283 +- .../webkit/WebCore/rendering/RenderBlock.h | 26 +- .../WebCore/rendering/RenderBlockLineLayout.cpp | 365 +- .../webkit/WebCore/rendering/RenderBox.cpp | 113 +- src/3rdparty/webkit/WebCore/rendering/RenderBox.h | 10 +- .../WebCore/rendering/RenderBoxModelObject.cpp | 210 +- .../WebCore/rendering/RenderBoxModelObject.h | 4 +- .../webkit/WebCore/rendering/RenderButton.cpp | 2 + .../webkit/WebCore/rendering/RenderButton.h | 2 + .../webkit/WebCore/rendering/RenderCounter.cpp | 378 +- .../webkit/WebCore/rendering/RenderCounter.h | 9 +- .../WebCore/rendering/RenderEmbeddedObject.cpp | 352 - .../WebCore/rendering/RenderEmbeddedObject.h | 64 - .../webkit/WebCore/rendering/RenderFieldset.cpp | 5 +- .../WebCore/rendering/RenderFileUploadControl.cpp | 37 +- .../WebCore/rendering/RenderFileUploadControl.h | 25 +- .../webkit/WebCore/rendering/RenderFlexibleBox.cpp | 50 +- .../WebCore/rendering/RenderForeignObject.cpp | 89 +- .../webkit/WebCore/rendering/RenderForeignObject.h | 32 +- .../webkit/WebCore/rendering/RenderFrame.cpp | 53 - .../webkit/WebCore/rendering/RenderFrame.h | 1 - .../webkit/WebCore/rendering/RenderFrameSet.cpp | 138 +- .../webkit/WebCore/rendering/RenderFrameSet.h | 3 - .../webkit/WebCore/rendering/RenderImage.cpp | 84 +- .../webkit/WebCore/rendering/RenderImage.h | 18 +- .../webkit/WebCore/rendering/RenderInline.cpp | 36 +- .../webkit/WebCore/rendering/RenderInline.h | 4 +- .../webkit/WebCore/rendering/RenderLayer.cpp | 337 +- .../webkit/WebCore/rendering/RenderLayer.h | 34 +- .../WebCore/rendering/RenderLayerBacking.cpp | 250 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 22 +- .../WebCore/rendering/RenderLayerCompositor.cpp | 238 +- .../WebCore/rendering/RenderLayerCompositor.h | 26 +- .../webkit/WebCore/rendering/RenderLineBoxList.cpp | 1 - .../webkit/WebCore/rendering/RenderListBox.cpp | 6 +- .../webkit/WebCore/rendering/RenderListItem.cpp | 51 +- .../webkit/WebCore/rendering/RenderListMarker.cpp | 884 +- .../webkit/WebCore/rendering/RenderListMarker.h | 1 - .../webkit/WebCore/rendering/RenderMarquee.h | 2 +- .../webkit/WebCore/rendering/RenderMedia.cpp | 51 +- .../webkit/WebCore/rendering/RenderMedia.h | 12 +- .../WebCore/rendering/RenderMediaControls.cpp | 9 - .../rendering/RenderMediaControlsChromium.cpp | 18 +- .../webkit/WebCore/rendering/RenderMenuList.cpp | 76 +- .../webkit/WebCore/rendering/RenderMenuList.h | 6 +- .../webkit/WebCore/rendering/RenderObject.cpp | 285 +- .../webkit/WebCore/rendering/RenderObject.h | 65 +- .../WebCore/rendering/RenderObjectChildList.cpp | 23 +- .../WebCore/rendering/RenderObjectChildList.h | 3 +- .../webkit/WebCore/rendering/RenderOverflow.h | 2 +- .../webkit/WebCore/rendering/RenderPart.cpp | 1 - src/3rdparty/webkit/WebCore/rendering/RenderPart.h | 4 - .../webkit/WebCore/rendering/RenderPartObject.cpp | 268 + .../webkit/WebCore/rendering/RenderPartObject.h | 4 +- .../webkit/WebCore/rendering/RenderPath.cpp | 278 +- src/3rdparty/webkit/WebCore/rendering/RenderPath.h | 24 +- .../webkit/WebCore/rendering/RenderReplaced.cpp | 2 +- .../webkit/WebCore/rendering/RenderReplaced.h | 2 +- .../webkit/WebCore/rendering/RenderReplica.cpp | 2 +- .../webkit/WebCore/rendering/RenderReplica.h | 4 - .../webkit/WebCore/rendering/RenderRuby.cpp | 197 - src/3rdparty/webkit/WebCore/rendering/RenderRuby.h | 91 - .../webkit/WebCore/rendering/RenderRubyBase.cpp | 190 - .../webkit/WebCore/rendering/RenderRubyBase.h | 67 - .../webkit/WebCore/rendering/RenderRubyRun.cpp | 228 - .../webkit/WebCore/rendering/RenderRubyRun.h | 85 - .../webkit/WebCore/rendering/RenderRubyText.cpp | 54 - .../webkit/WebCore/rendering/RenderRubyText.h | 56 - .../webkit/WebCore/rendering/RenderSVGBlock.cpp | 32 +- .../webkit/WebCore/rendering/RenderSVGBlock.h | 11 +- .../WebCore/rendering/RenderSVGContainer.cpp | 59 +- .../webkit/WebCore/rendering/RenderSVGContainer.h | 11 +- .../WebCore/rendering/RenderSVGGradientStop.cpp | 2 +- .../WebCore/rendering/RenderSVGHiddenContainer.cpp | 12 +- .../WebCore/rendering/RenderSVGHiddenContainer.h | 3 + .../webkit/WebCore/rendering/RenderSVGImage.cpp | 132 +- .../webkit/WebCore/rendering/RenderSVGImage.h | 65 +- .../webkit/WebCore/rendering/RenderSVGInline.h | 5 - .../webkit/WebCore/rendering/RenderSVGInlineText.h | 4 - .../WebCore/rendering/RenderSVGModelObject.cpp | 10 +- .../WebCore/rendering/RenderSVGModelObject.h | 4 - .../webkit/WebCore/rendering/RenderSVGResource.h | 84 - .../WebCore/rendering/RenderSVGResourceMasker.cpp | 196 - .../WebCore/rendering/RenderSVGResourceMasker.h | 79 - .../webkit/WebCore/rendering/RenderSVGRoot.cpp | 145 +- .../webkit/WebCore/rendering/RenderSVGRoot.h | 23 +- .../rendering/RenderSVGShadowTreeRootContainer.cpp | 101 - .../rendering/RenderSVGShadowTreeRootContainer.h | 50 - .../webkit/WebCore/rendering/RenderSVGText.cpp | 38 +- .../webkit/WebCore/rendering/RenderSVGText.h | 13 +- .../rendering/RenderSVGTransformableContainer.cpp | 18 +- .../rendering/RenderSVGTransformableContainer.h | 6 +- .../rendering/RenderSVGViewportContainer.cpp | 63 +- .../WebCore/rendering/RenderSVGViewportContainer.h | 18 +- .../WebCore/rendering/RenderScrollbarTheme.cpp | 2 +- .../webkit/WebCore/rendering/RenderSelectionInfo.h | 2 +- .../webkit/WebCore/rendering/RenderSlider.cpp | 37 +- .../webkit/WebCore/rendering/RenderTable.cpp | 3 - .../webkit/WebCore/rendering/RenderTableCell.cpp | 48 +- .../webkit/WebCore/rendering/RenderTableCell.h | 6 +- .../webkit/WebCore/rendering/RenderTableRow.cpp | 2 + .../WebCore/rendering/RenderTableSection.cpp | 21 +- .../webkit/WebCore/rendering/RenderText.cpp | 71 +- src/3rdparty/webkit/WebCore/rendering/RenderText.h | 3 +- .../webkit/WebCore/rendering/RenderTextControl.cpp | 99 +- .../webkit/WebCore/rendering/RenderTextControl.h | 18 +- .../rendering/RenderTextControlMultiLine.cpp | 17 +- .../WebCore/rendering/RenderTextControlMultiLine.h | 1 - .../rendering/RenderTextControlSingleLine.cpp | 38 +- .../rendering/RenderTextControlSingleLine.h | 1 - .../webkit/WebCore/rendering/RenderTheme.cpp | 61 +- .../webkit/WebCore/rendering/RenderTheme.h | 11 - .../WebCore/rendering/RenderThemeChromiumLinux.cpp | 56 +- .../WebCore/rendering/RenderThemeChromiumLinux.h | 30 +- .../WebCore/rendering/RenderThemeChromiumMac.h | 1 + .../WebCore/rendering/RenderThemeChromiumMac.mm | 103 +- .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 43 +- .../WebCore/rendering/RenderThemeChromiumSkia.h | 2 - .../WebCore/rendering/RenderThemeChromiumWin.cpp | 2 +- .../WebCore/rendering/RenderThemeChromiumWin.h | 2 +- .../webkit/WebCore/rendering/RenderThemeMac.h | 1 - .../webkit/WebCore/rendering/RenderThemeSafari.cpp | 8 +- .../webkit/WebCore/rendering/RenderThemeWin.cpp | 29 +- .../webkit/WebCore/rendering/RenderThemeWin.h | 2 - .../webkit/WebCore/rendering/RenderThemeWince.cpp | 23 +- .../webkit/WebCore/rendering/RenderTreeAsText.cpp | 123 +- .../webkit/WebCore/rendering/RenderTreeAsText.h | 11 +- .../webkit/WebCore/rendering/RenderVideo.cpp | 166 +- .../webkit/WebCore/rendering/RenderVideo.h | 21 +- .../webkit/WebCore/rendering/RenderView.cpp | 29 +- src/3rdparty/webkit/WebCore/rendering/RenderView.h | 11 +- .../webkit/WebCore/rendering/RenderWidget.cpp | 181 +- .../webkit/WebCore/rendering/RenderWidget.h | 5 +- .../webkit/WebCore/rendering/RootInlineBox.cpp | 1 - .../webkit/WebCore/rendering/RootInlineBox.h | 2 + .../WebCore/rendering/SVGCharacterLayoutInfo.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.h | 54 +- .../webkit/WebCore/rendering/SVGInlineTextBox.cpp | 105 +- .../webkit/WebCore/rendering/SVGInlineTextBox.h | 21 +- .../webkit/WebCore/rendering/SVGMarkerData.h | 134 - .../WebCore/rendering/SVGMarkerLayoutInfo.cpp | 124 - .../webkit/WebCore/rendering/SVGMarkerLayoutInfo.h | 74 - .../webkit/WebCore/rendering/SVGRenderSupport.cpp | 133 +- .../webkit/WebCore/rendering/SVGRenderSupport.h | 77 +- .../WebCore/rendering/SVGRenderTreeAsText.cpp | 78 +- .../webkit/WebCore/rendering/SVGRenderTreeAsText.h | 7 +- .../webkit/WebCore/rendering/SVGRootInlineBox.cpp | 178 +- .../webkit/WebCore/rendering/SVGRootInlineBox.h | 7 +- .../WebCore/rendering/SVGShadowTreeElements.cpp | 80 - .../WebCore/rendering/SVGShadowTreeElements.h | 67 - .../webkit/WebCore/rendering/TableLayout.h | 6 +- .../rendering/TrailingFloatsRootInlineBox.h | 48 - .../webkit/WebCore/rendering/TransformState.cpp | 8 +- .../webkit/WebCore/rendering/TransformState.h | 2 - .../webkit/WebCore/rendering/break_lines.cpp | 62 +- .../webkit/WebCore/rendering/break_lines.h | 2 + .../webkit/WebCore/rendering/style/ContentData.h | 6 +- .../WebCore/rendering/style/CounterContent.h | 2 +- .../webkit/WebCore/rendering/style/FillLayer.cpp | 11 - .../webkit/WebCore/rendering/style/FillLayer.h | 3 +- .../WebCore/rendering/style/LineClampValue.h | 69 - .../webkit/WebCore/rendering/style/RenderStyle.cpp | 11 +- .../webkit/WebCore/rendering/style/RenderStyle.h | 68 +- .../WebCore/rendering/style/RenderStyleConstants.h | 99 +- .../WebCore/rendering/style/SVGRenderStyle.cpp | 55 +- .../WebCore/rendering/style/SVGRenderStyle.h | 342 +- .../WebCore/rendering/style/SVGRenderStyleDefs.cpp | 2 + .../WebCore/rendering/style/SVGRenderStyleDefs.h | 2 + .../webkit/WebCore/rendering/style/ShadowData.h | 3 +- .../WebCore/rendering/style/StyleInheritedData.cpp | 5 +- .../WebCore/rendering/style/StyleInheritedData.h | 1 + .../rendering/style/StyleRareInheritedData.cpp | 5 +- .../rendering/style/StyleRareInheritedData.h | 1 - .../rendering/style/StyleRareNonInheritedData.h | 3 +- src/3rdparty/webkit/WebCore/storage/Database.cpp | 301 +- src/3rdparty/webkit/WebCore/storage/Database.h | 20 +- src/3rdparty/webkit/WebCore/storage/Database.idl | 3 +- .../webkit/WebCore/storage/DatabaseAuthorizer.cpp | 88 +- .../webkit/WebCore/storage/DatabaseAuthorizer.h | 5 - .../webkit/WebCore/storage/DatabaseTask.cpp | 76 +- src/3rdparty/webkit/WebCore/storage/DatabaseTask.h | 78 +- .../webkit/WebCore/storage/DatabaseThread.cpp | 25 +- .../webkit/WebCore/storage/DatabaseThread.h | 11 +- .../webkit/WebCore/storage/DatabaseTracker.cpp | 34 +- .../webkit/WebCore/storage/DatabaseTracker.h | 65 +- .../webkit/WebCore/storage/IDBDatabaseError.h | 64 - .../webkit/WebCore/storage/IDBDatabaseError.idl | 37 - .../webkit/WebCore/storage/IDBDatabaseException.h | 64 - .../WebCore/storage/IDBDatabaseException.idl | 48 - src/3rdparty/webkit/WebCore/storage/IDBRequest.cpp | 64 - src/3rdparty/webkit/WebCore/storage/IDBRequest.h | 88 - src/3rdparty/webkit/WebCore/storage/IDBRequest.idl | 45 - .../WebCore/storage/IndexedDatabaseRequest.cpp | 53 - .../WebCore/storage/IndexedDatabaseRequest.h | 65 - .../WebCore/storage/IndexedDatabaseRequest.idl | 38 - .../webkit/WebCore/storage/LocalStorageTask.h | 11 +- .../webkit/WebCore/storage/LocalStorageThread.cpp | 74 +- .../webkit/WebCore/storage/LocalStorageThread.h | 28 +- .../webkit/WebCore/storage/OriginUsageRecord.cpp | 6 +- .../webkit/WebCore/storage/OriginUsageRecord.h | 2 +- src/3rdparty/webkit/WebCore/storage/SQLError.idl | 3 +- .../webkit/WebCore/storage/SQLResultSet.idl | 3 +- .../webkit/WebCore/storage/SQLResultSetRowList.idl | 3 +- .../webkit/WebCore/storage/SQLTransaction.cpp | 24 +- .../webkit/WebCore/storage/SQLTransaction.h | 1 - .../webkit/WebCore/storage/SQLTransaction.idl | 3 +- .../WebCore/storage/SQLTransactionClient.cpp | 15 +- .../webkit/WebCore/storage/SQLTransactionClient.h | 8 +- .../WebCore/storage/SQLTransactionCoordinator.cpp | 20 +- .../WebCore/storage/SQLTransactionCoordinator.h | 6 +- src/3rdparty/webkit/WebCore/storage/Storage.idl | 1 + src/3rdparty/webkit/WebCore/storage/StorageArea.h | 6 +- .../webkit/WebCore/storage/StorageAreaImpl.cpp | 58 +- .../webkit/WebCore/storage/StorageAreaImpl.h | 9 +- .../webkit/WebCore/storage/StorageAreaSync.cpp | 32 +- .../webkit/WebCore/storage/StorageAreaSync.h | 8 +- .../webkit/WebCore/storage/StorageEvent.cpp | 2 +- .../webkit/WebCore/storage/StorageEvent.idl | 3 +- .../WebCore/storage/StorageEventDispatcher.cpp | 8 +- src/3rdparty/webkit/WebCore/storage/StorageMap.cpp | 34 +- .../webkit/WebCore/storage/StorageNamespace.cpp | 3 +- .../webkit/WebCore/storage/StorageNamespace.h | 31 +- .../webkit/WebCore/storage/StorageSyncManager.cpp | 20 +- .../webkit/WebCore/storage/StorageSyncManager.h | 6 +- .../webkit/WebCore/svg/ElementTimeControl.idl | 2 +- .../webkit/WebCore/svg/GradientAttributes.h | 8 +- .../webkit/WebCore/svg/LinearGradientAttributes.h | 2 + .../webkit/WebCore/svg/PatternAttributes.h | 8 +- .../webkit/WebCore/svg/RadialGradientAttributes.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGAElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp | 13 +- .../webkit/WebCore/svg/SVGAltGlyphElement.cpp | 9 +- .../webkit/WebCore/svg/SVGAltGlyphElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGAngle.h | 16 +- src/3rdparty/webkit/WebCore/svg/SVGAngle.idl | 4 +- .../webkit/WebCore/svg/SVGAnimateColorElement.cpp | 2 + .../webkit/WebCore/svg/SVGAnimateColorElement.h | 2 + .../webkit/WebCore/svg/SVGAnimateElement.cpp | 4 +- .../webkit/WebCore/svg/SVGAnimateElement.h | 2 + .../webkit/WebCore/svg/SVGAnimateMotionElement.cpp | 14 +- .../webkit/WebCore/svg/SVGAnimateMotionElement.h | 5 +- .../WebCore/svg/SVGAnimateTransformElement.cpp | 12 +- .../WebCore/svg/SVGAnimateTransformElement.h | 48 +- .../webkit/WebCore/svg/SVGAnimatedPathData.cpp | 2 + .../webkit/WebCore/svg/SVGAnimatedPathData.h | 2 + .../webkit/WebCore/svg/SVGAnimatedPathData.idl | 2 +- .../webkit/WebCore/svg/SVGAnimatedPoints.cpp | 2 + .../webkit/WebCore/svg/SVGAnimatedPoints.h | 2 + .../webkit/WebCore/svg/SVGAnimatedPoints.idl | 2 +- .../webkit/WebCore/svg/SVGAnimatedProperty.h | 597 +- .../WebCore/svg/SVGAnimatedPropertySynchronizer.h | 96 - .../webkit/WebCore/svg/SVGAnimatedPropertyTraits.h | 186 - .../webkit/WebCore/svg/SVGAnimatedTemplate.h | 133 +- .../webkit/WebCore/svg/SVGAnimationElement.cpp | 23 +- .../webkit/WebCore/svg/SVGAnimationElement.h | 7 +- .../webkit/WebCore/svg/SVGAnimationElement.idl | 2 +- .../webkit/WebCore/svg/SVGCircleElement.cpp | 31 +- src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h | 11 +- .../webkit/WebCore/svg/SVGClipPathElement.cpp | 51 +- .../webkit/WebCore/svg/SVGClipPathElement.h | 12 +- src/3rdparty/webkit/WebCore/svg/SVGColor.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGColor.idl | 4 +- .../svg/SVGComponentTransferFunctionElement.cpp | 52 +- .../svg/SVGComponentTransferFunctionElement.h | 21 +- .../svg/SVGComponentTransferFunctionElement.idl | 2 +- .../webkit/WebCore/svg/SVGCursorElement.cpp | 30 +- src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h | 5 +- src/3rdparty/webkit/WebCore/svg/SVGDescElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGDescElement.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGDocument.cpp | 2 +- src/3rdparty/webkit/WebCore/svg/SVGDocument.idl | 2 + .../webkit/WebCore/svg/SVGDocumentExtensions.cpp | 12 - .../webkit/WebCore/svg/SVGDocumentExtensions.h | 60 +- src/3rdparty/webkit/WebCore/svg/SVGElement.cpp | 100 +- src/3rdparty/webkit/WebCore/svg/SVGElement.h | 50 +- src/3rdparty/webkit/WebCore/svg/SVGElement.idl | 2 + .../webkit/WebCore/svg/SVGElementInstance.cpp | 79 +- .../webkit/WebCore/svg/SVGElementInstance.h | 6 + .../webkit/WebCore/svg/SVGElementInstanceList.cpp | 2 + .../webkit/WebCore/svg/SVGElementInstanceList.h | 2 + .../webkit/WebCore/svg/SVGElementRareData.h | 78 - .../webkit/WebCore/svg/SVGEllipseElement.cpp | 36 +- .../webkit/WebCore/svg/SVGEllipseElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGException.idl | 3 +- .../WebCore/svg/SVGExternalResourcesRequired.cpp | 4 + .../WebCore/svg/SVGExternalResourcesRequired.h | 3 +- .../WebCore/svg/SVGExternalResourcesRequired.idl | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.cpp | 25 +- .../webkit/WebCore/svg/SVGFEBlendElement.h | 9 +- .../webkit/WebCore/svg/SVGFEBlendElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.cpp | 26 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.h | 9 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.idl | 2 +- .../WebCore/svg/SVGFEComponentTransferElement.cpp | 11 +- .../WebCore/svg/SVGFEComponentTransferElement.h | 5 +- .../webkit/WebCore/svg/SVGFECompositeElement.cpp | 44 +- .../webkit/WebCore/svg/SVGFECompositeElement.h | 17 +- .../webkit/WebCore/svg/SVGFECompositeElement.idl | 2 +- .../WebCore/svg/SVGFEDiffuseLightingElement.cpp | 40 +- .../WebCore/svg/SVGFEDiffuseLightingElement.h | 13 +- .../WebCore/svg/SVGFEDisplacementMapElement.cpp | 32 +- .../WebCore/svg/SVGFEDisplacementMapElement.h | 11 +- .../WebCore/svg/SVGFEDisplacementMapElement.idl | 2 +- .../WebCore/svg/SVGFEDistantLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEDistantLightElement.h | 2 +- .../webkit/WebCore/svg/SVGFEFloodElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEFloodElement.h | 2 + .../webkit/WebCore/svg/SVGFEFloodElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEFuncAElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEFuncAElement.h | 2 + .../webkit/WebCore/svg/SVGFEFuncBElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEFuncBElement.h | 2 + .../webkit/WebCore/svg/SVGFEFuncGElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEFuncGElement.h | 2 + .../webkit/WebCore/svg/SVGFEFuncRElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEFuncRElement.h | 2 + .../WebCore/svg/SVGFEGaussianBlurElement.cpp | 23 +- .../webkit/WebCore/svg/SVGFEGaussianBlurElement.h | 9 +- .../webkit/WebCore/svg/SVGFEImageElement.cpp | 79 +- .../webkit/WebCore/svg/SVGFEImageElement.h | 19 +- .../webkit/WebCore/svg/SVGFEImageElement.idl | 9 +- .../webkit/WebCore/svg/SVGFELightElement.cpp | 55 +- .../webkit/WebCore/svg/SVGFELightElement.h | 25 +- .../webkit/WebCore/svg/SVGFEMergeElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEMergeElement.h | 2 + .../webkit/WebCore/svg/SVGFEMergeNodeElement.cpp | 11 +- .../webkit/WebCore/svg/SVGFEMergeNodeElement.h | 3 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.cpp | 27 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.h | 9 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEOffsetElement.cpp | 24 +- .../webkit/WebCore/svg/SVGFEOffsetElement.h | 9 +- .../webkit/WebCore/svg/SVGFEPointLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEPointLightElement.h | 2 +- .../WebCore/svg/SVGFESpecularLightingElement.cpp | 45 +- .../WebCore/svg/SVGFESpecularLightingElement.h | 19 +- .../webkit/WebCore/svg/SVGFESpotLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFESpotLightElement.h | 2 +- .../webkit/WebCore/svg/SVGFETileElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGFETileElement.h | 5 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.cpp | 38 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.h | 15 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.idl | 2 +- .../webkit/WebCore/svg/SVGFilterElement.cpp | 93 +- src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h | 29 +- .../svg/SVGFilterPrimitiveStandardAttributes.cpp | 38 +- .../svg/SVGFilterPrimitiveStandardAttributes.h | 13 +- .../webkit/WebCore/svg/SVGFitToViewBox.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h | 29 +- .../webkit/WebCore/svg/SVGFitToViewBox.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGFont.cpp | 9 +- src/3rdparty/webkit/WebCore/svg/SVGFontData.h | 2 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp | 9 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.h | 5 +- .../webkit/WebCore/svg/SVGFontFaceElement.cpp | 9 +- .../webkit/WebCore/svg/SVGFontFaceUriElement.cpp | 8 +- .../webkit/WebCore/svg/SVGForeignObjectElement.cpp | 115 +- .../webkit/WebCore/svg/SVGForeignObjectElement.h | 15 +- src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGGElement.h | 9 +- .../webkit/WebCore/svg/SVGGlyphElement.cpp | 4 +- .../webkit/WebCore/svg/SVGGradientElement.cpp | 38 +- .../webkit/WebCore/svg/SVGGradientElement.h | 18 +- .../webkit/WebCore/svg/SVGGradientElement.idl | 2 +- .../webkit/WebCore/svg/SVGHKernElement.cpp | 4 +- .../webkit/WebCore/svg/SVGHKernElement.idl | 2 + .../webkit/WebCore/svg/SVGImageElement.cpp | 50 +- src/3rdparty/webkit/WebCore/svg/SVGImageElement.h | 17 +- src/3rdparty/webkit/WebCore/svg/SVGLangSpace.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGLangSpace.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGLangSpace.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGLength.cpp | 18 +- src/3rdparty/webkit/WebCore/svg/SVGLength.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGLength.idl | 4 +- src/3rdparty/webkit/WebCore/svg/SVGLengthList.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGLengthList.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp | 36 +- src/3rdparty/webkit/WebCore/svg/SVGLineElement.h | 13 +- .../WebCore/svg/SVGLinearGradientElement.cpp | 30 +- .../webkit/WebCore/svg/SVGLinearGradientElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGList.h | 31 +- src/3rdparty/webkit/WebCore/svg/SVGListTraits.h | 28 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.cpp | 20 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.h | 44 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.idl | 2 +- .../webkit/WebCore/svg/SVGMPathElement.cpp | 18 +- src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h | 7 +- .../webkit/WebCore/svg/SVGMarkerElement.cpp | 91 +- src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h | 32 +- .../webkit/WebCore/svg/SVGMarkerElement.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp | 155 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h | 32 +- src/3rdparty/webkit/WebCore/svg/SVGMatrix.idl | 8 +- .../webkit/WebCore/svg/SVGMetadataElement.cpp | 2 + .../webkit/WebCore/svg/SVGMetadataElement.h | 2 + .../webkit/WebCore/svg/SVGMetadataElement.idl | 2 + src/3rdparty/webkit/WebCore/svg/SVGNumber.idl | 2 + src/3rdparty/webkit/WebCore/svg/SVGNumberList.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGNumberList.h | 4 +- src/3rdparty/webkit/WebCore/svg/SVGPaint.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGPaint.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.idl | 3 +- src/3rdparty/webkit/WebCore/svg/SVGPathSeg.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.h | 2 + .../webkit/WebCore/svg/SVGPathSegClosePath.cpp | 2 + .../webkit/WebCore/svg/SVGPathSegClosePath.h | 2 + .../webkit/WebCore/svg/SVGPathSegCurvetoCubic.cpp | 2 + .../webkit/WebCore/svg/SVGPathSegCurvetoCubic.h | 2 + .../WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp | 2 + .../WebCore/svg/SVGPathSegCurvetoCubicSmooth.h | 2 + .../WebCore/svg/SVGPathSegCurvetoQuadratic.cpp | 2 + .../WebCore/svg/SVGPathSegCurvetoQuadratic.h | 2 + .../svg/SVGPathSegCurvetoQuadraticSmooth.cpp | 2 + .../WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h | 2 + .../webkit/WebCore/svg/SVGPathSegLineto.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGPathSegLineto.h | 2 + .../WebCore/svg/SVGPathSegLinetoHorizontal.cpp | 2 + .../WebCore/svg/SVGPathSegLinetoHorizontal.h | 2 + .../WebCore/svg/SVGPathSegLinetoVertical.cpp | 2 + .../webkit/WebCore/svg/SVGPathSegLinetoVertical.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGPathSegList.cpp | 17 +- src/3rdparty/webkit/WebCore/svg/SVGPathSegList.h | 2 +- .../webkit/WebCore/svg/SVGPathSegMoveto.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGPathSegMoveto.h | 2 + .../webkit/WebCore/svg/SVGPatternElement.cpp | 75 +- .../webkit/WebCore/svg/SVGPatternElement.h | 28 +- src/3rdparty/webkit/WebCore/svg/SVGPoint.idl | 2 + src/3rdparty/webkit/WebCore/svg/SVGPointList.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGPointList.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGPointList.idl | 14 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp | 46 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h | 7 +- .../webkit/WebCore/svg/SVGPolygonElement.cpp | 2 + .../webkit/WebCore/svg/SVGPolygonElement.h | 2 + .../webkit/WebCore/svg/SVGPolylineElement.cpp | 2 + .../webkit/WebCore/svg/SVGPolylineElement.h | 2 + .../webkit/WebCore/svg/SVGPreserveAspectRatio.cpp | 131 +- .../webkit/WebCore/svg/SVGPreserveAspectRatio.h | 39 +- .../webkit/WebCore/svg/SVGPreserveAspectRatio.idl | 2 +- .../WebCore/svg/SVGRadialGradientElement.cpp | 57 +- .../webkit/WebCore/svg/SVGRadialGradientElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGRect.idl | 2 + src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp | 46 +- src/3rdparty/webkit/WebCore/svg/SVGRectElement.h | 17 +- .../webkit/WebCore/svg/SVGRenderingIntent.h | 2 + .../webkit/WebCore/svg/SVGRenderingIntent.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp | 114 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h | 37 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.idl | 2 + .../webkit/WebCore/svg/SVGScriptElement.cpp | 20 +- src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h | 7 +- src/3rdparty/webkit/WebCore/svg/SVGSetElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGSetElement.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGStopElement.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGStopElement.h | 4 +- src/3rdparty/webkit/WebCore/svg/SVGStringList.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGStringList.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGStylable.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGStylable.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGStylable.idl | 2 +- .../webkit/WebCore/svg/SVGStyleElement.cpp | 16 +- src/3rdparty/webkit/WebCore/svg/SVGStyleElement.h | 2 + .../webkit/WebCore/svg/SVGStyledElement.cpp | 109 +- src/3rdparty/webkit/WebCore/svg/SVGStyledElement.h | 31 +- .../WebCore/svg/SVGStyledLocatableElement.cpp | 8 +- .../webkit/WebCore/svg/SVGStyledLocatableElement.h | 6 +- .../WebCore/svg/SVGStyledTransformableElement.cpp | 40 +- .../WebCore/svg/SVGStyledTransformableElement.h | 76 +- .../webkit/WebCore/svg/SVGSwitchElement.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h | 5 +- .../webkit/WebCore/svg/SVGSymbolElement.cpp | 34 +- src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp | 27 +- src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h | 4 +- .../webkit/WebCore/svg/SVGTSpanElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGTSpanElement.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGTests.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGTests.idl | 2 +- .../webkit/WebCore/svg/SVGTextContentElement.cpp | 28 +- .../webkit/WebCore/svg/SVGTextContentElement.h | 11 +- .../webkit/WebCore/svg/SVGTextContentElement.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGTextElement.cpp | 49 +- src/3rdparty/webkit/WebCore/svg/SVGTextElement.h | 16 +- .../webkit/WebCore/svg/SVGTextPathElement.cpp | 35 +- .../webkit/WebCore/svg/SVGTextPathElement.h | 9 +- .../webkit/WebCore/svg/SVGTextPathElement.idl | 2 +- .../WebCore/svg/SVGTextPositioningElement.cpp | 51 +- .../webkit/WebCore/svg/SVGTextPositioningElement.h | 16 +- .../webkit/WebCore/svg/SVGTitleElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGTransform.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGTransform.h | 18 +- src/3rdparty/webkit/WebCore/svg/SVGTransform.idl | 4 +- .../webkit/WebCore/svg/SVGTransformDistance.cpp | 12 +- .../webkit/WebCore/svg/SVGTransformDistance.h | 48 +- .../webkit/WebCore/svg/SVGTransformList.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGTransformList.h | 4 +- .../webkit/WebCore/svg/SVGTransformList.idl | 14 +- .../webkit/WebCore/svg/SVGTransformable.cpp | 28 +- src/3rdparty/webkit/WebCore/svg/SVGTransformable.h | 47 +- .../webkit/WebCore/svg/SVGTransformable.idl | 2 +- .../webkit/WebCore/svg/SVGURIReference.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGURIReference.h | 5 +- .../webkit/WebCore/svg/SVGURIReference.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.h | 10 +- src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp | 514 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.h | 50 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.h | 2 + src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGZoomEvent.cpp | 2 + .../svg/SynchronizablePropertyController.cpp | 145 + .../WebCore/svg/SynchronizablePropertyController.h | 84 + .../webkit/WebCore/svg/SynchronizableTypeWrapper.h | 180 + .../WebCore/svg/animation/SMILTimeContainer.cpp | 36 +- .../WebCore/svg/animation/SMILTimeContainer.h | 8 +- .../webkit/WebCore/svg/graphics/SVGImage.cpp | 11 +- .../webkit/WebCore/svg/graphics/SVGImage.h | 2 +- .../webkit/WebCore/svg/graphics/SVGPaintServer.cpp | 15 +- .../webkit/WebCore/svg/graphics/SVGPaintServer.h | 9 +- .../svg/graphics/SVGPaintServerGradient.cpp | 96 +- .../WebCore/svg/graphics/SVGPaintServerGradient.h | 10 +- .../WebCore/svg/graphics/SVGPaintServerPattern.cpp | 28 +- .../WebCore/svg/graphics/SVGPaintServerPattern.h | 10 +- .../WebCore/svg/graphics/SVGPaintServerSolid.cpp | 8 +- .../WebCore/svg/graphics/SVGPaintServerSolid.h | 2 +- .../webkit/WebCore/svg/graphics/SVGResource.cpp | 93 +- .../webkit/WebCore/svg/graphics/SVGResource.h | 7 +- .../WebCore/svg/graphics/SVGResourceClipper.cpp | 39 +- .../WebCore/svg/graphics/SVGResourceClipper.h | 13 +- .../WebCore/svg/graphics/SVGResourceFilter.cpp | 96 +- .../WebCore/svg/graphics/SVGResourceFilter.h | 18 +- .../WebCore/svg/graphics/SVGResourceMarker.cpp | 73 +- .../WebCore/svg/graphics/SVGResourceMarker.h | 27 +- .../WebCore/svg/graphics/SVGResourceMasker.cpp | 118 + .../WebCore/svg/graphics/SVGResourceMasker.h | 73 + .../svg/graphics/filters/SVGDistantLightSource.h | 16 +- .../svg/graphics/filters/SVGFEDiffuseLighting.cpp | 6 +- .../svg/graphics/filters/SVGFEDiffuseLighting.h | 6 +- .../svg/graphics/filters/SVGFEDisplacementMap.cpp | 54 +- .../WebCore/svg/graphics/filters/SVGFEFlood.cpp | 2 +- .../WebCore/svg/graphics/filters/SVGFEImage.cpp | 47 +- .../WebCore/svg/graphics/filters/SVGFEImage.h | 22 +- .../WebCore/svg/graphics/filters/SVGFEMerge.cpp | 12 +- .../WebCore/svg/graphics/filters/SVGFEMerge.h | 10 +- .../svg/graphics/filters/SVGFEMorphology.cpp | 80 +- .../WebCore/svg/graphics/filters/SVGFEOffset.cpp | 21 +- .../svg/graphics/filters/SVGFESpecularLighting.cpp | 6 +- .../svg/graphics/filters/SVGFESpecularLighting.h | 6 +- .../WebCore/svg/graphics/filters/SVGFETile.cpp | 21 +- .../WebCore/svg/graphics/filters/SVGFilter.cpp | 5 +- .../WebCore/svg/graphics/filters/SVGFilter.h | 12 +- .../svg/graphics/filters/SVGFilterBuilder.cpp | 4 +- .../WebCore/svg/graphics/filters/SVGLightSource.h | 1 - .../svg/graphics/filters/SVGPointLightSource.h | 14 +- .../svg/graphics/filters/SVGSpotLightSource.h | 22 +- src/3rdparty/webkit/WebCore/svg/svgattrs.in | 1 + src/3rdparty/webkit/WebCore/svg/svgtags.in | 3 +- src/3rdparty/webkit/WebCore/svg/xlinkattrs.in | 1 + .../websockets/ThreadableWebSocketChannel.cpp | 74 - .../websockets/ThreadableWebSocketChannel.h | 69 - .../ThreadableWebSocketChannelClientWrapper.h | 127 - .../webkit/WebCore/websockets/WebSocket.cpp | 118 +- src/3rdparty/webkit/WebCore/websockets/WebSocket.h | 25 +- .../webkit/WebCore/websockets/WebSocket.idl | 1 - .../webkit/WebCore/websockets/WebSocketChannel.cpp | 74 +- .../webkit/WebCore/websockets/WebSocketChannel.h | 30 +- .../WebCore/websockets/WebSocketChannelClient.h | 8 +- .../WebCore/websockets/WebSocketHandshake.cpp | 76 +- .../webkit/WebCore/websockets/WebSocketHandshake.h | 6 +- .../WorkerThreadableWebSocketChannel.cpp | 362 - .../websockets/WorkerThreadableWebSocketChannel.h | 155 - src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp | 4 +- src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp | 2 +- src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp | 3 +- src/3rdparty/webkit/WebCore/wml/WMLElement.cpp | 2 +- .../webkit/WebCore/wml/WMLInputElement.cpp | 20 +- src/3rdparty/webkit/WebCore/wml/WMLInputElement.h | 4 +- src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp | 1 - src/3rdparty/webkit/WebCore/wml/WMLPageState.h | 1 - .../webkit/WebCore/wml/WMLSelectElement.cpp | 1 + .../webkit/WebCore/workers/AbstractWorker.idl | 3 +- .../WebCore/workers/DedicatedWorkerContext.idl | 3 +- .../workers/DefaultSharedWorkerRepository.cpp | 31 +- .../webkit/WebCore/workers/GenericWorkerTask.h | 48 +- .../webkit/WebCore/workers/SharedWorker.idl | 1 - .../webkit/WebCore/workers/SharedWorkerContext.idl | 3 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 1 - .../webkit/WebCore/workers/WorkerContext.cpp | 24 +- .../webkit/WebCore/workers/WorkerContext.h | 20 +- .../webkit/WebCore/workers/WorkerContext.idl | 6 +- .../webkit/WebCore/workers/WorkerLoaderProxy.h | 6 +- .../webkit/WebCore/workers/WorkerLocation.idl | 1 + .../WebCore/workers/WorkerMessagingProxy.cpp | 30 +- .../webkit/WebCore/workers/WorkerMessagingProxy.h | 6 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 59 +- .../webkit/WebCore/workers/WorkerRunLoop.h | 24 +- .../WebCore/workers/WorkerScriptLoaderClient.h | 4 +- .../webkit/WebCore/workers/WorkerThread.cpp | 65 +- src/3rdparty/webkit/WebCore/xml/DOMParser.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 22 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 6 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl | 1 - .../webkit/WebCore/xml/XMLHttpRequestException.idl | 1 + .../WebCore/xml/XMLHttpRequestProgressEvent.idl | 1 + .../webkit/WebCore/xml/XMLHttpRequestUpload.idl | 1 + src/3rdparty/webkit/WebCore/xml/XMLSerializer.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathEvaluator.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathException.idl | 1 + .../webkit/WebCore/xml/XPathExpression.idl | 3 +- .../webkit/WebCore/xml/XPathExpressionNode.h | 2 +- .../webkit/WebCore/xml/XPathNSResolver.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathNodeSet.h | 2 +- src/3rdparty/webkit/WebCore/xml/XPathResult.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathStep.cpp | 15 +- src/3rdparty/webkit/WebCore/xml/XPathStep.h | 2 +- src/3rdparty/webkit/WebCore/xml/XSLImportRule.cpp | 14 +- src/3rdparty/webkit/WebCore/xml/XSLImportRule.h | 2 +- src/3rdparty/webkit/WebCore/xml/XSLStyleSheet.h | 16 +- .../webkit/WebCore/xml/XSLStyleSheetLibxslt.cpp | 12 +- .../webkit/WebCore/xml/XSLStyleSheetQt.cpp | 4 +- src/3rdparty/webkit/WebCore/xml/XSLTProcessor.idl | 3 +- .../webkit/WebCore/xml/XSLTProcessorLibxslt.cpp | 11 +- .../webkit/WebCore/xml/XSLTProcessorQt.cpp | 4 +- src/3rdparty/webkit/WebCore/xml/xmlnsattrs.in | 4 - src/3rdparty/webkit/WebKit.pri | 96 +- src/3rdparty/webkit/WebKit/ChangeLog | 214 - .../webkit/WebKit/StringsNotToBeLocalized.txt | 45 +- .../webkit/WebKit/mac/ChangeLog-2010-01-29 | 23230 ----- .../WebKit/mac/Configurations/Version.xcconfig | 4 +- .../webkit/WebKit/qt/Api/DerivedSources.pro | 108 - .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 267 +- .../webkit/WebKit/qt/Api/qgraphicswebview.h | 8 - src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 9 - src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 237 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h | 11 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 5 +- .../webkit/WebKit/qt/Api/qwebinspector.cpp | 14 +- src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h | 1 - src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h | 11 + src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 219 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 18 + src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 18 +- .../webkit/WebKit/qt/Api/qwebsecurityorigin.cpp | 5 - src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 20 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 8 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 169 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.h | 6 + src/3rdparty/webkit/WebKit/qt/ChangeLog | 2259 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 68 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.h | 21 - .../WebKit/qt/WebCoreSupport/DragClientQt.cpp | 39 +- .../WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 22 +- .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 143 +- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 10 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 97 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.h | 5 +- .../qt/WebCoreSupport/QtFallbackWebPopup.cpp | 169 - .../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 65 - .../webkit/WebKit/qt/docs/qtwebkit.qdocconf | 2 +- .../qt/docs/webkitsnippets/webelement/main.cpp | 4 +- .../webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 4 - .../WebKit/qt/tests/benchmarks/loading/loading.pro | 1 - .../qt/tests/benchmarks/loading/tst_loading.pro | 11 + .../qt/tests/benchmarks/painting/painting.pro | 1 - .../qt/tests/benchmarks/painting/tst_painting.pro | 11 + .../WebKit/qt/tests/hybridPixmap/hybridPixmap.pro | 10 - .../WebKit/qt/tests/hybridPixmap/resources.qrc | 5 - .../webkit/WebKit/qt/tests/hybridPixmap/test.html | 65 - .../qt/tests/hybridPixmap/tst_hybridPixmap.cpp | 52 - .../webkit/WebKit/qt/tests/hybridPixmap/widget.cpp | 119 - .../webkit/WebKit/qt/tests/hybridPixmap/widget.h | 70 - .../webkit/WebKit/qt/tests/hybridPixmap/widget.ui | 95 - .../qt/tests/qgraphicswebview/qgraphicswebview.pro | 11 +- .../qgraphicswebview/tst_qgraphicswebview.cpp | 29 +- .../webkit/WebKit/qt/tests/qwebelement/image.png | Bin 0 -> 14743 bytes .../WebKit/qt/tests/qwebelement/qwebelement.pro | 13 +- .../WebKit/qt/tests/qwebelement/qwebelement.qrc | 7 + .../qt/tests/qwebelement/resources/image.png | Bin 14743 -> 0 bytes .../qt/tests/qwebelement/resources/style.css | 1 - .../qt/tests/qwebelement/resources/style2.css | 1 - .../webkit/WebKit/qt/tests/qwebelement/style.css | 1 + .../webkit/WebKit/qt/tests/qwebelement/style2.css | 1 + .../qt/tests/qwebelement/tst_qwebelement.cpp | 30 +- .../qt/tests/qwebelement/tst_qwebelement.qrc | 7 - .../webkit/WebKit/qt/tests/qwebframe/image.png | Bin 0 -> 14743 bytes .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 14 +- .../webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc | 10 + .../WebKit/qt/tests/qwebframe/resources/image.png | Bin 14743 -> 0 bytes .../WebKit/qt/tests/qwebframe/resources/image2.png | Bin 0 -> 14743 bytes .../WebKit/qt/tests/qwebframe/resources/style.css | 1 - .../WebKit/qt/tests/qwebframe/resources/test1.html | 1 - .../WebKit/qt/tests/qwebframe/resources/test2.html | 1 - .../qt/tests/qwebframe/resources/testiframe.html | 54 - .../qt/tests/qwebframe/resources/testiframe2.html | 21 - .../webkit/WebKit/qt/tests/qwebframe/style.css | 1 + .../webkit/WebKit/qt/tests/qwebframe/test1.html | 1 + .../webkit/WebKit/qt/tests/qwebframe/test2.html | 1 + .../WebKit/qt/tests/qwebframe/testiframe.html | 54 + .../WebKit/qt/tests/qwebframe/testiframe2.html | 21 + .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 216 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.qrc | 10 - .../WebKit/qt/tests/qwebhistory/data/page1.html | 1 + .../WebKit/qt/tests/qwebhistory/data/page2.html | 1 + .../WebKit/qt/tests/qwebhistory/data/page3.html | 1 + .../WebKit/qt/tests/qwebhistory/data/page4.html | 1 + .../WebKit/qt/tests/qwebhistory/data/page5.html | 1 + .../WebKit/qt/tests/qwebhistory/data/page6.html | 1 + .../WebKit/qt/tests/qwebhistory/qwebhistory.pro | 13 +- .../qt/tests/qwebhistory/resources/page1.html | 1 - .../qt/tests/qwebhistory/resources/page2.html | 1 - .../qt/tests/qwebhistory/resources/page3.html | 1 - .../qt/tests/qwebhistory/resources/page4.html | 1 - .../qt/tests/qwebhistory/resources/page5.html | 1 - .../qt/tests/qwebhistory/resources/page6.html | 1 - .../qt/tests/qwebhistory/tst_qwebhistory.cpp | 2 +- .../qt/tests/qwebhistory/tst_qwebhistory.qrc | 12 +- .../qwebhistoryinterface/qwebhistoryinterface.pro | 12 +- .../qt/tests/qwebinspector/qwebinspector.pro | 1 - .../qt/tests/qwebinspector/tst_qwebinspector.cpp | 68 - .../qt/tests/qwebpage/frametest/frame_a.html | 2 + .../WebKit/qt/tests/qwebpage/frametest/iframe.html | 6 + .../qt/tests/qwebpage/frametest/iframe2.html | 7 + .../qt/tests/qwebpage/frametest/iframe3.html | 5 + .../WebKit/qt/tests/qwebpage/frametest/index.html | 4 + .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 14 +- .../qt/tests/qwebpage/resources/frame_a.html | 2 - .../WebKit/qt/tests/qwebpage/resources/iframe.html | 6 - .../qt/tests/qwebpage/resources/iframe2.html | 7 - .../qt/tests/qwebpage/resources/iframe3.html | 5 - .../WebKit/qt/tests/qwebpage/resources/index.html | 4 - .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 196 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.qrc | 10 +- .../qwebplugindatabase/qwebplugindatabase.pro | 12 +- .../WebKit/qt/tests/qwebview/data/frame_a.html | 2 + .../WebKit/qt/tests/qwebview/data/index.html | 4 + .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 14 +- .../qt/tests/qwebview/resources/frame_a.html | 2 - .../WebKit/qt/tests/qwebview/resources/index.html | 4 - .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 25 +- .../WebKit/qt/tests/qwebview/tst_qwebview.qrc | 4 +- .../webkit/WebKit/qt/tests/resources/image2.png | Bin 14743 -> 0 bytes src/3rdparty/webkit/WebKit/qt/tests/tests.pri | 23 - src/3rdparty/webkit/WebKit/qt/tests/tests.pro | 4 +- src/3rdparty/webkit/WebKit/qt/tests/util.h | 32 +- 3449 files changed, 137819 insertions(+), 290807 deletions(-) delete mode 100644 src/3rdparty/webkit/.gitattributes delete mode 100644 src/3rdparty/webkit/JavaScriptCore/API/APIShims.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/create_jit_stubs delete mode 100644 src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/os-win32/WinMain.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/HeavyProfile.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/HeavyProfile.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/TreeProfile.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/TreeProfile.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qtscriptglobal.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri delete mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h delete mode 100644 src/3rdparty/webkit/WebCore/ChangeLog-2010-01-29 delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringBuilder.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/UStringImpl.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCMap.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/PtrAndFlags.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/StringHashFunctions.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ValueCheck.h delete mode 100644 src/3rdparty/webkit/WebCore/WebCore.ClientBasedGeolocation.exp delete mode 100644 src/3rdparty/webkit/WebCore/WebCore.pri delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.cpp delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.h delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.cpp delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.h delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.cpp delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.h delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.cpp delete mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingDOMWindow.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingElement.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurity.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/GenericBinding.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayBufferConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayBufferConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasRenderingContext3DCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSPopStateEventCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGContextCache.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGPODListCustom.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGPointListCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGTransformListCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayHelper.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm delete mode 100644 src/3rdparty/webkit/WebCore/bridge/Bridge.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaStringV8.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/runtime.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/runtime.h delete mode 100644 src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css create mode 100644 src/3rdparty/webkit/WebCore/dom/ClassNames.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/ClassNames.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl delete mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl delete mode 100644 src/3rdparty/webkit/WebCore/dom/SpaceSplitString.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/SpaceSplitString.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.idl delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.idl delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.h delete mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.idl create mode 100644 src/3rdparty/webkit/WebCore/editing/android/EditorAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/editing/chromium/EditorChromium.cpp create mode 100644 src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/Grammar.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/Grammar.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSBlob.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSBlob.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasFloatArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasFloatArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext3D.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext3D.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSDOMWindowBase.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouch.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouch.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchEvent.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchList.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchList.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWorkerContextBase.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/Lexer.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/MathObject.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/XMLNSNames.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/XMLNSNames.h create mode 100644 src/3rdparty/webkit/WebCore/generated/chartables.c delete mode 100644 src/3rdparty/webkit/WebCore/html/Blob.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/Blob.h delete mode 100644 src/3rdparty/webkit/WebCore/html/Blob.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/DateComponents.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/DateComponents.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScript.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl mode change 100755 => 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl create mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/consoleIcon.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/gearButtonGlyph.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverArrows.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverBackground.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveHoriz.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveVert.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoriz.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverHoriz.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverVert.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbVert.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipBalloon.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipBalloonBottom.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipIcon.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipIconPressed.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackHoriz.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackVert.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorBackendStub.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorFrontendHostStub.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Popover.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Popup.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Section.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Settings.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.re2js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceTokenizer.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorHighlighter.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorModel.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextViewer.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TimelineGrid.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TimelineOverviewPane.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/WelcomeView.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/audits.css delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/popover.css delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css delete mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp delete mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h delete mode 100644 src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp delete mode 100644 src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h delete mode 100644 src/3rdparty/webkit/WebCore/mathml/mathattrs.in delete mode 100644 src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h delete mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationController.cpp delete mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationController.h delete mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationControllerClient.h delete mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationError.h delete mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationPosition.h delete mode 100644 src/3rdparty/webkit/WebCore/page/MediaCanStartListener.h create mode 100644 src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/PlatformTouchEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/PlatformTouchPoint.h create mode 100644 src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h create mode 100644 src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/DragDataAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/EventLoopAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/KeyboardCodes.h create mode 100644 src/3rdparty/webkit/WebCore/platform/android/LocalizedStringsAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/PopupMenuAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/RenderThemeAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/RenderThemeAndroid.h create mode 100644 src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/ScrollViewAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/SearchPopupMenuAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/SystemTimeAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/android/WidgetAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/FileSystemCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/KURLCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/RunLoopTimerCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SharedBufferCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/ColorSpace.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/TypesettingFeatures.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLUtils.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformData.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCacheWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontDatabase.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontDatabase.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformData.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IconWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCairoWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntPointWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntRectWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntSizeWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/TransformationMatrixWin.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.h create mode 100644 src/3rdparty/webkit/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/AuthenticationClient.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationCF.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationChallenge.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/CredentialStorageCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/DNSCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/FormDataStreamCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/FormDataStreamCFNet.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/LoaderRunLoopCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/LoaderRunLoopCF.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceError.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceErrorCF.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceHandleCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequest.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequestCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequestCFNet.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceResponse.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceResponseCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamError.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamHandle.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandlePrivate.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchEventQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchPointQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/TextBoundaries.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/TextBoundariesICU.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundariesQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/wince/TextBoundariesWince.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/wince/TextBreakIteratorWince.cpp delete mode 100644 src/3rdparty/webkit/WebCore/plugins/PluginWidget.h delete mode 100644 src/3rdparty/webkit/WebCore/plugins/mac/PluginWidgetMac.mm delete mode 100644 src/3rdparty/webkit/WebCore/rendering/BidiRun.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/BidiRun.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/InlineIterator.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRuby.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRuby.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyText.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyText.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResource.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerData.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.cpp delete mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/TrailingFloatsRootInlineBox.h delete mode 100644 src/3rdparty/webkit/WebCore/rendering/style/LineClampValue.h delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.h delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.idl delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.h delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.idl delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.cpp delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.h delete mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.idl delete mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.cpp delete mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.h delete mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.idl delete mode 100644 src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertyTraits.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/SVGElementRareData.h create mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp create mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h create mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizableTypeWrapper.h create mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMasker.cpp create mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMasker.h delete mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.cpp delete mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.h delete mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h delete mode 100644 src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp delete mode 100644 src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.h delete mode 100644 src/3rdparty/webkit/WebCore/xml/xmlnsattrs.in delete mode 100644 src/3rdparty/webkit/WebKit/mac/ChangeLog-2010-01-29 delete mode 100644 src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp delete mode 100644 src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/loading.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/painting.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/resources.qrc delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/test.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.cpp delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.h delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/image.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style2.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/image.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/style.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test1.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test1.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page1.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page3.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page4.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page5.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page6.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/tests.pri diff --git a/src/3rdparty/webkit/.gitattributes b/src/3rdparty/webkit/.gitattributes deleted file mode 100644 index 80386ae..0000000 --- a/src/3rdparty/webkit/.gitattributes +++ /dev/null @@ -1,273 +0,0 @@ -# To enable automatic merging of ChangeLog files, use the following command: -# git config merge.changelog.driver "resolve-ChangeLogs --merge-driver %O %A %B" -ChangeLog* merge=changelog - -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj -crlf -JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln -crlf -JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj -crlf -JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops -crlf -JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj -crlf -JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops -crlf -JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj -crlf -LayoutTests/dom/svg/level3/xpath/Attribute_Nodes.svg -crlf -LayoutTests/dom/svg/level3/xpath/Attribute_Nodes_xmlns.svg -crlf -LayoutTests/dom/svg/level3/xpath/Comment_Nodes.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_Expressions.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_ID.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_3.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_empty.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_null.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_3.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_empty.svg -crlf -LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_null.svg -crlf -LayoutTests/dom/svg/level3/xpath/Element_Nodes.svg -crlf -LayoutTests/dom/svg/level3/xpath/Processing_Instruction_Nodes.svg -crlf -LayoutTests/dom/svg/level3/xpath/Text_Nodes.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluatorCast01.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_01.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_02.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NS.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_no_NS.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_all.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_document.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_documentElement.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_INVALID_EXPRESSION_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NAMESPACE_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NOT_SUPPORTED_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_TYPE_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_document.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_documentElement.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_NOT_SUPPORTED_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_WRONG_DOCUMENT_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_document.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_documentElement.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_nist_dmstc.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_null.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_prefix.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_xml.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_TYPE_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_false.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_true.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_UNORDERED_NODE_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_BOOLEAN_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_FIRST_ORDERED_NODE_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_NUMBER_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_ITERATOR_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_STRING_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_ITERATOR_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_iterateNext_INVALID_STATE_ERR.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_iteratorNext_ORDERED_NODE_ITERATOR_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_numberValue.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_resultType.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_ANY_UNORDERED_NODE_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_FIRST_ORDERED_NODE_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_count.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf -LayoutTests/dom/svg/level3/xpath/XPathResult_stringValue.svg -crlf -LayoutTests/editing/execCommand/align-in-span.html -crlf -LayoutTests/editing/selection/drag-start-event-client-x-y.html -crlf -LayoutTests/fast/backgrounds/background-position-rounding.html -crlf -LayoutTests/fast/backgrounds/repeat/resources/background-repeat-shorthand.js -crlf -LayoutTests/fast/backgrounds/repeat/resources/margin-shorthand.js -crlf -LayoutTests/fast/block/float/clamped-right-float.html -crlf -LayoutTests/fast/block/positioning/absolute-with-html-border-quirks.html -crlf -LayoutTests/fast/block/positioning/absolute-with-html-border-strict.html -crlf -LayoutTests/fast/canvas/script-tests/canvas-gradient-without-path.js -crlf -LayoutTests/fast/css/color-quirk.html -crlf -LayoutTests/fast/css/color-strict.html -crlf -LayoutTests/fast/css/css1_forward_compatible_parsing.html -crlf -LayoutTests/fast/css/empty-pseudo-class.html -crlf -LayoutTests/fast/css/first-child-pseudo-class.html -crlf -LayoutTests/fast/css/first-of-type-pseudo-class.html -crlf -LayoutTests/fast/css/last-child-pseudo-class.html -crlf -LayoutTests/fast/css/last-of-type-pseudo-class.html -crlf -LayoutTests/fast/css/only-child-pseudo-class.html -crlf -LayoutTests/fast/css/only-of-type-pseudo-class.html -crlf -LayoutTests/fast/css/text-input-with-webkit-border-radius.html -crlf -LayoutTests/fast/dom/Document/open-with-pending-load.html -crlf -LayoutTests/fast/dom/Element/hostname-host.html -crlf -LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html -crlf -LayoutTests/fast/dom/Window/window-property-clearing-expected.txt -crlf -LayoutTests/fast/dom/everything-to-string.html -crlf -LayoutTests/fast/dom/insert-span-into-long-text-bug-28245.html -crlf -LayoutTests/fast/dom/resources/TestApplet.java -crlf -LayoutTests/fast/dom/simultaneouslyRegsiteredTimerFireOrder-expected.txt -crlf -LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error.html -crlf -LayoutTests/fast/events/keydown-keypress-focus-change.html -crlf -LayoutTests/fast/events/node-event-anchor-lock.html -crlf -LayoutTests/fast/events/onload-fires-twice.html -crlf -LayoutTests/fast/events/set-event-in-another-frame.html -crlf -LayoutTests/fast/events/set-event-to-null.html -crlf -LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-main.html -crlf -LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-submit.html -crlf -LayoutTests/fast/forms/select-remove-option.html -crlf -LayoutTests/fast/forms/select-reset-multiple-selections-4-single-selection.html -crlf -LayoutTests/fast/forms/textfield-onchange-deletion.html -crlf -LayoutTests/fast/frames/frame-src-attribute.html -crlf -LayoutTests/fast/frames/iframe-scroll-page-up-down.html-disabled -crlf -LayoutTests/fast/frames/javascript-url-as-framesrc-crash.html -crlf -LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-1.html -crlf -LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-2.html -crlf -LayoutTests/fast/frames/viewsource-attribute.html -crlf -LayoutTests/fast/inline/inline-padding-disables-text-quirk.html -crlf -LayoutTests/fast/loader/submit-form-while-parsing-1.xhtml -crlf -LayoutTests/fast/overflow/dynamic-hidden.html -crlf -LayoutTests/fast/parser/external-entities-in-xslt.xml -crlf -LayoutTests/fast/parser/external-entities.xml -crlf -LayoutTests/fast/parser/resources/external-entities.xsl -crlf -LayoutTests/fast/replaced/replaced-breaking.html -crlf -LayoutTests/fast/table/dynamic-cellpadding.html -crlf -LayoutTests/fast/table/fixed-table-with-percent-inside-percent-table.html -crlf -LayoutTests/fast/table/fixed-table-with-percent-width-inside-auto-table.html -crlf -LayoutTests/fast/table/fixed-table-with-percent-width-inside-extra-large-div.html -crlf -LayoutTests/fast/table/fixed-table-with-small-percent-width.html -crlf -LayoutTests/fast/table/rules-attr-dynchange1.html -crlf -LayoutTests/fast/table/rules-attr-dynchange2.html -crlf -LayoutTests/fast/text/international/thai-baht-space.html -crlf -LayoutTests/fast/text/resources/line-breaks-crlf.txt -crlf -LayoutTests/fast/text/text-large-negative-letter-spacing-with-opacity.html -crlf -LayoutTests/fast/text/text-letter-spacing.html -crlf -LayoutTests/http/tests/appcache/max-size.html -crlf -LayoutTests/http/tests/misc/location-test-xsl-style-sheet.xml -crlf -LayoutTests/http/tests/misc/resources/location-test-xsl-style-sheet.xsl -crlf -LayoutTests/http/tests/misc/single-character-pi-stylesheet.xhtml -crlf -LayoutTests/http/tests/misc/will-send-request-returns-null-on-redirect.html -crlf -LayoutTests/http/tests/navigation/no-referrer-reset.html -crlf -LayoutTests/http/tests/navigation/no-referrer-same-window.html -crlf -LayoutTests/http/tests/navigation/no-referrer-subframe.html -crlf -LayoutTests/http/tests/navigation/no-referrer-target-blank.html -crlf -LayoutTests/http/tests/navigation/resources/no-referrer-same-window-helper.php -crlf -LayoutTests/http/tests/security/isolatedWorld/events.html -crlf -LayoutTests/http/tests/security/isolatedWorld/resources/iframe.html -crlf -LayoutTests/http/tests/security/isolatedWorld/resources/userGestureEvents-second-window.html -crlf -LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html -crlf -LayoutTests/http/tests/security/resources/empty-svg.php -crlf -LayoutTests/platform/win/fast/events/panScroll-event-fired.html -crlf -LayoutTests/platform/win/fast/events/panScroll-image-no-scroll.html -crlf -LayoutTests/platform/win/fast/events/panScroll-imageMap-href-no-scroll.html -crlf -LayoutTests/platform/win/fast/events/panScroll-imageMap-noHref-scroll.html -crlf -LayoutTests/platform/win/fast/events/panScroll-nested-divs.html -crlf -LayoutTests/platform/win/fast/events/panScroll-no-iframe-jump.html -crlf -LayoutTests/platform/win/fast/events/panScroll-preventDefault.html -crlf -LayoutTests/svg/custom/marker-opacity.svg -crlf -LayoutTests/svg/custom/resources/graffiti.svg -crlf -LayoutTests/svg/custom/struct-use-09-b.svg -crlf -LayoutTests/svg/custom/svg-fonts-in-html.html -crlf -LayoutTests/svg/custom/use-events-crash.svg -crlf -LayoutTests/svg/custom/use-on-symbol-inside-pattern.svg -crlf -LayoutTests/svg/custom/use-setAttribute-crash.svg -crlf -LayoutTests/svg/custom/xml-stylesheet.svg -crlf -LayoutTests/tables/mozilla/bugs/bug119786.html -crlf -LayoutTests/tables/mozilla/bugs/bug222846.html -crlf -LayoutTests/tables/mozilla/bugs/bug275625.html -crlf -LayoutTests/tables/mozilla/images/aboutHeader.gif -crlf -LayoutTests/tables/mozilla/images/main-horizontal-scroll.gif -crlf -LayoutTests/tables/mozilla_expected_failures/bugs/bug101759.html -crlf -LayoutTests/tables/mozilla_expected_failures/bugs/bug14489.html -crlf -LayoutTests/tables/mozilla_expected_failures/images/aboutHeader.gif -crlf -LayoutTests/tables/mozilla_expected_failures/images/main-horizontal-scroll.gif -crlf -LayoutTests/wml/resources/enter-card-with-events.wml -crlf -LayoutTests/wml/resources/enter-first-card-with-events.wml -crlf -PageLoadTests/svg/files/Harvey_Rayner.svg -crlf -PageLoadTests/svg/files/cacuts_01.svg -crlf -PageLoadTests/svg/files/crawfish2_ganson.svg -crlf -PageLoadTests/svg/files/france.svg -crlf -PageLoadTests/svg/files/mtsthelens.svg -crlf -PageLoadTests/svg/files/worldcup.svg -crlf -PlanetWebKit/planet/LICENCE -crlf -SunSpider/tests/parse-only/jquery-1.3.2.js -crlf -WebCore/WebCore.vcproj/QTMovieWin.vcproj -crlf -WebCore/WebCore.vcproj/WebCore.sln -crlf -WebCore/WebCore.vcproj/WebCore.submit.sln -crlf -WebCore/WebCore.vcproj/WebCore.vcproj -crlf -WebCore/WebCore.vcproj/WebCoreCFNetwork.vsprops -crlf -WebCore/WebCore.vcproj/WebCoreCG.vsprops -crlf -WebCore/WebCore.vcproj/WebCoreCURL.vsprops -crlf -WebCore/WebCore.vcproj/WebCoreCairo.vsprops -crlf -WebCore/WebCore.vcproj/WebCoreGenerated.vcproj -crlf -WebCore/WebCore.vcproj/WebCoreMediaQT.vsprops -crlf -WebCore/WebCore.vcproj/WebCorePthreads.vsprops -crlf -WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops -crlf -WebCore/accessibility/AccessibilityAllInOne.cpp -crlf -WebCore/bindings/js/JSExceptionBase.cpp -crlf -WebCore/bindings/js/JSExceptionBase.h -crlf -WebCore/manual-tests/DOMContextMenuEvent.html -crlf -WebCore/manual-tests/cursor-max-size.html -crlf -WebCore/manual-tests/drag-with-div-or-image-as-data-image.html -crlf -WebCore/manual-tests/empty-script-crash.html -crlf -WebCore/manual-tests/remove-form-node-with-radio-buttons-crash.html -crlf -WebCore/manual-tests/select-delete-item.html -crlf -WebCore/manual-tests/textarea-caret-position-after-auto-spell-correct.html -crlf -WebCore/platform/chromium/SuddenTerminationChromium.cpp -crlf -WebCore/platform/network/win/NetworkStateNotifierWin.cpp -crlf -WebCore/platform/wx/wxcode/non-kerned-drawing.h -crlf -WebCore/rendering/RenderThemeChromiumWin.h -crlf -WebKit/chromium/src/EventListenerWrapper.cpp -crlf -WebKit/chromium/src/EventListenerWrapper.h -crlf -WebKit/chromium/src/WebEventListener.cpp -crlf -WebKit/chromium/src/WebEventListenerPrivate.cpp -crlf -WebKit/chromium/src/WebEventListenerPrivate.h -crlf -WebKit/gtk/po/sr.po -crlf -WebKit/gtk/po/sr@latin.po -crlf -WebKit/qt/tests/qwebframe/resources/testiframe.html -crlf -WebKit/qt/tests/qwebframe/resources/testiframe2.html -crlf -WebKit/win/COMPropertyBag.h -crlf -WebKit/win/COMVariantSetter.h -crlf -WebKit/win/Interfaces/IWebEmbeddedView.idl -crlf -WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl -crlf -WebKit/win/WebCoreSupport/EmbeddedWidget.cpp -crlf -WebKit/win/WebCoreSupport/EmbeddedWidget.h -crlf -WebKit/win/WebCoreSupport/WebInspectorDelegate.h -crlf -WebKit/win/WebIconFetcher.cpp -crlf -WebKit/win/WebIconFetcher.h -crlf -WebKit/win/WebKit.vcproj/Interfaces.vcproj -crlf -WebKit/win/WebKit.vcproj/WebKit.sln -crlf -WebKit/win/WebKit.vcproj/WebKit.submit.sln -crlf -WebKit/win/WebKit.vcproj/WebKit.vcproj -crlf -WebKit/win/WebKit.vcproj/WebKitGUID.vcproj -crlf -WebKitLibraries/win/tools/vsprops/WinCairo.vsprops -crlf -WebKitLibraries/win/tools/vsprops/cURL.vsprops -crlf -WebKitLibraries/win/tools/vsprops/debug_wincairo.vsprops -crlf -WebKitSite/blog/license.txt -crlf -WebKitSite/blog/wp-config-sample.php -crlf -WebKitSite/blog/wp-config.php -crlf -WebKitSite/blog/wp-includes/images/crystal/license.txt -crlf -WebKitSite/blog/wp-includes/js/scriptaculous/MIT-LICENSE -crlf -WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.speed.js -crlf -WebKitSite/blog/wp-includes/js/tinymce/license.txt -crlf -WebKitSite/perf/slickspeed/frameworks/DomQuery.js -crlf -WebKitTools/CLWrapper/CLWrapper.sln -crlf -WebKitTools/CLWrapper/CLWrapper.vcproj -crlf -WebKitTools/DumpRenderTree/DumpRenderTree.sln -crlf -WebKitTools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp -crlf -WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj -crlf -WebKitTools/DumpRenderTree/win/ImageDiff.vcproj -crlf -WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def -crlf -WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc -crlf -WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj -crlf -WebKitTools/FindSafari/FindSafari.vcproj -crlf -WebKitTools/FindSafari/Safari.exe.manifest -crlf -WebKitTools/MIDLWrapper/MIDLWrapper.sln -crlf -WebKitTools/MIDLWrapper/MIDLWrapper.vcproj -crlf -WebKitTools/Scripts/webkitpy/mock.py -crlf -WebKitTools/WebKitAPITest/WebKitAPITest.vcproj -crlf -WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops -crlf -WebKitTools/WebKitLauncherWin/WebKitLauncherWin.vcproj -crlf -WebKitTools/WinLauncher/WinLauncher.h -crlf -WebKitTools/WinLauncher/WinLauncher.vcproj -crlf -WebKitTools/record-memory-win/main.cpp -crlf -WebKitTools/record-memory-win/record-memory-win.vcproj -crlf diff --git a/src/3rdparty/webkit/.gitignore b/src/3rdparty/webkit/.gitignore index 607a22e..b9595b3 100644 --- a/src/3rdparty/webkit/.gitignore +++ b/src/3rdparty/webkit/.gitignore @@ -4,21 +4,3 @@ *.pyc build/ /WebKitBuild/ -autoinstall.cache.d - -# Ignore Chromium projects auto-generated from .gyp files: -JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.xcodeproj -WebCore/WebCore.gyp/WebCore.xcodeproj -WebKit/chromium/WebKit.xcodeproj - -# Though the GTK build builds in a subdirectory, autogen.sh still deposits -# a few files into the source tree. -/aclocal.m4 -/autom4te.cache -/autotools -/autotoolsconfig.h.in -/configure -/GNUmakefile.in -/gtk-doc.make -/INSTALL -/README diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 7bcf76e..1e89d1e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,594 +1,3 @@ -2010-02-20 Noam Rosenthal - - Reviewed by Laszlo Gombos. - - [Qt] ENABLE_3D_RENDERING should be optional - https://bugs.webkit.org/show_bug.cgi?id=35100 - - * WebKit.pri: ENABLE_3D_RENDERING moved to a proper feature test - -2010-02-19 Maciej Stachowiak - - Reviewed by David Levin. - - Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases - https://bugs.webkit.org/show_bug.cgi?id=35147 - - * configure.ac: - -2010-02-18 Tor Arne Vestbø - - Reviewed by Eric Seidel. - - Add .gitattributes file for custom ChangeLog merge-driver - - * .gitattributes: Added. - -2010-02-17 Noam Rosenthal - - Reviewed by Ariya Hidayat. - - [Qt] GraphicsLayer: support perspective and 3D transforms - https://bugs.webkit.org/show_bug.cgi?id=34960 - - * WebKit.pri: added appropriate define: ENABLED_3D_RENDERING - -2010-02-15 Philippe Normand - - Reviewed by Gustavo Noronha Silva. - - [GStreamer] Should handle BUFFERING messages - https://bugs.webkit.org/show_bug.cgi?id=30004 - - * configure.ac: Bump gstreamer -core/-plugins-base requirements to - 0.10.25 which is the minimum required version for on-disk buffering. - -2010-02-16 Xan Lopez - - Reviewed by Gustavo Noronha. - - Bump version to 1.1.22 so we can depend on it in applications. - - * configure.ac: - -2010-02-12 Simon Hausmann - - Reviewed by Holger Freyther. - - Removed WMLInputElement.* from .gitattributes as the file is - now CRLF clean. - - * .gitattributes: - -2010-02-10 Jocelyn Turcotte - - Reviewed by Tor Arne Vestbø. - - [Qt] Make qtlauncher and qgvlauncher use the generated headers - path to make sure they are correctly generated. - - * WebKit.pri: - -2010-02-10 Jocelyn Turcotte - - Reviewed by Tor Arne Vestbø. - - [Qt] Manually add support for the install target on Symbian. - - This is required to copy the headers over the ones in Qt. - - * WebKit.pro: - -2010-02-11 Fridrich Strba - - Reviewed by Gustavo Noronha Silva. - - Detect properly different versions of libpng out there. - - * configure.ac: - -2010-02-11 Xan Lopez - - Try to fix GTK+ build. - - * configure.ac: - -2010-02-11 Antonio Gomes - - Reviewed by Xan Lopez. - - Adjust gstreamer-plugins-base minimum version check (from 0.10 to 0.10.23). - - * configure.ac: - -2010-02-08 Maciej Stachowiak - - Reviewed by Cameron Zwarich. - - Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose. - https://bugs.webkit.org/show_bug.cgi?id=34698 - - * configure.ac: - -2010-02-08 Gustavo Noronha Silva - - Reviewed by Xan Lopez. - - Bump version to 1.1.21, and adjust library versioning accordingly. - - * configure.ac: - -2010-02-05 Sebastian Dröge - - Reviewed by Gustavo Noronha. - - Add gstreamer-app-0.10 to configure.ac - https://bugs.webkit.org/show_bug.cgi?id=34317 - - * configure.ac: - -2010-02-05 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - Add .gitattributes file to tell git about files with Windows linefeeds - https://bugs.webkit.org/show_bug.cgi?id=34645 - - On Windows git defaults to "true" for core.autocrlf, meaning all text - files in the working directory are converted from CRLF to LF on checkin - time. Some files present in the repository have been checked in with - CRLF linefeeds and git should not try to convert them. The added - .gitattributes file tells git to not do any CRLF conversion. - - * .gitattributes: Added. - -2010-02-05 Tor Arne Vestbø - - Reviewed by Simon Hausmann. - - [Qt] Generate convenience headers (QWebView, etc) using qmake - - In Qt this is done using syncqt, but we use a pro-file instead - that generates makefile-rules for each of the extra headers. - - These extra headers are installed alongside the normal headers. - - * DerivedSources.pro: Include API-DerivedSources - -2010-02-04 Tor Arne Vestbø - - Reviewed by Lars Knoll. - - [Qt] Make 'make -f Makefile.DerivedSources qmake' work - - Previously this target ended up generating a file named - Makefile.DerivedSources.DerivedSources, and so on. - - * DerivedSources.pro: - -2010-02-04 Christian Dywan - - Reviewed by Xan Lopez. - - Require either libsoup 2.28.2 or 2.29.90. - - * configure.ac: - -2010-02-04 Xan Lopez - - Reviewed by Gustavo Noronha. - - Bump minimum libsoup requirement to 2.29.90 - - * configure.ac: - -2010-02-02 Gustavo Noronha Silva - - Reviewed by Xan Lopez. - - Bump version, and adjust library versioning for 1.1.20. - - * configure.ac: - -2010-01-29 Jeremy Orlow - - Reviewed by Dimitri Glazkov. - - A first step towards the Indexed Database API - https://bugs.webkit.org/show_bug.cgi?id=34342 - - Add Indexed Database API - - * configure.ac: - -2010-01-27 Simon Hausmann - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Don't build the tests in packages, only the launcher(s) - - * WebKit.pro: - -2010-01-27 Jocelyn Turcotte - - Reviewed by Tor Arne Vestbø. - - [Qt] Add the "d" suffix to QtWebKit's dll on Windows. - - * WebKit.pri: - -2010-01-27 Jocelyn Turcotte - - Unreviewed build fix - - [Qt] Build fix for windows when QTDIR contains release libraries. - - * WebKit.pri: Use the .lib syntax for linking instead of qmake's -l emulation - -2010-01-26 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - First steps of the QtScript API. - - Two new classes were created; QScriptEngine and QScriptValue. - The first should encapsulate a javascript context and the second a script - value. - - This API is still in development, so it isn't compiled by default. - To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to - build-webkit. - - https://bugs.webkit.org/show_bug.cgi?id=32565 - - * WebKit.pro: - -2010-01-25 Simon Hausmann - - Reviewed by Laszlo Gombos. - - [Qt] Fix the build on Maemo5. - - https://bugs.webkit.org/show_bug.cgi?id=34051 - - * WebKit.pri: Disable the use of uitools, just like it's done for Symbian. - -2010-01-21 No'am Rosenthal - - Reviewed by Antti Koivisto. - - [Qt] Implement GraphicsLayer for accelerated layer compositing - https://bugs.webkit.org/show_bug.cgi?id=33514 - - * WebKit.pri: Addded compile flags to enable accelerated compositing - on versions higher than 4.5 - -2010-01-20 Tor Arne Vestbø - - Reviewed by Simon Hausmann. - - [Qt] Make DumpRenderTree build on Windows - - * WebKit.pro: - -2010-01-20 Jocelyn Turcotte - - Reviewed by Simon Hausmann. - - [Qt] Fix the recursive generated_files target to work with qmake -r -o - - * DerivedSources.pro: - -2010-01-20 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - [Qt] Make it possible (on *nix at least) to recursively call "make generated_files" - - * DerivedSources.pro: - -2010-01-19 Gustavo Noronha Silva - - Unreviewed. Shared library versioning update for 1.1.19. - - * configure.ac: - -2010-01-15 Gustavo Noronha Silva - - Rubber-stamped by Xan Lopez. - - Bump version to 1.1.19. - - * configure.ac: - -2010-01-14 Csaba Osztrogonác - - Reviewed by Eric Seidel. - - [Qt] Defective dependencies caused build failing on QtBuildBot. - https://bugs.webkit.org/show_bug.cgi?id=33693 - - * WebKit.pri: CONFIG += depend_includepath added. - -2010-01-14 Steve Block - - Reviewed by David Levin. - - Moves general includes before bindings includes in Android build system. - https://bugs.webkit.org/show_bug.cgi?id=33623 - - This avoids problems with collisions between WebCore/platform/text/StringBuilder.h - and the new JavaScriptCore/runtime/StringBuilder.h. This change puts - JavaScriptCore/runtime and other bindings includes after the WebCore and other - general includes, so that the WebCore StringBuilder.h is picked up when building - WebCore. - - * Android.mk: Modified. - -2010-01-13 Jocelyn Turcotte - - Reviewed by Simon Hausmann. - - [Qt] Split the build process in two different .pro files. - This allows qmake to be run once all source files are available. - - * DerivedSources.pro: Added. - * WebKit.pri: - -2010-01-07 Daniel Bates - - Reviewed by Eric Seidel. - - https://bugs.webkit.org/show_bug.cgi?id=32987 - - Added ENABLE_XHTMLMP flag. Disabled by default. - - * configure.ac: - -2010-01-05 Gustavo Noronha Silva - - Reviewed by Xan Lopez. - - Based on idea and original patch by Evan Martin. - - Remove libWebCore intermediate library, to improve link time. - - [GTK] Build time must be reduced - https://bugs.webkit.org/show_bug.cgi?id=32921 - - * GNUmakefile.am: - -2010-01-05 Xan Lopez - - Bump for 1.1.18 release. - - * configure.ac: - -2010-01-04 Gustavo Noronha Silva - - Fix JSCore-1.0.gir path to fix make distcheck. - - * GNUmakefile.am: - -2010-01-04 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - [Qt] Fix standalone package builds. - - * WebKit.pri: Add logic for detecting standalone builds. Set OUTPUT_DIR to the top-level dir in that case. - * WebKit.pro: Don't build JSC and DRT for package builds. - -2010-01-04 Eric Seidel - - Reviewed by Adam Barth. - - bugzilla-tool should not require users to install mechanize - https://bugs.webkit.org/show_bug.cgi?id=32635 - - * .gitignore: Ignore autoinstall.cache.d directory created by autoinstall.py - -2009-12-28 Estêvão Samuel Procópio - - Reviewed by Gustavo Noronha Silva. - - Bug 32940: [GTK] Changing the download throttle conditions. - https://bugs.webkit.org/show_bug.cgi?id=32716 - - The WebKitDownload progress notification was taking long to - update. This fix makes notification happens each 0.7 secs - or when the progress ups in 1%. - - * WebKit/gtk/webkit/webkitdownload.cpp: - -2009-12-22 Simon Hausmann - - Rubber-stamped by Holger Freyther. - - Adjusted path to QtLauncher. - - * WebKit.pro: - -2009-12-19 Evan Martin - - Reviewed by Gustavo Noronha Silva. - - Add a couple of WebKitGtk files to .gitignore. - - * .gitignore: - -2009-12-18 Benjamin Otte - - Reviewed by Xan Lopez. - - [GTK] RemoveDashboard support. It's useless. - - * configure.ac: - -2009-12-18 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - [Qt] Clean up the qmake build system to distinguish between trunk builds and package builds - - https://bugs.webkit.org/show_bug.cgi?id=32716 - - * WebKit.pri: Use standalone_package instead of QTDIR_build - -2009-12-17 Gustavo Noronha Silva - - Unreviewed. Build fixes for make distcheck. - - * GNUmakefile.am: - -2009-12-16 Dan Winship - - Reviewed by Gustavo Noronha Silva. - - [Gtk] Content-Encoding support - - https://bugs.webkit.org/show_bug.cgi?id=522772 - - * configure.ac: require libsoup 2.28.2 for SoupContentDecoder - -2009-12-13 Eric Seidel - - Reviewed by Gavin Barraclough. - - string-base64 test does not compute a valid base64 string - http://bugs.webkit.org/show_bug.cgi?id=16806 - - * tests/string-base64.js: change str[i] to str.charCodeAt(i) - -2009-12-10 Gustavo Noronha Silva - - Reviewed by Xan Lopez. - - [GTK] Should provide an API to control the IconDatabase - https://bugs.webkit.org/show_bug.cgi?id=32334 - - Add test to make sure favicon reporting works. - - * GNUmakefile.am: - -2009-12-09 Steve Block - - Reviewed by Adam Barth. - - Adds Android Makefiles for building with V8. - https://bugs.webkit.org/show_bug.cgi?id=32278 - - * Android.mk: Modified. Includes Makefiles for V8. - -2009-12-08 Steve Block - - Reviewed by Adam Barth. - - [Android] Adds Makefiles for Android port. - https://bugs.webkit.org/show_bug.cgi?id=31325 - - * Android.mk: Added. - -2009-12-08 Christian Dywan - - Reviewed by Xan Lopez. - - * configure.ac: Require only libSoup 2.27.91 but check for 2.29.3 - and define HAVE_LIBSOUP_2_29_3 in that case. - -2009-12-08 Gustavo Noronha Silva - - Rubber-stamped by Xan Lopez. - - Late post-release version bump. - - * configure.ac: - -2009-12-08 Dominik Röttsches - - Reviewed by Gustavo Noronha Silva. - - [Gtk] Create a TextBreakIterator implementation based on GLib (without ICU) - https://bugs.webkit.org/show_bug.cgi?id=31469 - - Removing hybrid configuration for --with-unicode-backend=glib - ICU not required anymore. - - * autotools/webkit.m4: - -2009-12-08 Nikolas Zimmermann - - Rubber-stamped by Maciej Stachowiak. - - Turn on (SVG) Filters for Gtk. - https://bugs.webkit.org/show_bug.cgi?id=32224 - - * configure.ac: - -2009-12-07 Dmitry Titov - - Rubber-stamped by Darin Adler. - - Remove ENABLE_SHARED_SCRIPT flags - https://bugs.webkit.org/show_bug.cgi?id=32245 - This patch was obtained by "git revert" command and then un-reverting of ChangeLog files. - - * configure.ac: - -2009-12-06 Gustavo Noronha Silva - - Reviewed by Xan Lopez. - - Build the new API test. - - [GTK] REGRESSION: webkit thinks it can render PDFs - https://bugs.webkit.org/show_bug.cgi?id=32183 - - * GNUmakefile.am: - -2009-12-05 Vincent Untz - - Reviewed by Gustavo Noronha. - - Fixes race for builds with introspection enabled, and parallel - make. - - * GNUmakefile.am: - -2009-12-04 Xan Lopez - - Reviewed by Gustavo Noronha. - - [GTK]Enable DNS prefetching - https://bugs.webkit.org/show_bug.cgi?id=23846 - - Bump libsoup required version to 2.29.3 for DNS prefetching. - - * configure.ac: - -2009-11-30 Gustavo Noronha Silva - - Rubber-stamped by Xan Lopez. - - Make sure we distribute and install GObject Introspection files. - - * GNUmakefile.am: - -2009-11-30 Gustavo Noronha Silva - - Build fix. Make sure JSCore-1.0.gir is added to the distributed - tarball. - - * GNUmakefile.am: - -2009-11-30 Xan Lopez - - Reviewed by Gustavo Noronha. - - Bump versions for 1.1.17 release. - - * configure.ac: - 2009-11-30 Jan-Arve Sæther Reviewed by Simon Hausmann. @@ -599,110 +8,6 @@ * WebKit.pri: -2009-11-26 Laszlo Gombos - - Reviewed by Oliver Hunt. - - Move GOwnPtr* from wtf to wtf/gtk - https://bugs.webkit.org/show_bug.cgi?id=31793 - - * GNUmakefile.am: Add JavaScriptCore/wtf/gtk to - the include path. - -2009-11-24 Dmitry Titov - - Reviewed by Eric Seidel. - - Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit - https://bugs.webkit.org/show_bug.cgi?id=31444 - - * configure.ac: - -2009-11-24 Jason Smith - - Reviewed by Alexey Proskuryakov. - - RegExp#exec's returned Array-like object behaves differently from - regular Arrays - https://bugs.webkit.org/show_bug.cgi?id=31689 - - * LayoutTests/fast/js/regexp-in-and-foreach-handling.html: Added. - * LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js: Added. - * LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt: Added. - -2009-11-24 Jens Alfke - - Reviewed by David Levin. - - Ignore Chromium's Xcode projects that are auto-generated from .gyp files. - https://bugs.webkit.org/show_bug.cgi?id=31847 - - * .gitignore: Add three .xcodeproj files. - -2009-11-09 Priit Laes - - Reviewed by Oliver Hunt. - - [Gtk] Build from tarball fails with --enable-introspection - https://bugs.webkit.org/show_bug.cgi?id=31261 - - We need to enable gobject-introspection during distcheck otherwise - some of the required files are missing in tarball. - - * GNUmakefile.am: - -2009-11-05 Priit Laes - - Reviewed by Jan Alonzo. - - [Gtk] Build failure with --enable-introspection - https://bugs.webkit.org/show_bug.cgi?id=31102 - - Add search and include paths for JSCore-1.0.gir required by - gobject-introspection tools. - - * GNUmakefile.am: - -2009-11-04 Benjamin Otte - - Reviewed by Gustavo Noronha. - - Update Cairo requirement to 1.6. - - https://bugs.webkit.org/show_bug.cgi?id=19266 - - * configure.ac: - -2009-11-02 Estêvão Samuel Procópio - - Reviewed by Gustavo Noronha. - - [Build] make install ignores --prefix option for gobject-introspection. - https://bugs.webkit.org/show_bug.cgi?id=31025 - - Make the build system use the --prefix path also when installing - gobject-introspection files. - - * configure.ac: use --prefix path in GITDIR and GIRTYPELIBDIR - -2009-11-02 Xan Lopez - - Bump version before release (or post-release, depending on your - point of view) so that we can make applications depending on - unreleased APIs in WebKit svn fail at configure time when the - requirements are not met. - - * configure.ac: - -2009-11-01 Laszlo Gombos - - Reviewed by Eric Seidel. - - Turn on warnings for QtWebKit for gcc - https://bugs.webkit.org/show_bug.cgi?id=30958 - - * WebKit.pri: Turn on warnings for the GCC compiler - 2009-10-30 Adam Barth Reviewed by Mark Rowe. @@ -717,19 +22,6 @@ * .gitignore: Added. -2009-10-30 Roland Steiner - - Reviewed by Eric Seidel. - - Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. - - Bug 28420 - Implement HTML5 rendering - (https://bugs.webkit.org/show_bug.cgi?id=28420) - - No new tests (no functional change). - - * configure.ac: - 2009-10-26 Holger Hans Peter Freyther Rubber-stamped by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h index 4284c44..b9167a8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h @@ -51,20 +51,16 @@ typedef struct OpaqueJSValue* JSObjectRef; inline JSC::ExecState* toJS(JSContextRef c) { - ASSERT(c); return reinterpret_cast(const_cast(c)); } inline JSC::ExecState* toJS(JSGlobalContextRef c) { - ASSERT(c); return reinterpret_cast(c); } -inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) +inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v) { - ASSERT_UNUSED(exec, exec); - ASSERT(v); #if USE(JSVALUE32_64) JSC::JSCell* jsCell = reinterpret_cast(const_cast(v)); if (!jsCell) @@ -77,20 +73,6 @@ inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) #endif } -inline JSC::JSValue toJSForGC(JSC::ExecState* exec, JSValueRef v) -{ - ASSERT_UNUSED(exec, exec); - ASSERT(v); -#if USE(JSVALUE32_64) - JSC::JSCell* jsCell = reinterpret_cast(const_cast(v)); - if (!jsCell) - return JSC::JSValue(); - return jsCell; -#else - return JSC::JSValue::decode(reinterpret_cast(const_cast(v))); -#endif -} - inline JSC::JSObject* toJS(JSObjectRef o) { return reinterpret_cast(o); diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h b/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h deleted file mode 100644 index 9a6cacb..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef APIShims_h -#define APIShims_h - -#include "CallFrame.h" -#include "JSLock.h" - -namespace JSC { - -class APIEntryShimWithoutLock { -protected: - APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread) - : m_globalData(globalData) - , m_entryIdentifierTable(setCurrentIdentifierTable(globalData->identifierTable)) - { - if (registerThread) - globalData->heap.registerThread(); - m_globalData->timeoutChecker.start(); - } - - ~APIEntryShimWithoutLock() - { - m_globalData->timeoutChecker.stop(); - setCurrentIdentifierTable(m_entryIdentifierTable); - } - -private: - JSGlobalData* m_globalData; - IdentifierTable* m_entryIdentifierTable; -}; - -class APIEntryShim : public APIEntryShimWithoutLock { -public: - // Normal API entry - APIEntryShim(ExecState* exec, bool registerThread = true) - : APIEntryShimWithoutLock(&exec->globalData(), registerThread) - , m_lock(exec) - { - } - - // JSPropertyNameAccumulator only has a globalData. - APIEntryShim(JSGlobalData* globalData, bool registerThread = true) - : APIEntryShimWithoutLock(globalData, registerThread) - , m_lock(globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly) - { - } - -private: - JSLock m_lock; -}; - -class APICallbackShim { -public: - APICallbackShim(ExecState* exec) - : m_dropAllLocks(exec) - , m_globalData(&exec->globalData()) - { - resetCurrentIdentifierTable(); - } - - ~APICallbackShim() - { - setCurrentIdentifierTable(m_globalData->identifierTable); - } - -private: - JSLock::DropAllLocks m_dropAllLocks; - JSGlobalData* m_globalData; -}; - -} - -#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp index ebfeafa..4a32d35 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp @@ -28,7 +28,6 @@ #include "JSBasePrivate.h" #include "APICast.h" -#include "APIShims.h" #include "Completion.h" #include "OpaqueJSString.h" #include "SourceCode.h" @@ -44,7 +43,8 @@ using namespace JSC; JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsThisObject = toJS(thisObject); @@ -69,7 +69,8 @@ JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef th bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber); Completion completion = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source); @@ -93,11 +94,12 @@ void JSGarbageCollect(JSContextRef ctx) return; ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec, false); - JSGlobalData& globalData = exec->globalData(); + + JSLock lock(globalData.isSharedInstance ? LockForReal : SilenceAssertionsOnly); + if (!globalData.heap.isBusy()) - globalData.heap.collectAllGarbage(); + globalData.heap.collect(); // FIXME: Perhaps we should trigger a second mark and sweep // once the garbage collector is done if this is called when @@ -107,6 +109,8 @@ void JSGarbageCollect(JSContextRef ctx) void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + exec->globalData().heap.reportExtraMemoryCost(size); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h index 2e16720..d1ce9b3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h @@ -65,15 +65,27 @@ typedef struct OpaqueJSValue* JSObjectRef; /* JavaScript symbol exports */ #undef JS_EXPORT -#if defined(JS_NO_EXPORT) +#if defined(BUILDING_WX__) #define JS_EXPORT #elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__) #define JS_EXPORT __attribute__((visibility("default"))) -#elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE) - #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) +#elif defined(_WIN32_WCE) + #if defined(JS_BUILDING_JS) #define JS_EXPORT __declspec(dllexport) - #else + #elif defined(JS_IMPORT_JS) #define JS_EXPORT __declspec(dllimport) + #else + #define JS_EXPORT + #endif +#elif defined(WIN32) || defined(_WIN32) + /* + * TODO: Export symbols with JS_EXPORT when using MSVC. + * See http://bugs.webkit.org/show_bug.cgi?id=16227 + */ + #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) + #define JS_EXPORT __declspec(dllexport) + #else + #define JS_EXPORT __declspec(dllimport) #endif #else #define JS_EXPORT diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp index 9c5f6d7..1c33962 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "JSCallbackConstructor.h" -#include "APIShims.h" #include "APICast.h" #include #include @@ -67,7 +66,7 @@ static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, con JSValueRef exception = 0; JSObjectRef result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception); } if (exception) diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h index e529947..c4bd7ad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h @@ -41,7 +41,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } protected: diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp index 0e434d9..b7dd768 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp @@ -27,7 +27,6 @@ #include #include "JSCallbackFunction.h" -#include "APIShims.h" #include "APICast.h" #include "CodeBlock.h" #include "JSFunction.h" @@ -62,7 +61,7 @@ JSValue JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSVa JSValueRef exception = 0; JSValueRef result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = static_cast(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); } if (exception) diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h index 10dae6b..0cf25c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h @@ -41,7 +41,7 @@ public: // refactor the code so this override isn't necessary static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } private: diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h index adb5b60..d19890a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h @@ -50,7 +50,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } protected: @@ -61,7 +61,6 @@ private: virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); - virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); @@ -70,7 +69,7 @@ private: virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); - virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); virtual double toNumber(ExecState*) const; virtual UString toString(ExecState*) const; diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h index 4b28a99..9b726e8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -24,7 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "APIShims.h" #include "APICast.h" #include "Error.h" #include "JSCallbackFunction.h" @@ -80,7 +79,7 @@ void JSCallbackObject::init(ExecState* exec) // initialize from base to derived for (int i = static_cast(initRoutines.size()) - 1; i >= 0; i--) { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); JSObjectInitializeCallback initialize = initRoutines[i]; initialize(toRef(exec), toRef(this)); } @@ -118,7 +117,7 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifie if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { if (!propertyNameRef) propertyNameRef = OpaqueJSString::create(propertyName.ustring()); - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); if (hasProperty(ctx, thisRef, propertyNameRef.get())) { slot.setCustom(this, callbackGetter); return true; @@ -129,18 +128,18 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifie JSValueRef exception = 0; JSValueRef value; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); } - if (exception) { - exec->setException(toJS(exec, exception)); - slot.setValue(jsUndefined()); - return true; - } + exec->setException(toJS(exec, exception)); if (value) { slot.setValue(toJS(exec, value)); return true; } + if (exception) { + slot.setValue(jsUndefined()); + return true; + } } if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { @@ -168,25 +167,6 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, unsigned proper } template -bool JSCallbackObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - PropertySlot slot; - if (getOwnPropertySlot(exec, propertyName, slot)) { - // Ideally we should return an access descriptor, but returning a value descriptor is better than nothing. - JSValue value = slot.getValue(exec, propertyName); - if (!exec->hadException()) - descriptor.setValue(value); - // We don't know whether the property is configurable, but assume it is. - descriptor.setConfigurable(true); - // We don't know whether the property is enumerable (we could call getOwnPropertyNames() to find out), but assume it isn't. - descriptor.setEnumerable(false); - return true; - } - - return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor); -} - -template void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { JSContextRef ctx = toRef(exec); @@ -201,11 +181,10 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName JSValueRef exception = 0; bool result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); if (result || exception) return; } @@ -220,11 +199,10 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName JSValueRef exception = 0; bool result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); if (result || exception) return; } else @@ -259,11 +237,10 @@ bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& p JSValueRef exception = 0; bool result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); if (result || exception) return true; } @@ -321,11 +298,10 @@ JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* construct JSValueRef exception = 0; JSObject* result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); return result; } } @@ -346,11 +322,10 @@ bool JSCallbackObject::hasInstance(ExecState* exec, JSValue value, JSValue JSValueRef exception = 0; bool result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = hasInstance(execRef, thisRef, valueRef, &exception); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); return result; } } @@ -385,11 +360,10 @@ JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, JSValueRef exception = 0; JSValue result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); } - if (exception) - exec->setException(toJS(exec, exception)); + exec->setException(toJS(exec, exception)); return result; } } @@ -399,14 +373,14 @@ JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, } template -void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) { JSContextRef execRef = toRef(exec); JSObjectRef thisRef = toRef(this); for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); getPropertyNames(execRef, thisRef, toRef(&propertyNames)); } @@ -416,7 +390,7 @@ void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameAr for (iterator it = staticValues->begin(); it != end; ++it) { UString::Rep* name = it->first.get(); StaticValueEntry* entry = it->second; - if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties))) + if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum)) propertyNames.add(Identifier(exec, name)); } } @@ -427,13 +401,13 @@ void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameAr for (iterator it = staticFunctions->begin(); it != end; ++it) { UString::Rep* name = it->first.get(); StaticFunctionEntry* entry = it->second; - if (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties)) + if (!(entry->attributes & kJSPropertyAttributeDontEnum)) propertyNames.add(Identifier(exec, name)); } } } - Base::getOwnPropertyNames(exec, propertyNames, mode); + Base::getOwnPropertyNames(exec, propertyNames); } template @@ -452,7 +426,7 @@ double JSCallbackObject::toNumber(ExecState* exec) const JSValueRef exception = 0; JSValueRef value; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); } if (exception) { @@ -461,8 +435,7 @@ double JSCallbackObject::toNumber(ExecState* exec) const } double dValue; - if (value) - return toJS(exec, value).getNumber(dValue) ? dValue : NaN; + return toJS(exec, value).getNumber(dValue) ? dValue : NaN; } return Base::toNumber(exec); @@ -479,15 +452,14 @@ UString JSCallbackObject::toString(ExecState* exec) const JSValueRef exception = 0; JSValueRef value; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); value = convertToType(ctx, thisRef, kJSTypeString, &exception); } if (exception) { exec->setException(toJS(exec, exception)); return ""; } - if (value) - return toJS(exec, value).getString(exec); + return toJS(exec, value).getString(); } return Base::toString(exec); @@ -532,17 +504,16 @@ JSValue JSCallbackObject::staticValueGetter(ExecState* exec, const Identif JSValueRef exception = 0; JSValueRef value; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } - if (exception) { - exec->setException(toJS(exec, exception)); - return jsUndefined(); - } + exec->setException(toJS(exec, exception)); if (value) return toJS(exec, value); + if (exception) + return jsUndefined(); } - + return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); } @@ -586,15 +557,14 @@ JSValue JSCallbackObject::callbackGetter(ExecState* exec, const Identifier JSValueRef exception = 0; JSValueRef value; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } - if (exception) { - exec->setException(toJS(exec, exception)); - return jsUndefined(); - } + exec->setException(toJS(exec, exception)); if (value) return toJS(exec, value); + if (exception) + return jsUndefined(); } return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist."); diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp index 717488f..3785bab 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp @@ -33,28 +33,11 @@ #include #include #include -#include -using namespace std; using namespace JSC; -using namespace WTF::Unicode; const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static inline UString tryCreateStringFromUTF8(const char* string) -{ - if (!string) - return UString::null(); - - size_t length = strlen(string); - Vector buffer(length); - UChar* p = buffer.data(); - if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length)) - return UString::null(); - - return UString(buffer.data(), p - buffer.data()); -} - OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass) : parentClass(definition->parentClass) , prototypeClass(0) @@ -69,7 +52,7 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* , callAsConstructor(definition->callAsConstructor) , hasInstance(definition->hasInstance) , convertToType(definition->convertToType) - , m_className(tryCreateStringFromUTF8(definition->className)) + , m_className(UString::Rep::createFromUTF8(definition->className)) , m_staticValues(0) , m_staticFunctions(0) { @@ -78,14 +61,8 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* if (const JSStaticValue* staticValue = definition->staticValues) { m_staticValues = new OpaqueJSClassStaticValuesTable(); while (staticValue->name) { - UString valueName = tryCreateStringFromUTF8(staticValue->name); - if (!valueName.isNull()) { - // Use a local variable here to sidestep an RVCT compiler bug. - StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes); - UStringImpl* impl = valueName.rep(); - impl->ref(); - m_staticValues->add(impl, entry); - } + StaticValueEntry* e = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes); + m_staticValues->add(UString::Rep::createFromUTF8(staticValue->name), e); ++staticValue; } } @@ -93,14 +70,8 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* if (const JSStaticFunction* staticFunction = definition->staticFunctions) { m_staticFunctions = new OpaqueJSClassStaticFunctionsTable(); while (staticFunction->name) { - UString functionName = tryCreateStringFromUTF8(staticFunction->name); - if (!functionName.isNull()) { - // Use a local variable here to sidestep an RVCT compiler bug. - StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes); - UStringImpl* impl = functionName.rep(); - impl->ref(); - m_staticFunctions->add(impl, entry); - } + StaticFunctionEntry* e = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes); + m_staticFunctions->add(UString::Rep::createFromUTF8(staticFunction->name), e); ++staticFunction; } } @@ -111,12 +82,12 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* OpaqueJSClass::~OpaqueJSClass() { - ASSERT(!m_className.rep()->isIdentifier()); + ASSERT(!m_className.rep()->identifierTable()); if (m_staticValues) { OpaqueJSClassStaticValuesTable::const_iterator end = m_staticValues->end(); for (OpaqueJSClassStaticValuesTable::const_iterator it = m_staticValues->begin(); it != end; ++it) { - ASSERT(!it->first->isIdentifier()); + ASSERT(!it->first->identifierTable()); delete it->second; } delete m_staticValues; @@ -125,7 +96,7 @@ OpaqueJSClass::~OpaqueJSClass() if (m_staticFunctions) { OpaqueJSClassStaticFunctionsTable::const_iterator end = m_staticFunctions->end(); for (OpaqueJSClassStaticFunctionsTable::const_iterator it = m_staticFunctions->begin(); it != end; ++it) { - ASSERT(!it->first->isIdentifier()); + ASSERT(!it->first->identifierTable()); delete it->second; } delete m_staticFunctions; @@ -144,46 +115,56 @@ static void clearReferenceToPrototype(JSObjectRef prototype) { OpaqueJSClassContextData* jsClassData = static_cast(JSObjectGetPrivate(prototype)); ASSERT(jsClassData); - jsClassData->cachedPrototype.clear(toJS(prototype)); + jsClassData->cachedPrototype = 0; } -PassRefPtr OpaqueJSClass::create(const JSClassDefinition* clientDefinition) +PassRefPtr OpaqueJSClass::create(const JSClassDefinition* definition) { - JSClassDefinition definition = *clientDefinition; // Avoid modifying client copy. + if (const JSStaticFunction* staticFunctions = definition->staticFunctions) { + // copy functions into a prototype class + JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; + protoDefinition.staticFunctions = staticFunctions; + protoDefinition.finalize = clearReferenceToPrototype; + + // We are supposed to use JSClassRetain/Release but since we know that we currently have + // the only reference to this class object we cheat and use a RefPtr instead. + RefPtr protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0)); - JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; - protoDefinition.finalize = clearReferenceToPrototype; - swap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype. - - // We are supposed to use JSClassRetain/Release but since we know that we currently have - // the only reference to this class object we cheat and use a RefPtr instead. - RefPtr protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0)); - return adoptRef(new OpaqueJSClass(&definition, protoClass.get())); + // remove functions from the original class + JSClassDefinition objectDefinition = *definition; + objectDefinition.staticFunctions = 0; + + return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass.get())); + } + + return adoptRef(new OpaqueJSClass(definition, 0)); } OpaqueJSClassContextData::OpaqueJSClassContextData(OpaqueJSClass* jsClass) : m_class(jsClass) + , cachedPrototype(0) { if (jsClass->m_staticValues) { staticValues = new OpaqueJSClassStaticValuesTable; OpaqueJSClassStaticValuesTable::const_iterator end = jsClass->m_staticValues->end(); for (OpaqueJSClassStaticValuesTable::const_iterator it = jsClass->m_staticValues->begin(); it != end; ++it) { - ASSERT(!it->first->isIdentifier()); - // Use a local variable here to sidestep an RVCT compiler bug. - StaticValueEntry* entry = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes); - staticValues->add(UString::Rep::create(it->first->data(), it->first->length()), entry); + ASSERT(!it->first->identifierTable()); + StaticValueEntry* e = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes); + staticValues->add(UString::Rep::createCopying(it->first->data(), it->first->size()), e); + } + } else staticValues = 0; + if (jsClass->m_staticFunctions) { staticFunctions = new OpaqueJSClassStaticFunctionsTable; OpaqueJSClassStaticFunctionsTable::const_iterator end = jsClass->m_staticFunctions->end(); for (OpaqueJSClassStaticFunctionsTable::const_iterator it = jsClass->m_staticFunctions->begin(); it != end; ++it) { - ASSERT(!it->first->isIdentifier()); - // Use a local variable here to sidestep an RVCT compiler bug. - StaticFunctionEntry* entry = new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes); - staticFunctions->add(UString::Rep::create(it->first->data(), it->first->length()), entry); + ASSERT(!it->first->identifierTable()); + StaticFunctionEntry* e = new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes); + staticFunctions->add(UString::Rep::createCopying(it->first->data(), it->first->size()), e); } } else @@ -260,5 +241,5 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec) jsClassData.cachedPrototype->setPrototype(prototype); } } - return jsClassData.cachedPrototype.get(); + return jsClassData.cachedPrototype; } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h index ae60aad..c4777dd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -77,7 +76,7 @@ struct OpaqueJSClassContextData : Noncopyable { OpaqueJSClassStaticValuesTable* staticValues; OpaqueJSClassStaticFunctionsTable* staticFunctions; - JSC::WeakGCPtr cachedPrototype; + JSC::JSObject* cachedPrototype; }; struct OpaqueJSClass : public ThreadSafeShared { diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp index 2c76338..e6626b7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp @@ -35,7 +35,7 @@ #include "JSObject.h" #include -#if OS(DARWIN) +#if PLATFORM(DARWIN) #include static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 @@ -46,7 +46,7 @@ using namespace JSC; JSContextGroupRef JSContextGroupCreate() { initializeThreading(); - return toRef(JSGlobalData::createNonDefault().releaseRef()); + return toRef(JSGlobalData::create().releaseRef()); } JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) @@ -63,7 +63,7 @@ void JSContextGroupRelease(JSContextGroupRef group) JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) { initializeThreading(); -#if OS(DARWIN) +#if PLATFORM(DARWIN) // When running on Tiger or Leopard, or if the application was linked before JSGlobalContextCreate was changed // to use a unique JSGlobalData, we use a shared one for compatibility. #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) @@ -74,7 +74,7 @@ JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSLock lock(LockForReal); return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); } -#endif // OS(DARWIN) +#endif // PLATFORM(DARWIN) return JSGlobalContextCreateInGroup(0, globalObjectClass); } @@ -84,9 +84,8 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass initializeThreading(); JSLock lock(LockForReal); - RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::createNonDefault(); - APIEntryShim entryShim(globalData.get(), false); + RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::create(); #if ENABLE(JSC_MULTIPLE_THREADS) globalData->makeUsableFromMultipleThreads(); @@ -109,9 +108,12 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + JSLock lock(exec); JSGlobalData& globalData = exec->globalData(); + + globalData.heap.registerThread(); + gcProtect(exec->dynamicGlobalObject()); globalData.ref(); return ctx; @@ -122,26 +124,25 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx) ExecState* exec = toJS(ctx); JSLock lock(exec); - JSGlobalData& globalData = exec->globalData(); - IdentifierTable* savedIdentifierTable = setCurrentIdentifierTable(globalData.identifierTable); - gcUnprotect(exec->dynamicGlobalObject()); + JSGlobalData& globalData = exec->globalData(); if (globalData.refCount() == 2) { // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain(). // The last reference was released, this is our last chance to collect. + ASSERT(!globalData.heap.protectedObjectCount()); + ASSERT(!globalData.heap.isBusy()); globalData.heap.destroy(); } else - globalData.heap.collectAllGarbage(); + globalData.heap.collect(); globalData.deref(); - - setCurrentIdentifierTable(savedIdentifierTable); } JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); // It is necessary to call toThisObject to get the wrapper object when used with WebCore. return toRef(exec->lexicalGlobalObject()->toThisObject(exec)); @@ -156,7 +157,8 @@ JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toGlobalRef(exec->lexicalGlobalObject()->globalExec()); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp index faaa4eb..06ef578 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp @@ -76,7 +76,8 @@ void JSClassRelease(JSClassRef jsClass) JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); if (!jsClass) return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient @@ -91,7 +92,8 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); @@ -101,7 +103,8 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0; if (!jsPrototype) @@ -115,7 +118,8 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); @@ -137,7 +141,8 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* result; if (argumentCount) { @@ -162,7 +167,8 @@ JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -182,7 +188,8 @@ JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSVal JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -202,7 +209,8 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -222,7 +230,8 @@ JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSV JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); return toRef(exec, jsObject->prototype()); @@ -231,7 +240,8 @@ JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); @@ -242,7 +252,8 @@ void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); @@ -252,7 +263,8 @@ bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); @@ -268,7 +280,8 @@ JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); Identifier name(propertyName->identifier(&exec->globalData())); @@ -291,7 +304,8 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); @@ -308,7 +322,8 @@ JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsi void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); @@ -324,7 +339,8 @@ void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned p bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); @@ -373,7 +389,8 @@ bool JSObjectIsFunction(JSContextRef, JSObjectRef object) JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); @@ -410,7 +427,8 @@ bool JSObjectIsConstructor(JSContextRef, JSObjectRef object) JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSObject* jsObject = toJS(object); @@ -448,7 +466,8 @@ JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef o { JSObject* jsObject = toJS(object); ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSGlobalData* globalData = &exec->globalData(); @@ -473,7 +492,7 @@ JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) { if (--array->refCount == 0) { - APIEntryShim entryShim(array->globalData, false); + JSLock lock(array->globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly); delete array; } } @@ -491,6 +510,9 @@ JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) { PropertyNameArray* propertyNames = toJS(array); - APIEntryShim entryShim(propertyNames->globalData()); + + propertyNames->globalData()->heap.registerThread(); + JSLock lock(propertyNames->globalData()->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + propertyNames->add(propertyName->identifier(propertyNames->globalData())); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h index 92135b1..c58b958 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h @@ -37,8 +37,7 @@ extern "C" { #endif -#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \ - && !(defined(__CC_ARM) || defined(__ARMCC__)) /* RVCT */ +#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) /*! @typedef JSChar @abstract A Unicode character. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp index a12cc34..2207181 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp @@ -28,7 +28,6 @@ #include #include "APICast.h" -#include "APIShims.h" #include "JSCallbackObject.h" #include @@ -42,14 +41,13 @@ #include // for std::min -using namespace JSC; - -::JSType JSValueGetType(JSContextRef ctx, JSValueRef value) +JSType JSValueGetType(JSContextRef ctx, JSValueRef value) { - ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + JSC::ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSC::JSLock lock(exec); - JSValue jsValue = toJS(exec, value); + JSC::JSValue jsValue = toJS(exec, value); if (jsValue.isUndefined()) return kJSTypeUndefined; @@ -65,10 +63,13 @@ using namespace JSC; return kJSTypeObject; } +using namespace JSC; // placed here to avoid conflict between JSC::JSType and JSType, above. + bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isUndefined(); @@ -77,7 +78,8 @@ bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) bool JSValueIsNull(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isNull(); @@ -86,7 +88,8 @@ bool JSValueIsNull(JSContextRef ctx, JSValueRef value) bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isBoolean(); @@ -95,7 +98,8 @@ bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isNumber(); @@ -104,7 +108,8 @@ bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) bool JSValueIsString(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isString(); @@ -113,7 +118,8 @@ bool JSValueIsString(JSContextRef ctx, JSValueRef value) bool JSValueIsObject(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.isObject(); @@ -122,7 +128,8 @@ bool JSValueIsObject(JSContextRef ctx, JSValueRef value) bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); @@ -138,7 +145,8 @@ bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsCla bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsA = toJS(exec, a); JSValue jsB = toJS(exec, b); @@ -155,18 +163,20 @@ bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* ex bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsA = toJS(exec, a); JSValue jsB = toJS(exec, b); - return JSValue::strictEqual(exec, jsA, jsB); + return JSValue::strictEqual(jsA, jsB); } bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); @@ -185,7 +195,8 @@ bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObject JSValueRef JSValueMakeUndefined(JSContextRef ctx) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toRef(exec, jsUndefined()); } @@ -193,7 +204,8 @@ JSValueRef JSValueMakeUndefined(JSContextRef ctx) JSValueRef JSValueMakeNull(JSContextRef ctx) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toRef(exec, jsNull()); } @@ -201,7 +213,8 @@ JSValueRef JSValueMakeNull(JSContextRef ctx) JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toRef(exec, jsBoolean(value)); } @@ -209,7 +222,8 @@ JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toRef(exec, jsNumber(exec, value)); } @@ -217,7 +231,8 @@ JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); return toRef(exec, jsString(exec, string->ustring())); } @@ -225,7 +240,8 @@ JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); return jsValue.toBoolean(exec); @@ -234,7 +250,8 @@ bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); @@ -251,7 +268,8 @@ double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); @@ -268,7 +286,8 @@ JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); JSValue jsValue = toJS(exec, value); @@ -285,17 +304,19 @@ JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exce void JSValueProtect(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); - JSValue jsValue = toJSForGC(exec, value); + JSValue jsValue = toJS(exec, value); gcProtect(jsValue); } void JSValueUnprotect(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - APIEntryShim entryShim(exec); + exec->globalData().heap.registerThread(); + JSLock lock(exec); - JSValue jsValue = toJSForGC(exec, value); + JSValue jsValue = toJS(exec, value); gcUnprotect(jsValue); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp index f740abe..7c7b1af 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp @@ -42,7 +42,7 @@ PassRefPtr OpaqueJSString::create(const UString& ustring) UString OpaqueJSString::ustring() const { if (this && m_characters) - return UString(m_characters, m_length); + return UString(m_characters, m_length, true); return UString::null(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index ccad6b3..6446773 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,7839 +1,164 @@ -2009-10-30 Tor Arne Vestbø - - Reviewed by NOBODY (OOPS!). - - [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() - - This ensures that long-running JavaScript (for example due to a modal alert() dialog), - will not trigger a deferred load after only 500ms (the default tokenizer delay) while - still giving a reasonable timeout (10 seconds) to prevent deadlock. - - https://bugs.webkit.org/show_bug.cgi?id=29381 - - * runtime/TimeoutChecker.h: Add getter for the timeout interval - -2010-02-19 Maciej Stachowiak - - Reviewed by David Levin. - - Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases - https://bugs.webkit.org/show_bug.cgi?id=35147 - - * Configurations/FeatureDefines.xcconfig: - -2010-02-19 Gavin Barraclough - - Reviewed by Oliver Hunt. - - JSString::getIndex() calls value() to resolve the string value (is a rope) - to a UString, then passes the result to jsSingleCharacterSubstring without - checking for an exception. In case of out-of-memory the returned UString - is null(), which may result in an out-of-buounds substring being created. - This is bad. - - Simple fix is to be able to get an index from a rope without resolving to - UString. This may be a useful optimization in some test cases. - - The same bug exists in some other methods is JSString, these can be fixed - by changing them to call getIndex(). - - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - (JSC::JSString::getStringPropertyDescriptor): - * runtime/JSString.h: - (JSC::jsSingleCharacterSubstring): - (JSC::JSString::getIndex): - (JSC::jsSingleCharacterString): - (JSC::JSString::getStringPropertySlot): - * runtime/UStringImpl.cpp: - (JSC::singleCharacterSubstring): - * runtime/UStringImpl.h: - (JSC::UStringImpl::singleCharacterSubstring): - -2010-02-19 Oliver Hunt - - RS = Gavin Barraclough. - - Split the 32/64 version of JITPropertyAccess into a separate file. - - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.pri: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - * JavaScriptCore.xcodeproj/project.pbxproj: - * jit/JITPropertyAccess.cpp: - * jit/JITPropertyAccess32_64.cpp: Added. - (JSC::JIT::emit_op_put_by_index): - (JSC::JIT::emit_op_put_getter): - (JSC::JIT::emit_op_put_setter): - (JSC::JIT::emit_op_del_by_id): - (JSC::JIT::emit_op_method_check): - (JSC::JIT::emitSlow_op_method_check): - (JSC::JIT::emit_op_get_by_val): - (JSC::JIT::emitSlow_op_get_by_val): - (JSC::JIT::emit_op_put_by_val): - (JSC::JIT::emitSlow_op_put_by_val): - (JSC::JIT::emit_op_get_by_id): - (JSC::JIT::emitSlow_op_get_by_id): - (JSC::JIT::emit_op_put_by_id): - (JSC::JIT::emitSlow_op_put_by_id): - (JSC::JIT::compileGetByIdHotPath): - (JSC::JIT::compileGetByIdSlowCase): - (JSC::JIT::compilePutDirectOffset): - (JSC::JIT::compileGetDirectOffset): - (JSC::JIT::testPrototype): - (JSC::JIT::privateCompilePutByIdTransition): - (JSC::JIT::patchGetByIdSelf): - (JSC::JIT::patchMethodCallProto): - (JSC::JIT::patchPutByIdReplace): - (JSC::JIT::privateCompilePatchGetArrayLength): - (JSC::JIT::privateCompileGetByIdProto): - (JSC::JIT::privateCompileGetByIdSelfList): - (JSC::JIT::privateCompileGetByIdProtoList): - (JSC::JIT::privateCompileGetByIdChainList): - (JSC::JIT::privateCompileGetByIdChain): - (JSC::JIT::emit_op_get_by_pname): - (JSC::JIT::emitSlow_op_get_by_pname): - -2010-02-19 Patrick Gansterer - - Reviewed by Laszlo Gombos. - - Added additional parameter to create_rvct_stubs - for setting the regularexpression prefix. - Renamed it because it now works for other platforms too. - https://bugs.webkit.org/show_bug.cgi?id=34951 - - * DerivedSources.pro: - * create_jit_stubs: Copied from JavaScriptCore/create_rvct_stubs. - * create_rvct_stubs: Removed. - -2010-02-18 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Improve interpreter getter performance - https://bugs.webkit.org/show_bug.cgi?id=35138 - - Improve the performance of getter dispatch by making it possible - for the interpreter to cache the GetterSetter object lookup. - - To do this we simply need to make PropertySlot aware of getters - as a potentially cacheable property, and record the base and this - objects for a getter access. This allows us to use more-or-less - identical code to that used by the normal get_by_id caching, with - the dispatch being the only actual difference. - - I'm holding off of implementing this in the JIT until I do some - cleanup to try and making coding in the JIT not be as horrible - as it is currently. - - * bytecode/CodeBlock.cpp: - (JSC::CodeBlock::dump): - (JSC::CodeBlock::derefStructures): - (JSC::CodeBlock::refStructures): - * bytecode/Opcode.h: - * interpreter/Interpreter.cpp: - (JSC::Interpreter::resolveGlobal): - (JSC::Interpreter::tryCacheGetByID): - (JSC::Interpreter::privateExecute): - * jit/JIT.cpp: - (JSC::JIT::privateCompileMainPass): - * jit/JITStubs.cpp: - (JSC::JITThunks::tryCacheGetByID): - (JSC::DEFINE_STUB_FUNCTION): - * runtime/JSObject.cpp: - (JSC::JSObject::fillGetterPropertySlot): - * runtime/PropertySlot.cpp: - (JSC::PropertySlot::functionGetter): - * runtime/PropertySlot.h: - (JSC::PropertySlot::isGetter): - (JSC::PropertySlot::isCacheable): - (JSC::PropertySlot::isCacheableValue): - (JSC::PropertySlot::setValueSlot): - (JSC::PropertySlot::setGetterSlot): - (JSC::PropertySlot::setCacheableGetterSlot): - (JSC::PropertySlot::clearOffset): - (JSC::PropertySlot::thisValue): - -2010-02-17 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Fixed a portion of: - | https://bugs.webkit.org/show_bug.cgi?id=28676 - Safari 4 does not release memory back to the operating system fast enough (28676) - - This patch fixes a surprisingly common edge case in which the page heap - would have only one free span, but that span would be larger than the - minimum free size, so we would decide not to free it, even though it - could be as large as 100MB or more! - - SunSpider reports no change on Mac or Windows. - - * wtf/FastMalloc.cpp: - (WTF::TCMalloc_PageHeap::scavenge): Call shouldContinueScavenging() instead - of doing the math ourselves. Don't keep a local value for pagesDecommitted - because that lets free_committed_pages_ be wrong temporarily. Instead, - update free_committed_pages_ as we go. ASSERT that we aren't releasing - a span that has already been released, because we think this is impossible. - Finally, don't be afraid to release all free memory in the page heap when - scavenging. We only scavenge after 5 seconds of the application's working - set not growing, and we keep both thread caches and a central cache on - top of the page heap, so the extra free pages in the page heap were just - overkill. - -2010-02-17 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=35070 - Addition of 2 strings of length 2^31 may result in a string of length 0. - - Check for overflow when creating a new JSString as a result of an addition - or concatenation, throw an out of memory exception. - - * runtime/JSString.h: - (JSC::): - * runtime/Operations.h: - (JSC::jsString): - -2010-02-17 Xan Lopez - - Reviewed by Gustavo Noronha. - - [Linux] Webkit incompatible with Java plugins - https://bugs.webkit.org/show_bug.cgi?id=24912 - - Add support for GFile to GOwnPtr. - - Based on original work by Gustavo Noronha. - - * wtf/gtk/GOwnPtr.cpp: - (WTF::GFile): - * wtf/gtk/GOwnPtr.h: - -2010-02-16 Gavin Barraclough - - Reviewed by Mark Rowe. - - Fix a handful of other leaks seen on the buildbot. - - * runtime/UStringImpl.h: - (JSC::UStringOrRopeImpl::deref): Delegate through to the subclass version of deref to ensure that - the correct cleanup takes place. This function previously featured some code that attempted to - skip deletion of static UStringImpl's. Closer inspection revealed that it was in fact equivalent - to "if (false)", meaning that UStringImpl's which had their final deref performed via this function - were leaked. - -2010-02-16 Mark Rowe - - Reviewed by Gavin Barraclough. - - Fix a handful of leaks seen on the buildbot. - - * runtime/UStringImpl.h: - (JSC::UStringOrRopeImpl::deref): Call URopeImpl::destructNonRecursive rather than delete - to ensure that the rope's fibers are also destroyed. - -2010-02-16 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=34964 - Leaks tool reports false memory leaks due to Rope implementation. - - A rope is a recursive data structure where each node in the rope holds a set of - pointers, each of which may reference either a string (in UStringImpl form) or - another rope node. A low bit in each pointer is used to distinguish between - rope & string elements, in a fashion similar to the recently-removed - PtrAndFlags class (see https://bugs.webkit.org/show_bug.cgi?id=33731 ). Again, - this causes a problem for Leaks – refactor to remove the magic pointer - mangling. - - Move Rope out from JSString.h and rename to URopeImpl, to match UStringImpl. - Give UStringImpl and URopeImpl a common parent class, UStringOrRopeImpl. - Repurpose an otherwise invalid permutation to flags (static & should report - memory cost) to identify ropes. - - This allows us to change the rope's fibers to interrogate the object rather - than storing a bool within the low bits of the pointer (or in some cases the - use of a common parent class removes the need to determine the type at all - - there is a common interface to ref or get the length of either ropes or strings). - - * API/JSClassRef.cpp: - (OpaqueJSClass::OpaqueJSClass): - (OpaqueJSClassContextData::OpaqueJSClassContextData): - * bytecompiler/BytecodeGenerator.cpp: - (JSC::keyForCharacterSwitch): - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncToString): - * runtime/Identifier.cpp: - (JSC::Identifier::equal): - (JSC::Identifier::addSlowCase): - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - * runtime/JSString.h: - (JSC::): - (JSC::RopeBuilder::JSString): - (JSC::RopeBuilder::~JSString): - (JSC::RopeBuilder::appendStringInConstruct): - (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): - (JSC::RopeBuilder::JSStringFinalizerStruct::JSStringFinalizerStruct): - (JSC::RopeBuilder::JSStringFinalizerStruct::): - * runtime/UString.cpp: - (JSC::UString::toStrictUInt32): - (JSC::equal): - * runtime/UString.h: - (JSC::UString::isEmpty): - (JSC::UString::size): - * runtime/UStringImpl.cpp: - (JSC::URopeImpl::derefFibersNonRecursive): - (JSC::URopeImpl::destructNonRecursive): - * runtime/UStringImpl.h: - (JSC::UStringOrRopeImpl::isRope): - (JSC::UStringOrRopeImpl::length): - (JSC::UStringOrRopeImpl::ref): - (JSC::UStringOrRopeImpl::): - (JSC::UStringOrRopeImpl::operator new): - (JSC::UStringOrRopeImpl::UStringOrRopeImpl): - (JSC::UStringImpl::adopt): - (JSC::UStringImpl::createUninitialized): - (JSC::UStringImpl::tryCreateUninitialized): - (JSC::UStringImpl::data): - (JSC::UStringImpl::cost): - (JSC::UStringImpl::deref): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::): - (JSC::URopeImpl::tryCreateUninitialized): - (JSC::URopeImpl::initializeFiber): - (JSC::URopeImpl::fiberCount): - (JSC::URopeImpl::fibers): - (JSC::URopeImpl::deref): - (JSC::URopeImpl::URopeImpl): - (JSC::URopeImpl::hasOneRef): - (JSC::UStringOrRopeImpl::deref): - -2010-02-15 Gabor Loki - - Reviewed by Gavin Barraclough. - - Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32) - https://bugs.webkit.org/show_bug.cgi?id=34939 - - * jit/JITStubs.cpp: - -2010-02-15 Gavin Barraclough - - Reviewed by NOBODY (Build Fix!). - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-02-15 Gavin Barraclough - - Reviewed by Oliver Hunt. - - Some general Rope related refactoring. - - Rename Rope::m_ropeLength to m_fiberCount, to be more descriptive. - Rename Rope::m_stringLength to simply m_length (since this is the - more conventional name for the length of a string). Move append - behaviour out into a new RopeBuilder class, so that Rope no longer - needs any knowledge of the JSString or UString implementation. - - Make Rope no longer be nested within JSString. - (Rope now no-longer need reside within JSString.h, but leaving - the change of moving this out to a different header as a separate - change from these renames). - - * JavaScriptCore.exp: - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * runtime/JSString.cpp: - (JSC::Rope::destructNonRecursive): - (JSC::Rope::~Rope): - (JSC::JSString::resolveRope): - (JSC::JSString::toBoolean): - (JSC::JSString::getStringPropertyDescriptor): - * runtime/JSString.h: - (JSC::Rope::Fiber::Fiber): - (JSC::Rope::Fiber::deref): - (JSC::Rope::Fiber::ref): - (JSC::Rope::Fiber::refAndGetLength): - (JSC::Rope::Fiber::isRope): - (JSC::Rope::Fiber::rope): - (JSC::Rope::Fiber::isString): - (JSC::Rope::Fiber::string): - (JSC::Rope::Fiber::nonFiber): - (JSC::Rope::tryCreateUninitialized): - (JSC::Rope::append): - (JSC::Rope::fiberCount): - (JSC::Rope::length): - (JSC::Rope::fibers): - (JSC::Rope::Rope): - (JSC::Rope::operator new): - (JSC::): - (JSC::RopeBuilder::JSString): - (JSC::RopeBuilder::~JSString): - (JSC::RopeBuilder::length): - (JSC::RopeBuilder::canGetIndex): - (JSC::RopeBuilder::appendStringInConstruct): - (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): - (JSC::RopeBuilder::isRope): - (JSC::RopeBuilder::fiberCount): - (JSC::JSString::getStringPropertySlot): - * runtime/Operations.h: - (JSC::jsString): - -2010-02-15 Gavin Barraclough - - Reviewed by NOBODY (Build fix). - - Add missing cast for !YARR (PPC) builds. - - * runtime/RegExp.cpp: - (JSC::RegExp::match): - -2010-02-14 Gavin Barraclough - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Many false leaks in release builds due to PtrAndFlags - - StructureTransitionTable was effectively a smart pointer type, - one machine word in size and wholly contained as a member of - of Structure. It either pointed to an actual table, or could - be used to describe a single transtion entry without use of a - table. - - This, however, worked by using a PtrAndFlags, which is not - compatible with the leaks tool. Since there is no clear way to - obtain another bit for 'free' here, and since there are bits - available up in Structure, merge this functionality back up into - Structure. Having this in a separate class was quite clean - from an enacapsulation perspective, but this solution doesn't - seem to bad - all table access is now intermediated through the - Structure::structureTransitionTableFoo methods, keeping the - optimization fairly well contained. - - This was the last use of PtrAndFlags, so removing the file too. - - * JavaScriptCore.xcodeproj/project.pbxproj: - * bytecode/CodeBlock.h: - * runtime/Structure.cpp: - (JSC::Structure::Structure): - (JSC::Structure::~Structure): - (JSC::Structure::addPropertyTransitionToExistingStructure): - (JSC::Structure::addPropertyTransition): - (JSC::Structure::hasTransition): - * runtime/Structure.h: - (JSC::Structure::): - (JSC::Structure::structureTransitionTableContains): - (JSC::Structure::structureTransitionTableGet): - (JSC::Structure::structureTransitionTableHasTransition): - (JSC::Structure::structureTransitionTableRemove): - (JSC::Structure::structureTransitionTableAdd): - (JSC::Structure::structureTransitionTable): - (JSC::Structure::setStructureTransitionTable): - (JSC::Structure::singleTransition): - (JSC::Structure::setSingleTransition): - * runtime/StructureTransitionTable.h: - * wtf/PtrAndFlags.h: Removed. - -2010-02-15 Gavin Barraclough - - Rubber Stamped by Geoff Garen. - - Bug 34948 - tryMakeString should fail on error in length calculation - - Ooops! - "bool overflow" argument should have been "bool& overflow". - - * runtime/UString.h: - (JSC::sumWithOverflow): - (JSC::tryMakeString): - -2010-02-15 Gavin Barraclough - - Reviewed by NOBODY (Build Fix (pt 2!)). - - Some symbol names have changed, remove, will readd if required. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-02-15 Gavin Barraclough - - Reviewed by NOBODY (Build Fix (pt 1?)). - - Some symbol names have changed, remove, will readd if required. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-02-15 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Removed some mistaken code added in http://trac.webkit.org/changeset/53860. - - * API/APIShims.h: - (JSC::APICallbackShim::APICallbackShim): - (JSC::APICallbackShim::~APICallbackShim): No need to start/stop the - timeout checker when calling out from the API to the client; we want to - monitor the VM for timeouts, not the client. This mistake was harmless / - undetectable, since it's totally redundant with the APIEntryShim, which - also starts / stops the timeout checker. - -2010-02-15 Gavin Barraclough - - Reviewed by Geoff Garen. - - Bug 34952 - String lengths in UString should be unsigned. - This matches WebCore::StringImpl, and better unifies behaviour throughout JSC. - - * JavaScriptCore.exp: - * bytecode/EvalCodeCache.h: - * runtime/Identifier.cpp: - (JSC::Identifier::equal): - * runtime/Identifier.h: - * runtime/JSGlobalObjectFunctions.cpp: - (JSC::globalFuncEscape): - * runtime/JSONObject.cpp: - (JSC::gap): - (JSC::Stringifier::indent): - * runtime/NumberPrototype.cpp: - (JSC::numberProtoFuncToFixed): - (JSC::numberProtoFuncToPrecision): - * runtime/RegExp.cpp: - (JSC::RegExp::match): - * runtime/StringPrototype.cpp: - (JSC::substituteBackreferencesSlow): - (JSC::stringProtoFuncReplace): - (JSC::stringProtoFuncSplit): - (JSC::trimString): - * runtime/UString.cpp: - (JSC::UString::UString): - (JSC::UString::from): - (JSC::UString::getCString): - (JSC::UString::ascii): - (JSC::UString::operator[]): - (JSC::UString::toStrictUInt32): - (JSC::UString::find): - (JSC::UString::rfind): - (JSC::UString::substr): - (JSC::operator<): - (JSC::operator>): - (JSC::compare): - (JSC::equal): - (JSC::UString::UTF8String): - * runtime/UString.h: - (JSC::UString::size): - (JSC::operator==): - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::create): - * runtime/UStringImpl.h: - (JSC::UStringImpl::create): - (JSC::UStringImpl::size): - (JSC::UStringImpl::computeHash): - (JSC::UStringImpl::UStringImpl): - -2010-02-15 Gavin Barraclough - - Reviewed by Geoff Garen. - - Bug 34948 - tryMakeString should fail on error in length calculation - - The sum of the length of substrings could overflow. - - * runtime/UString.h: - (JSC::sumWithOverflow): - (JSC::tryMakeString): - -2010-02-15 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Fixed Crash beneath JSGlobalContextRelease when - typing in Google search field with GuardMalloc/full page heap enabled - - * API/JSContextRef.cpp: Don't use APIEntryShim, since that requires - a JSGlobalData, which this function destroys. Do use setCurrentIdentifierTable - and JSLock instead, since those are the two features of APIEntryShim we - require. - -2010-02-15 Patrick Gansterer - - Reviewed by Laszlo Gombos. - - Added additional parameter to create_rvct_stubs - for setting the offset of thunkReturnAddress. - https://bugs.webkit.org/show_bug.cgi?id=34657 - - * create_rvct_stubs: - * jit/JITStubs.cpp: - -2010-02-15 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - Fix QScriptValue::toIntXX methods. - - More ECMA Script compliance. - - [Qt] QScriptValue::toIntXX returns incorrect values - https://bugs.webkit.org/show_bug.cgi?id=34847 - - * qt/api/qscriptvalue_p.h: - (QScriptValuePrivate::toInteger): - (QScriptValuePrivate::toInt32): - (QScriptValuePrivate::toUInt32): - (QScriptValuePrivate::toUInt16): - * qt/tests/qscriptvalue/tst_qscriptvalue.h: - * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: - (tst_QScriptValue::toInteger_initData): - (tst_QScriptValue::toInteger_makeData): - (tst_QScriptValue::toInteger_test): - (tst_QScriptValue::toInt32_initData): - (tst_QScriptValue::toInt32_makeData): - (tst_QScriptValue::toInt32_test): - (tst_QScriptValue::toUInt32_initData): - (tst_QScriptValue::toUInt32_makeData): - (tst_QScriptValue::toUInt32_test): - (tst_QScriptValue::toUInt16_initData): - (tst_QScriptValue::toUInt16_makeData): - (tst_QScriptValue::toUInt16_test): - -2010-02-14 Laszlo Gombos - - Reviewed by Adam Barth. - - Implement NEVER_INLINE and NO_RETURN for RVCT - https://bugs.webkit.org/show_bug.cgi?id=34740 - - * wtf/AlwaysInline.h: - -2010-02-12 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Remove uses of PtrAndFlags from JIT data stuctures. - - These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid - permutation of pointer states in MethodCallLinkInfo to represent the removed bits. - - * bytecode/CodeBlock.h: - (JSC::CallLinkInfo::seenOnce): - (JSC::CallLinkInfo::setSeen): - (JSC::MethodCallLinkInfo::MethodCallLinkInfo): - (JSC::MethodCallLinkInfo::seenOnce): - (JSC::MethodCallLinkInfo::setSeen): - * jit/JIT.cpp: - (JSC::JIT::unlinkCall): - * jit/JITPropertyAccess.cpp: - (JSC::JIT::patchMethodCallProto): - * runtime/UString.h: - -2010-02-12 Gavin Barraclough - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Many false leaks in release builds due to PtrAndFlags - - Remove UntypedPtrAndBitfield (similar to PtrAndFlags) in UStringImpl, - and steal bits from the refCount instead. - - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::baseSharedBuffer): - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UStringImpl::cost): - (JSC::UStringImpl::isIdentifier): - (JSC::UStringImpl::setIsIdentifier): - (JSC::UStringImpl::ref): - (JSC::UStringImpl::deref): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::bufferOwnership): - (JSC::UStringImpl::isStatic): - (JSC::UStringImpl::): - -2010-02-12 Geoffrey Garen - - Reviewed by Darin Adler. - - Removed an unnecessary data dependency from my last patch. - - * runtime/SmallStrings.cpp: - (JSC::SmallStrings::markChildren): Since isAnyStringMarked being false - is a condition of entering the loop, we can just use '=' instead of '|='. - -2010-02-12 Janne Koskinen - - Reviewed by Tor Arne Vestbø. - - Additional refptr/passrefptr workarounds for WINSCW compiler - https://bugs.webkit.org/show_bug.cgi?id=28054 - - * wtf/PassRefPtr.h: - (WTF::refIfNotNull): - (WTF::PassRefPtr::PassRefPtr): - (WTF::PassRefPtr::~PassRefPtr): - (WTF::PassRefPtr::clear): - (WTF::::operator): - * wtf/RefPtr.h: - (WTF::RefPtr::RefPtr): - (WTF::::operator): - -2010-02-12 Janne Koskinen - - Reviewed by Simon Hausmann. - - Don't import the cmath functions from std:: for WINSCW. - - * wtf/MathExtras.h: - -2010-02-12 Kwang Yul Seo - - Reviewed by Adam Barth. - - Typedef both JSChar and UChar to wchar_t in RVCT. - https://bugs.webkit.org/show_bug.cgi?id=34560 - - Define both JSChar and UChar to wchar_t as the size - of wchar_t is 2 bytes in RVCT. - - * API/JSStringRef.h: - * wtf/unicode/qt4/UnicodeQt4.h: - -2010-02-11 Geoffrey Garen - - Reviewed by Oliver Hunt and Darin Adler. - - The rest of the fix for - https://bugs.webkit.org/show_bug.cgi?id=34864 | - Many objects left uncollected after visiting mail.google.com and closing - window - - Don't unconditionally hang onto small strings. Instead, hang onto all - small strings as long as any small string is still referenced. - - SunSpider reports no change. - - * runtime/Collector.cpp: - (JSC::Heap::markRoots): Mark the small strings cache last, so it can - check if anything else has kept any strings alive. - - * runtime/SmallStrings.cpp: - (JSC::isMarked): - (JSC::SmallStrings::markChildren): Only keep our strings alive if some - other reference to at least one of them exists, too. - -2010-02-11 Geoffrey Garen - - Reviewed by Gavin Barraclough. - - Some progress toward fixing - https://bugs.webkit.org/show_bug.cgi?id=34864 | - Many objects left uncollected after visiting mail.google.com and closing - window - - SunSpider reports no change. - - Keep weak references, rather than protected references, to cached for-in - property name enumerators. - - One problem with protected references is that a chain like - [ gc object 1 ] => [ non-gc object ] => [ gc object 2 ] - takes two GC passes to break, since the first pass collects [ gc object 1 ], - releasing [ non-gc object ] and unprotecting [ gc object 2 ], and only - then can a second pass collect [ gc object 2 ]. - - Another problem with protected references is that they can keep a bunch - of strings alive long after they're useful. In SunSpider and a few popular - websites, the size-speed tradeoff seems to favor weak references. - - * runtime/JSPropertyNameIterator.cpp: - (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Moved this constructor - into the .cpp file, since it's not used elsewhere. - - (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): Added a destructor - to support our weak reference. - - * runtime/JSPropertyNameIterator.h: - (JSC::Structure::setEnumerationCache): - (JSC::Structure::clearEnumerationCache): - (JSC::Structure::enumerationCache): Added a function for clearing a - Structure's enumeration cache, used by our new destructor. Also fixed - indentation to match the rest of the file. - - * runtime/Structure.h: Changed from protected pointer to weak pointer. - -2010-02-11 Chris Rogers - - Reviewed by David Levin. - - audio engine: add Complex number class - https://bugs.webkit.org/show_bug.cgi?id=34538 - - * wtf/Complex.h: Added. - (WebCore::complexFromMagnitudePhase): - -2010-02-10 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Added an SPI for asking about all the different live objects on the heap. - Useful for memory debugging. - - * JavaScriptCore.exp: Export the new SPI. - - * runtime/Collector.cpp: - (JSC::typeName): Use a little capitalization. Don't crash in the case of - a non-object cell, since it might just be an uninitialized cell. - - (JSC::Heap::objectTypeCounts): The new SPI. - - * runtime/Collector.h: - * runtime/CollectorHeapIterator.h: - (JSC::CollectorHeapIterator::advance): - (JSC::LiveObjectIterator::operator++): - (JSC::DeadObjectIterator::operator++): - (JSC::ObjectIterator::operator++): Made 2 tweaks to these iterators: - (1) Skip the last cell in the block, since it's a dummy sentinel, and - we don't want it to confuse the object count; (2) Fixed a logic error - in LiveObjectIterator that could cause it to iterate dead objects if - m_block were equal to m_heap.nextBlock and m_cell were less than - m_heap.nextCell. No test for this since I can't think of a way that this - could make WebKit behave badly. - -2010-02-11 Steve Block - - Reviewed by Darin Adler. - - Guard cmath using declarations in MathExtras.h on Android - https://bugs.webkit.org/show_bug.cgi?id=34840 - - Android does not provide these functions. - - * wtf/MathExtras.h: - -2010-02-08 Maciej Stachowiak - - Reviewed by Cameron Zwarich. - - Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose. - https://bugs.webkit.org/show_bug.cgi?id=34698 - - * Configurations/FeatureDefines.xcconfig: - -2010-02-10 Kevin Watters - - Reviewed by Kevin Ollivier. - - [wx] Add Windows complex text support and Mac support for containsCharacters. - - https://bugs.webkit.org/show_bug.cgi?id=34759 - - * wscript: - -2010-02-10 Alexey Proskuryakov - - Addressing issues found by style bot. - - * wtf/ValueCheck.h: Renamed header guard to match final file name. - - * wtf/Vector.h: (WTF::::checkConsistency): Remove braces around a one-line clause. - -2010-02-09 Alexey Proskuryakov - - Reviewed by Geoffrey Garen. - - https://bugs.webkit.org/show_bug.cgi?id=34490 - WebCore::ImageEventSender::dispatchPendingEvents() crashes in certain conditions - - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.vcproj/WTF/WTF.vcproj: - * JavaScriptCore.xcodeproj/project.pbxproj: - Added ValueCheck.h. - - * wtf/ValueCheck.h: Added. Moved code out of HashTraits, since it would be awkward to - include that from Vector.h. - (WTF::ValueCheck::checkConsistency): Allow null pointers, those are pretty consistent. - - * wtf/HashTraits.h: Moved value checking code out of here. - - * wtf/HashTable.h: (WTF::::checkTableConsistencyExceptSize): Updated for the above changes. - - * wtf/Vector.h: - (WTF::::checkConsistency): Check all vector elements. - (WTF::ValueCheck): Support checking a Vector as an element in other containers. Currently - unused. - -2010-02-10 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - Fix QScriptValue::toBool. - - Fix ECMA compliance in the QScriptValue for values like 0, NaN and - empty strings. - - [Qt] QScriptValue::toBool problem - https://bugs.webkit.org/show_bug.cgi?id=34793 - - * qt/api/qscriptvalue_p.h: - (QScriptValuePrivate::toBool): - * qt/tests/qscriptvalue/tst_qscriptvalue.h: - * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: - (tst_QScriptValue::toBool_initData): - (tst_QScriptValue::toBool_makeData): - (tst_QScriptValue::toBool_test): - (tst_QScriptValue::toBoolean_initData): - (tst_QScriptValue::toBoolean_makeData): - (tst_QScriptValue::toBoolean_test): - -2009-10-06 Yongjun Zhang - - Reviewed by Simon Hausmann. - - Use derefIfNotNull() to work around WINSCW compiler forward declaration bug - - The compiler bug is reported at - https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812. - - The change should be reverted when the above bug is fixed in WINSCW compiler. - - https://bugs.webkit.org/show_bug.cgi?id=28054 - -2009-10-06 Yongjun Zhang - - Reviewed by Simon Hausmann. - - Get rid of WINSCW hack for UnSpecifiedBoolType - - Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make the WINSCW - compiler work with the default UnSpecifiedBoolType() operator. - - https://bugs.webkit.org/show_bug.cgi?id=28054 - - * wtf/RefPtr.h: - -2010-02-09 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - New functions nullValue() and undefinedValue(). - - [Qt] QScriptEngine should contain nullValue and undefinedValue methods - https://bugs.webkit.org/show_bug.cgi?id=34749 - - * qt/api/qscriptengine.cpp: - (QScriptEngine::nullValue): - (QScriptEngine::undefinedValue): - * qt/api/qscriptengine.h: - * qt/tests/qscriptengine/tst_qscriptengine.cpp: - (tst_QScriptEngine::nullValue): - (tst_QScriptEngine::undefinedValue): - -2010-02-09 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - Fixes for QScriptValue::toNumber(). - - Fix ECMA compliance in QScriptValue for values unbound - to a QScriptEngine. - - [Qt] QScriptValue::toNumber() is broken - https://bugs.webkit.org/show_bug.cgi?id=34592 - - * qt/api/qscriptvalue_p.h: - (QScriptValuePrivate::toNumber): - * qt/tests/qscriptvalue/tst_qscriptvalue.h: - * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: - (tst_QScriptValue::toNumber_initData): - (tst_QScriptValue::toNumber_makeData): - (tst_QScriptValue::toNumber_test): - -2010-02-09 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - Fix QScriptValue::isNumber(). - - The isNumber() should return 'true' if the value is in the CNumber - state. - - [Qt] QScriptValue::isNumber() returns an incorrect value - https://bugs.webkit.org/show_bug.cgi?id=34575 - - * qt/api/qscriptvalue_p.h: - (QScriptValuePrivate::isNumber): - * qt/tests/qscriptvalue/tst_qscriptvalue.h: - * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: - (tst_QScriptValue::isNumber_initData): - (tst_QScriptValue::isNumber_makeData): - (tst_QScriptValue::isNumber_test): - -2010-02-09 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Small refactoring to the small strings cache to allow it to be cleared - dynamically. - - * runtime/SmallStrings.cpp: - (JSC::SmallStrings::SmallStrings): - (JSC::SmallStrings::clear): - * runtime/SmallStrings.h: Moved initialization code into a shared function, - and changed the constructor to call it. - -2010-02-09 Gavin Barraclough - - Rubber Stamped by Geoff Garen. - - Rename StringBuilder::release && JSStringBuilder::releaseJSString - to 'build()'. - - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncToLocaleString): - (JSC::arrayProtoFuncJoin): - * runtime/Executable.cpp: - (JSC::FunctionExecutable::paramString): - * runtime/FunctionConstructor.cpp: - (JSC::constructFunction): - * runtime/JSGlobalObjectFunctions.cpp: - (JSC::encode): - (JSC::decode): - (JSC::globalFuncEscape): - (JSC::globalFuncUnescape): - * runtime/JSONObject.cpp: - (JSC::Stringifier::stringify): - * runtime/JSStringBuilder.h: - (JSC::JSStringBuilder::build): - * runtime/LiteralParser.cpp: - (JSC::LiteralParser::Lexer::lexString): - * runtime/NumberPrototype.cpp: - (JSC::integerPartNoExp): - (JSC::numberProtoFuncToFixed): - * runtime/StringBuilder.h: - (JSC::StringBuilder::build): - -2010-02-09 John Sullivan - - https://bugs.webkit.org/show_bug.cgi?id=34772 - Overzealous new assertion in URStringImpl::adopt() - - Reviewed by Adam Barth. - - * runtime/UStringImpl.h: - (JSC::UStringImpl::adopt): - Only assert that vector.data() is non-zero if vector.size() is non-zero. - -2010-02-09 Nikolas Zimmermann - - Not reviewed. Try to fix build problem on SnowLeopard slaves to bring them back. - - * API/JSClassRef.cpp: - (tryCreateStringFromUTF8): Mark method as 'static inline' to suppress "warning: no previous prototype for ..." - -2010-02-09 Gavin Barraclough - - Reviewed by Oliver Hunt. - - Three small string fixes: - (1) StringBuilder::release should CRASH if the buffer allocation failed. - (2) Remove weird, dead code from JSString::tryGetValue, replace with an ASSERT. - (3) Move UString::createFromUTF8 out to the API, as tryCreateStringFromUTF8. - This is only used from the API, and (now) unlike other UString::create - methods may return UString::null() to indicate failure cases. Better - handle these in the API. - - * API/JSClassRef.cpp: - (tryCreateStringFromUTF8): - (OpaqueJSClass::OpaqueJSClass): - (OpaqueJSClassContextData::OpaqueJSClassContextData): - * runtime/JSString.h: - (JSC::Fiber::tryGetValue): - * runtime/StringBuilder.h: - (JSC::StringBuilder::release): - * runtime/UString.cpp: - (JSC::UString::UString): - (JSC::UString::from): - (JSC::UString::find): - * runtime/UString.h: - -2010-02-09 Janne Koskinen - - Reviewed by Laszlo Gombos. - - [Qt] use nanval() for Symbian as nonInlineNaN - https://bugs.webkit.org/show_bug.cgi?id=34170 - - numeric_limits::quiet_NaN is broken in Symbian - causing NaN to be evaluated as a number. - - * runtime/JSValue.cpp: - (JSC::nonInlineNaN): - -2010-02-09 Tamas Szirbucz - - Reviewed by Gavin Barraclough. - - Add a soft modulo operation to ARM JIT using a trampoline function. - The performance progression is about ~1.8% on ARMv7 - https://bugs.webkit.org/show_bug.cgi?id=34424 - - Developed in cooperation with Gabor Loki. - - * jit/JIT.h: - * jit/JITArithmetic.cpp: - (JSC::JIT::emit_op_mod): - (JSC::JIT::emitSlow_op_mod): - * jit/JITOpcodes.cpp: - (JSC::JIT::softModulo): - * jit/JITStubs.h: - (JSC::JITThunks::ctiSoftModulo): - * wtf/Platform.h: - -2010-02-08 Gavin Barraclough - - Reviewed by NOBODY (SL/win build fixes). - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * runtime/StringPrototype.cpp: - -2010-02-08 Gavin Barraclough - - Reviewed by Oliver Hunt - - Make String.replace throw an exception on out-of-memory, rather than - returning a null (err, empty-ish) string. Move String::replaceRange - and String::spliceSubstringsWithSeparators out to StringPrototype - - these were fairly specific use anyway, and we can better integrate - throwing the JS expcetion this way. - - Also removes redundant assignment operator from UString. - - * JavaScriptCore.exp: - * runtime/StringPrototype.cpp: - (JSC::StringRange::StringRange): - (JSC::jsSpliceSubstringsWithSeparators): - (JSC::jsReplaceRange): - (JSC::stringProtoFuncReplace): - * runtime/UString.cpp: - * runtime/UString.h: - -2010-02-08 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Undefine WTF_OS_WINDOWS and WTF_PLATFORM_WIN - https://bugs.webkit.org/show_bug.cgi?id=34561 - - As the binary for simulator is built with MSVC 2005, - WTF_OS_WINDOWS and WTF_PLATFORM_WIN are defined. - Undefine them as we don't target Windows. - - * wtf/Platform.h: - -2010-02-08 Chris Rogers - - Reviewed by Darin Adler. - - audio engine: add Vector3 class - https://bugs.webkit.org/show_bug.cgi?id=34548 - - * wtf/Vector3.h: Added. - (WebCore::Vector3::Vector3): - (WebCore::Vector3::abs): - (WebCore::Vector3::isZero): - (WebCore::Vector3::normalize): - (WebCore::Vector3::x): - (WebCore::Vector3::y): - (WebCore::Vector3::z): - (WebCore::operator+): - (WebCore::operator-): - (WebCore::operator*): - (WebCore::dot): - (WebCore::cross): - (WebCore::distance): - -2010-02-08 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Fix warning in clang++ - - * runtime/Structure.h: - (JSC::Structure::propertyStorageSize): - -2010-02-08 Gavin Barraclough - - Reviewed by Geoff Garen. - - Make makeString CRASH if we fail to allocate a string. - - (tryMakeString or jsMakeNontrivialString can be used where we - expect allocation may fail and want to handle the error). - - * runtime/JSStringBuilder.h: - (JSC::jsMakeNontrivialString): - * runtime/UString.h: - (JSC::tryMakeString): - (JSC::makeString): - -2010-02-08 Gavin Barraclough - - Rubber Stamped by Oliver Hunt. - - Remove a couple of unnecesary C-style casts spotted by Darin. - - * runtime/JSGlobalObjectFunctions.cpp: - (JSC::encode): - (JSC::globalFuncEscape): - -2010-02-08 Gavin Barraclough - - Reviewed by Geoff Garen. - - Switch some more StringBuilder/jsNontrivialString code to use - JSStringBuilder/jsMakeNontrivialString - these methods will - throw an exception if we hit out-of-memory, rather than just - CRASHing. - - * runtime/FunctionPrototype.cpp: - (JSC::functionProtoFuncToString): - * runtime/JSGlobalObjectFunctions.cpp: - (JSC::encode): - (JSC::decode): - (JSC::globalFuncEscape): - -2010-02-08 Gavin Barraclough - - Reviewed by Sam Weinig. - - Use an empty identifier instead of a null identifier for parse - tokens without an identifier. - - This helps encapsulate the null UStringImpl within UString. - - * parser/Grammar.y: - * parser/NodeConstructors.h: - (JSC::ContinueNode::ContinueNode): - (JSC::BreakNode::BreakNode): - (JSC::ForInNode::ForInNode): - * runtime/CommonIdentifiers.cpp: - (JSC::CommonIdentifiers::CommonIdentifiers): - * runtime/CommonIdentifiers.h: - * runtime/FunctionPrototype.cpp: - (JSC::FunctionPrototype::FunctionPrototype): - -2010-02-08 Gustavo Noronha Silva - - Build fix for make distcheck. - - * GNUmakefile.am: - -2010-02-08 Simon Hausmann - - Unreviewed RVCT build fix. - - Similar to r54391, don't import the cmath functions from std:: for RVCT. - - * wtf/MathExtras.h: - -2010-02-05 Gavin Barraclough - - Reviewed by Geoff Garen. - - Change UStringImpl::create to CRASH if the string cannot be allocated, - rather than returning a null string (which will behave like a zero-length - string if used). - - Also move createRep function from UString to become new overloaded - UStringImpl::create methods. In doing so, bring their behaviour closer to - being in line with WebCore::StringImpl, in removing the behaviour that they - can be used to produce null UStrings (ASSERT the char* provided is non-null). - This behaviour of converting null C-strings to null UStrings is inefficient - (cmompared to just using UString::null()), incompatible with WebCore::StringImpl's - behaviour, and may generate unexpected behaviour, since in many cases a null - UString can be used like an empty string. - - With these changes UStringImpl need not have a concept of null impls, we can - start transitioning this to become an implementation detail of UString, that - internally it chooses to use a null-object rather than an actually zero impl - pointer. - - * JavaScriptCore.exp: - * debugger/Debugger.cpp: - (JSC::Debugger::recompileAllJSFunctions): - * debugger/DebuggerCallFrame.cpp: - (JSC::DebuggerCallFrame::calculatedFunctionName): - * parser/Parser.cpp: - (JSC::Parser::parse): - * profiler/Profile.cpp: - (JSC::Profile::Profile): - * profiler/ProfileGenerator.cpp: - (JSC::ProfileGenerator::stopProfiling): - * runtime/Error.cpp: - (JSC::Error::create): - (JSC::throwError): - * runtime/ExceptionHelpers.cpp: - (JSC::createError): - * runtime/Identifier.cpp: - (JSC::Identifier::add): - * runtime/PropertyNameArray.cpp: - (JSC::PropertyNameArray::add): - * runtime/UString.cpp: - (JSC::initializeUString): - (JSC::UString::UString): - (JSC::UString::operator=): - * runtime/UString.h: - (JSC::UString::isNull): - (JSC::UString::null): - (JSC::UString::rep): - (JSC::UString::UString): - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::create): - * runtime/UStringImpl.h: - -2010-02-05 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Define SYSTEM_MALLOC 1 - https://bugs.webkit.org/show_bug.cgi?id=34640 - - Make BREWMP use system malloc because FastMalloc is not ported. - - * wtf/Platform.h: - -2010-02-05 Kwang Yul Seo - - Reviewed by Alexey Proskuryakov. - - Don't call CRASH() in fastMalloc and fastCalloc when the requested memory size is 0 - https://bugs.webkit.org/show_bug.cgi?id=34569 - - With USE_SYSTEM_MALLOC=1, fastMalloc and fastCalloc call CRASH() - if the return value of malloc and calloc is 0. - - However, these functions can return 0 when the request size is 0. - Libc manual says, "If size is 0, then malloc() returns either NULL, - or a unique pointer value that can later be successfully passed to free()." - Though malloc returns a unique pointer in most systems, - 0 can be returned in some systems. For instance, BREW's MALLOC returns 0 - when size is 0. - - If malloc or calloc returns 0 due to allocation size, increase the size - to 1 and try again. - - * wtf/FastMalloc.cpp: - (WTF::fastMalloc): - (WTF::fastCalloc): - -2010-02-04 Mark Rowe - - Reviewed by Timothy Hatcher. - - Build fix. Remove a symbol corresponding to an inline function from the linker export - file to prevent a weak external failure. - - * JavaScriptCore.xcodeproj/project.pbxproj: Accommodate rename of script. - -2010-02-04 Daniel Bates - - [Qt] Unreviewed, build fix for Qt bot. - - * runtime/JSStringBuilder.h: Changed #include notation #include "X.h". - -2010-02-04 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Clearing a WeakGCPtr is weird - https://bugs.webkit.org/show_bug.cgi?id=34627 - - Added a WeakGCPtr::clear interface. - - As discussed in https://bugs.webkit.org/show_bug.cgi?id=33383, the old - interface made it pretty weird for a client to conditionally clear a - WeakGCPtr, which is exactly what clients want to do when objects are - finalized. - - * API/JSClassRef.cpp: - (clearReferenceToPrototype): Use the new WeakGCPtr::clear() interface. - - * runtime/WeakGCPtr.h: - (JSC::WeakGCPtr::clear): Added an interface for clearing a WeakGCPtr, - iff its current value is the value passed in. It's cumbersome for the - client to do this test, since WeakGCPtr sometimes pretends to be null. - -2010-02-04 Geoffrey Garen - - Build fix: export a header. - - * JavaScriptCore.xcodeproj/project.pbxproj: - -2010-02-04 Gavin Barraclough - - Reviewed by Oliver Hunt. - - Add a JSStringBuilder class (similar-to, and derived-from StringBuilder) to - construct JSStrings, throwing a JS exception should we run out of memory whilst - allocating storage for the string. - - Similarly, add jsMakeNontrivialString methods to use in cases where previously - we were calling makeString & passing the result to jsNontrivialString. Again, - these new methods throw if we hit an out of memory condition. - - Move throwOutOfMemoryError into ExceptionHelpers, to make it more widely available. - - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncToString): - (JSC::arrayProtoFuncToLocaleString): - (JSC::arrayProtoFuncJoin): - * runtime/DateConstructor.cpp: - (JSC::callDate): - * runtime/DatePrototype.cpp: - (JSC::dateProtoFuncToString): - (JSC::dateProtoFuncToUTCString): - (JSC::dateProtoFuncToGMTString): - * runtime/ErrorPrototype.cpp: - (JSC::errorProtoFuncToString): - * runtime/ExceptionHelpers.cpp: - (JSC::throwOutOfMemoryError): - * runtime/ExceptionHelpers.h: - * runtime/JSStringBuilder.h: Added. - (JSC::JSStringBuilder::releaseJSString): - (JSC::jsMakeNontrivialString): - * runtime/NumberPrototype.cpp: - (JSC::numberProtoFuncToPrecision): - * runtime/ObjectPrototype.cpp: - (JSC::objectProtoFuncToString): - * runtime/Operations.cpp: - * runtime/Operations.h: - * runtime/RegExpPrototype.cpp: - (JSC::regExpProtoFuncToString): - * runtime/StringBuilder.h: - (JSC::StringBuilder::append): - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncBig): - (JSC::stringProtoFuncSmall): - (JSC::stringProtoFuncBlink): - (JSC::stringProtoFuncBold): - (JSC::stringProtoFuncFixed): - (JSC::stringProtoFuncItalics): - (JSC::stringProtoFuncStrike): - (JSC::stringProtoFuncSub): - (JSC::stringProtoFuncSup): - (JSC::stringProtoFuncFontcolor): - (JSC::stringProtoFuncFontsize): - (JSC::stringProtoFuncAnchor): - -2010-02-04 Steve Falkenburg - - Windows build fix. - - * wtf/MathExtras.h: - -2010-02-04 Darin Adler - - Reviewed by David Levin. - - Make MathExtras.h compatible with - https://bugs.webkit.org/show_bug.cgi?id=34618 - - * wtf/MathExtras.h: Include instead of . - Use "using" as we do elsewhere in WTF for the four functions from - we want to use without the prefix. Later we could consider making the std - explicit at call sites instead. - -2010-02-04 Tamas Szirbucz - - Reviewed by Gavin Barraclough. - - Use an easily appendable structure for trampolines instead of pointer parameters. - https://bugs.webkit.org/show_bug.cgi?id=34424 - - * assembler/ARMAssembler.cpp: - (JSC::ARMAssembler::executableCopy): - * jit/JIT.h: - (JSC::JIT::compileCTIMachineTrampolines): - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * jit/JITStubs.cpp: - (JSC::JITThunks::JITThunks): - * jit/JITStubs.h: - (JSC::JITThunks::ctiStringLengthTrampoline): - (JSC::JITThunks::ctiVirtualCallLink): - (JSC::JITThunks::ctiVirtualCall): - (JSC::JITThunks::ctiNativeCallThunk): - -2010-02-04 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - Increase test coverage for the QScriptValue. - - https://bugs.webkit.org/show_bug.cgi?id=34533 - - * qt/tests/qscriptvalue/qscriptvalue.pro: - * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: - (tst_QScriptValue::tst_QScriptValue): - (tst_QScriptValue::~tst_QScriptValue): - (tst_QScriptValue::dataHelper): - (tst_QScriptValue::newRow): - (tst_QScriptValue::testHelper): - (tst_QScriptValue::ctor): - * qt/tests/qscriptvalue/tst_qscriptvalue.h: Added. - * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Added. - (tst_QScriptValue::initScriptValues): - (tst_QScriptValue::isValid_initData): - (tst_QScriptValue::isValid_makeData): - (tst_QScriptValue::isValid_test): - (tst_QScriptValue::isBool_initData): - (tst_QScriptValue::isBool_makeData): - (tst_QScriptValue::isBool_test): - (tst_QScriptValue::isBoolean_initData): - (tst_QScriptValue::isBoolean_makeData): - (tst_QScriptValue::isBoolean_test): - (tst_QScriptValue::isFunction_initData): - (tst_QScriptValue::isFunction_makeData): - (tst_QScriptValue::isFunction_test): - (tst_QScriptValue::isNull_initData): - (tst_QScriptValue::isNull_makeData): - (tst_QScriptValue::isNull_test): - (tst_QScriptValue::isString_initData): - (tst_QScriptValue::isString_makeData): - (tst_QScriptValue::isString_test): - (tst_QScriptValue::isUndefined_initData): - (tst_QScriptValue::isUndefined_makeData): - (tst_QScriptValue::isUndefined_test): - (tst_QScriptValue::isObject_initData): - (tst_QScriptValue::isObject_makeData): - (tst_QScriptValue::isObject_test): - -2010-02-03 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Define WTF_PLATFORM_BREWMP_SIMULATOR when AEE_SIMULATOR is defined - https://bugs.webkit.org/show_bug.cgi?id=34514 - - PLATFORM(BREWMP_SIMULATOR) guard is needed to make distinction between BREWMP - and BREWMP simulator. - - * wtf/Platform.h: - -2010-02-03 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Remove COMPILE_ASSERT conflict with the underlying PLATFORM - https://bugs.webkit.org/show_bug.cgi?id=34190 - - COMPILE_ASSERT conflicts with the underlying PLATFORM because it is defined - both in WTF's Assertions.h and BREWMP's AEEClassIDs.h. Include AEEClassIDs.h - in Assertions.h and undef COMPILE_ASSERT to avoid redefining COMPILE_ASSERT. - - * wtf/Assertions.h: - -2010-02-03 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Implement OwnPtrBrew to make sure BREW instances are freed. - https://bugs.webkit.org/show_bug.cgi?id=34518 - - Add OwnPtrBrew to release IFile, IFileMgr and IBitmap instances. - - * wtf/brew/OwnPtrBrew.cpp: Added. - (WTF::IFileMgr): - (WTF::IFile): - (WTF::IBitmap): - (WTF::freeOwnedPtrBrew): - * wtf/brew/OwnPtrBrew.h: Added. - (WTF::OwnPtrBrew::OwnPtrBrew): - (WTF::OwnPtrBrew::~OwnPtrBrew): - (WTF::OwnPtrBrew::get): - (WTF::OwnPtrBrew::release): - (WTF::OwnPtrBrew::outPtr): - (WTF::OwnPtrBrew::set): - (WTF::OwnPtrBrew::clear): - (WTF::OwnPtrBrew::operator*): - (WTF::OwnPtrBrew::operator->): - (WTF::OwnPtrBrew::operator!): - (WTF::OwnPtrBrew::operator UnspecifiedBoolType): - (WTF::OwnPtrBrew::swap): - (WTF::swap): - (WTF::operator==): - (WTF::operator!=): - (WTF::getPtr): - -2010-02-03 Kwang Yul Seo - - Reviewed by Darin Adler. - - Export WTF::fastStrDup symbol - https://bugs.webkit.org/show_bug.cgi?id=34526 - - * JavaScriptCore.exp: - -2010-02-03 Kevin Watters - - Reviewed by Kevin Ollivier. - - [wx] Enable JIT compilation for wx. - - https://bugs.webkit.org/show_bug.cgi?id=34536 - - * wtf/Platform.h: - -2010-02-02 Oliver Hunt - - Reviewed by Geoffrey Garen. - - Crash in CollectorBitmap::get at nbcolympics.com - https://bugs.webkit.org/show_bug.cgi?id=34504 - - This was caused by the use of m_offset to determine the offset of - a new property into the property storage. This patch corrects - the effected cases by incorporating the anonymous slot count. It - also removes the duplicate copy of anonymous slot count from the - property table as keeping this up to date merely increased the - chance of a mismatch. Finally I've added a large number of - assertions in an attempt to prevent such a bug from happening - again. - - With the new assertions in place the existing anonymous slot tests - all fail without the m_offset fixes. - - * runtime/PropertyMapHashTable.h: - * runtime/Structure.cpp: - (JSC::Structure::materializePropertyMap): - (JSC::Structure::addPropertyTransitionToExistingStructure): - (JSC::Structure::addPropertyTransition): - (JSC::Structure::removePropertyTransition): - (JSC::Structure::flattenDictionaryStructure): - (JSC::Structure::addPropertyWithoutTransition): - (JSC::Structure::removePropertyWithoutTransition): - (JSC::Structure::copyPropertyTable): - (JSC::Structure::get): - (JSC::Structure::put): - (JSC::Structure::remove): - (JSC::Structure::insertIntoPropertyMapHashTable): - (JSC::Structure::createPropertyMapHashTable): - (JSC::Structure::rehashPropertyMapHashTable): - (JSC::Structure::checkConsistency): - -2010-02-02 Steve Falkenburg - - Reviewed by Darin Adler. - - Copyright year updating for Windows version resources should be automatic - https://bugs.webkit.org/show_bug.cgi?id=34503 - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: - -2010-02-02 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Add dummy main thread functions - https://bugs.webkit.org/show_bug.cgi?id=33569 - - Add dummy initializeMainThreadPlatform and - scheduleDispatchFunctionsOnMainThread. - - * wtf/brew/MainThreadBrew.cpp: Added. - (WTF::initializeMainThreadPlatform): - (WTF::scheduleDispatchFunctionsOnMainThread): - -2010-02-02 Kwang Yul Seo - - Reviewed by Darin Adler. - - Add using WTF::getLocalTime to CurrentTime.h - https://bugs.webkit.org/show_bug.cgi?id=34493 - - * wtf/CurrentTime.h: - -2010-02-02 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Add HAVE_XXX definitions - https://bugs.webkit.org/show_bug.cgi?id=34414 - - Add HAVE_ERRNO_H=1 - - * wtf/Platform.h: - -2010-02-02 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Don't define HAVE_TM_GMTOFF, HAVE_TM_ZONE and HAVE_TIMEGM - https://bugs.webkit.org/show_bug.cgi?id=34388 - - BREWMP does not have these features. - - * wtf/Platform.h: - -2010-02-02 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Define WTF_PLATFORM_BREWMP=1 when BUILDING_BREWMP is defined - https://bugs.webkit.org/show_bug.cgi?id=34386 - - Define WTF_PLATFORM_BREWMP=1 so that PLATFORM(BREWMP) guard can be used. - - * wtf/Platform.h: - -2010-02-01 Kent Tamura - - Reviewed by Darin Adler. - - Date.UTC() should apply TimeClip operation. - https://bugs.webkit.org/show_bug.cgi?id=34461 - - ECMAScript 5 15.9.4.3: - > 9 Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))). - - * runtime/DateConstructor.cpp: - (JSC::dateUTC): Calls WTF::timeClip(). - -2010-02-01 Kent Tamura - - Reviewed by Darin Adler. - - Fix a bug that Math.round() retunrs incorrect results for huge integers - https://bugs.webkit.org/show_bug.cgi?id=34462 - - * runtime/MathObject.cpp: - (JSC::mathProtoFuncRound): Avoid "arg + 0.5". - -2010-02-01 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Port WTF's currentTime - https://bugs.webkit.org/show_bug.cgi?id=33567 - - Combine GETUTCSECONDS and GETTIMEMS to calculate the number - of milliseconds since 1970/01/01 00:00:00 UTC. - - * wtf/CurrentTime.cpp: - (WTF::currentTime): - -2010-02-01 Patrick Gansterer - - Reviewed by Darin Adler. - - [Qt] WinCE buildfix after r52729 and fix for Q_BIG_ENDIAN typo. - https://bugs.webkit.org/show_bug.cgi?id=34378 - - * wtf/Platform.h: - -2010-02-01 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Structure not accounting for anonymous slots when computing property storage size - https://bugs.webkit.org/show_bug.cgi?id=34441 - - Previously any Structure with anonymous storage would have a property map, so we - were only including anonymous slot size if there was a property map. Given this - is no longer the case we should always include the anonymous slot count in the - property storage size. - - * runtime/Structure.h: - (JSC::Structure::propertyStorageSize): - -2010-02-01 Oliver Hunt - - Windows build fix, update exports file (again) - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-02-01 Oliver Hunt - - Windows build fix, update exports file - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-31 Oliver Hunt - - Reviewed by Maciej Stachowiak. - - JSC is failing to propagate anonymous slot count on some transitions - https://bugs.webkit.org/show_bug.cgi?id=34321 - - Remove secondary Structure constructor, and make Structure store a copy - of the number of anonymous slots directly so saving an immediate allocation - of a property map for all structures with anonymous storage, which also - avoids the leaked property map on new property transition in the original - version of this patch. - - We need to propagate the the anonymous slot count otherwise we can end up - with a structure recording incorrect information about the available and - needed space for property storage, or alternatively incorrectly reusing - some slots. - - * JavaScriptCore.exp: - * runtime/Structure.cpp: - (JSC::Structure::Structure): - (JSC::Structure::materializePropertyMap): - (JSC::Structure::addPropertyTransition): - (JSC::Structure::changePrototypeTransition): - (JSC::Structure::despecifyFunctionTransition): - (JSC::Structure::getterSetterTransition): - (JSC::Structure::toDictionaryTransition): - (JSC::Structure::flattenDictionaryStructure): - (JSC::Structure::copyPropertyTable): - (JSC::Structure::put): - (JSC::Structure::remove): - (JSC::Structure::insertIntoPropertyMapHashTable): - (JSC::Structure::createPropertyMapHashTable): - * runtime/Structure.h: - (JSC::Structure::create): - (JSC::Structure::hasAnonymousSlots): - (JSC::Structure::anonymousSlotCount): - -2010-01-31 Patrick Gansterer - - Reviewed by Darin Adler. - - Buildfix for WinCE + style fixes (TLS_OUT_OF_INDEXES is not defined). - https://bugs.webkit.org/show_bug.cgi?id=34380 - - * wtf/ThreadSpecific.h: - -2010-01-31 Kent Tamura - - Reviewed by Darin Adler. - - [Windows] Fix a bug of round() with huge integral numbers - https://bugs.webkit.org/show_bug.cgi?id=34297 - - Fix a bug that round() for huge integral numbers returns incorrect - results. For example, round(8639999913600001) returns - 8639999913600002 without this change though the double type can - represent 8639999913600001 precisely. - - Math.round() of JavaScript has a similar problem. But this change - doesn't fix it because Math.round() doesn't use round() of - MathExtra.h. - - * wtf/MathExtras.h: - (round): Avoid to do "num + 0.5" or "num - 0.5". - (roundf): Fixed similarly. - (llround): Calls round(). - (llroundf): Calls roundf(). - (lround): Calls round(). - (lroundf): Calls roundf(). - -2010-01-29 Mark Rowe - - Sort Xcode projects. - - * JavaScriptCore.xcodeproj/project.pbxproj: - -2010-01-29 Mark Rowe - - Fix the Mac build. - - Disable ENABLE_INDEXED_DATABASE since it is "completely non-functional". - - As the comment in FeatureDefines.xcconfig notes, the list of feature defines - needs to be kept in sync across the various files. The default values also - need to be kept in sync between these files and build-webkit. - - * Configurations/FeatureDefines.xcconfig: - -2010-01-29 Simon Hausmann - - Rubber-stamped by Maciej Stachowiak. - - Fix the ARM build. - - * runtime/JSNumberCell.h: - (JSC::JSNumberCell::createStructure): Call the right Structure::create overload. - -2010-01-28 Kevin Ollivier - - [wx] Build fix for MSW, use ThreadingWin.cpp as the Windows pthreads implementation - implements pthread_t in a way that makes it impossible to check its validity, - which is needed by ThreadingPthreads.cpp. - - * wscript: - -2010-01-28 Oliver Hunt - - Reviewed by Gavin Barraclough. - - DOM Objects shouldn't all require custom mark functions - https://bugs.webkit.org/show_bug.cgi?id=34291 - - Make getAnonymousValue const-friendly - - * runtime/JSObject.h: - (JSC::JSObject::getAnonymousValue): - -2010-01-28 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Simplify anonymous slot implementation - https://bugs.webkit.org/show_bug.cgi?id=34282 - - A class must now specify the number of slots it needs at construction time - rather than later on with a transition. This makes many things simpler, - we no longer need to need an additional transition on object creation to - add the anonymous slots, and we remove the need for a number of transition - type checks. - - * API/JSCallbackConstructor.h: - (JSC::JSCallbackConstructor::createStructure): - * API/JSCallbackFunction.h: - (JSC::JSCallbackFunction::createStructure): - * API/JSCallbackObject.h: - (JSC::JSCallbackObject::createStructure): - * JavaScriptCore.exp: - * debugger/DebuggerActivation.h: - (JSC::DebuggerActivation::createStructure): - * runtime/Arguments.h: - (JSC::Arguments::createStructure): - * runtime/BooleanObject.h: - (JSC::BooleanObject::createStructure): - * runtime/DateInstance.h: - (JSC::DateInstance::createStructure): - * runtime/DatePrototype.h: - (JSC::DatePrototype::createStructure): - * runtime/FunctionPrototype.h: - (JSC::FunctionPrototype::createStructure): - * runtime/GetterSetter.h: - (JSC::GetterSetter::createStructure): - * runtime/GlobalEvalFunction.h: - (JSC::GlobalEvalFunction::createStructure): - * runtime/InternalFunction.h: - (JSC::InternalFunction::createStructure): - * runtime/JSAPIValueWrapper.h: - (JSC::JSAPIValueWrapper::createStructure): - * runtime/JSActivation.h: - (JSC::JSActivation::createStructure): - * runtime/JSArray.h: - (JSC::JSArray::createStructure): - * runtime/JSByteArray.cpp: - (JSC::JSByteArray::createStructure): - * runtime/JSCell.h: - (JSC::JSCell::createDummyStructure): - * runtime/JSFunction.h: - (JSC::JSFunction::createStructure): - * runtime/JSGlobalObject.h: - (JSC::JSGlobalObject::createStructure): - * runtime/JSNotAnObject.h: - (JSC::JSNotAnObject::createStructure): - * runtime/JSONObject.h: - (JSC::JSONObject::createStructure): - * runtime/JSObject.h: - (JSC::JSObject::createStructure): - (JSC::JSObject::putAnonymousValue): - (JSC::JSObject::getAnonymousValue): - * runtime/JSPropertyNameIterator.h: - (JSC::JSPropertyNameIterator::createStructure): - * runtime/JSStaticScopeObject.h: - (JSC::JSStaticScopeObject::createStructure): - * runtime/JSString.h: - (JSC::Fiber::createStructure): - * runtime/JSVariableObject.h: - (JSC::JSVariableObject::createStructure): - * runtime/JSWrapperObject.h: - (JSC::JSWrapperObject::createStructure): - (JSC::JSWrapperObject::JSWrapperObject): - * runtime/MathObject.h: - (JSC::MathObject::createStructure): - * runtime/NumberConstructor.h: - (JSC::NumberConstructor::createStructure): - * runtime/NumberObject.h: - (JSC::NumberObject::createStructure): - * runtime/RegExpConstructor.h: - (JSC::RegExpConstructor::createStructure): - * runtime/RegExpObject.h: - (JSC::RegExpObject::createStructure): - * runtime/StringObject.h: - (JSC::StringObject::createStructure): - * runtime/StringObjectThatMasqueradesAsUndefined.h: - (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): - * runtime/Structure.cpp: - (JSC::Structure::~Structure): - (JSC::Structure::materializePropertyMap): - * runtime/Structure.h: - (JSC::Structure::create): - (JSC::Structure::anonymousSlotCount): - * runtime/StructureTransitionTable.h: - -2010-01-27 Oliver Hunt - - Windows build fix. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-27 Oliver Hunt - - Reviewed by Maciej Stachowiak. - - MessageEvent.data should deserialize in the context of the MessageEvent's global object - https://bugs.webkit.org/show_bug.cgi?id=34227 - - Add logic to allow us to create an Object, Array, or Date instance - so we can create them in the context of a specific global object, - rather than just using the current lexical global object. - - * JavaScriptCore.exp: - * runtime/DateInstance.cpp: - (JSC::DateInstance::DateInstance): - * runtime/DateInstance.h: - * runtime/JSGlobalObject.h: - (JSC::constructEmptyObject): - (JSC::constructEmptyArray): - -2010-01-27 Alexey Proskuryakov - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=34150 - WebKit needs a mechanism to catch stale HashMap entries - - It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash - is just its value, it is very unlikely that any observable problem is reproducible. - - This extends hash table consistency checks to check that pointers are referencing allocated - memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible - to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much). - - * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can - add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems - with those yet. - - * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by - CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency(). - - * wtf/HashTable.h: - (WTF::HashTable::internalCheckTableConsistency): - (WTF::HashTable::internalCheckTableConsistencyExceptSize): - (WTF::HashTable::checkTableConsistencyExceptSize): - Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off. - (WTF::::add): Updated for checkTableConsistency renaming. - (WTF::::addPassingHashCode): Ditto. - (WTF::::removeAndInvalidate): Ditto. - (WTF::::remove): Ditto. - (WTF::::rehash): Ditto. - (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this - function returns true for tables with m_table == 0. - (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially, - we could do the same for values. - - * wtf/HashTraits.h: - (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden - to add checks. Currently, the only override is for pointer hashes. - - * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming. - -2010-01-27 Anton Muhin - - Reviewed by Darin Adler. - - Remove trailing \ from inline function code - https://bugs.webkit.org/show_bug.cgi?id=34223 - - * assembler/ARMv7Assembler.h: - (JSC::ARMThumbImmediate::countLeadingZerosPartial): - -2010-01-27 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Port WTF's randomNumber - https://bugs.webkit.org/show_bug.cgi?id=33566 - - Use GETRAND to generate 4 byte random byte sequence to implement - weakRandomNumber. Create a secure random number generator with - AEECLSID_RANDOM to implement randomNumber. - - * wtf/RandomNumber.cpp: - (WTF::weakRandomNumber): - (WTF::randomNumber): - -2010-01-27 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Port getCPUTime - https://bugs.webkit.org/show_bug.cgi?id=33572 - - Use GETUPTIMEMS which returns a continuously and - linearly increasing millisecond timer from the time the device - was powered on. This function is enough to implement getCPUTime. - - * runtime/TimeoutChecker.cpp: - (JSC::getCPUTime): - -2010-01-27 Kwang Yul Seo - - Reviewed by Oliver Hunt. - - [BREWMP] Add MarkStack fastMalloc implementation for platforms without VirtualAlloc or mmap. - https://bugs.webkit.org/show_bug.cgi?id=33582 - - Use fastMalloc and fastFree to implement MarkStack::allocateStack and - MarkStack::releaseStack for platforms without page level allocation. - - * runtime/MarkStack.h: - (JSC::MarkStack::MarkStackArray::shrinkAllocation): - * runtime/MarkStackNone.cpp: Added. - (JSC::MarkStack::initializePagesize): - (JSC::MarkStack::allocateStack): - (JSC::MarkStack::releaseStack): - -2010-01-27 Kwang Yul Seo - - Reviewed by Eric Seidel. - - [BREWMP] Don't use time function - https://bugs.webkit.org/show_bug.cgi?id=33577 - - Calling time(0) in BREW devices causes a crash because time - is not properly ported in most devices. Cast currentTime() to - time_t to get the same result as time(0). - - * wtf/DateMath.cpp: - (WTF::calculateUTCOffset): - -2010-01-27 Alexey Proskuryakov - - Revert r53899 (HashMap key checks) and subsequent build fixes, - because they make SVG tests crash in release builds. - - * wtf/HashMap.h: - (WTF::::remove): - * wtf/HashSet.h: - (WTF::::remove): - * wtf/HashTable.h: - (WTF::::add): - (WTF::::addPassingHashCode): - (WTF::::removeAndInvalidate): - (WTF::::remove): - (WTF::::rehash): - (WTF::::checkTableConsistency): - (WTF::::checkTableConsistencyExceptSize): - * wtf/HashTraits.h: - (WTF::GenericHashTraits::emptyValue): - (WTF::): - * wtf/RefPtrHashMap.h: - (WTF::::remove): - -2010-01-26 Alexey Proskuryakov - - More Windows build fixing. - - * wtf/HashTraits.h: _msize takes void*, remove const qualifier from type. - -2010-01-26 Alexey Proskuryakov - - Windows build fix. - - * wtf/HashTraits.h: Include malloc.h for _msize(). - -2010-01-26 Alexey Proskuryakov - - Build fix. - - * wtf/HashTable.h: (WTF::HashTable::checkTableConsistencyExceptSize): Remove const from a - static (empty) version of this function. - -2010-01-26 Alexey Proskuryakov - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=34150 - WebKit needs a mechanism to catch stale HashMap entries - - It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash - is just its value, it is very unlikely that any observable problem is reproducible. - - This extends hash table consistency checks to check that pointers are referencing allocated - memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible - to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much). - - * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can - add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems - with those yet. - - * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by - CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency(). - - * wtf/HashTable.h: - (WTF::HashTable::internalCheckTableConsistency): - (WTF::HashTable::internalCheckTableConsistencyExceptSize): - (WTF::HashTable::checkTableConsistencyExceptSize): - Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off. - (WTF::::add): Updated for checkTableConsistency renaming. - (WTF::::addPassingHashCode): Ditto. - (WTF::::removeAndInvalidate): Ditto. - (WTF::::remove): Ditto. - (WTF::::rehash): Ditto. - (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this - function returns true for tables with m_table == 0. - (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially, - we could do the same for values. - - * wtf/HashTraits.h: - (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden - to add checks. Currently, the only override is for pointer hashes. - - * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming. - -2010-01-26 Lyon Chen - - Reviewed by Maciej Stachowiak. - - Opcode.h use const void* for Opcode cause error #1211 for RVCT compiler - https://bugs.webkit.org/show_bug.cgi?id=33902 - - * bytecode/Opcode.h: - -2010-01-26 Steve Falkenburg - - Reviewed by Oliver Hunt. - - Windows build references non-existent include paths - https://bugs.webkit.org/show_bug.cgi?id=34175 - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: - * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: - * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: - * JavaScriptCore.vcproj/testapi/testapi.vcproj: - * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: - -2010-01-26 Oliver Hunt - - Reviewed by Geoffrey Garen. - - Using JavaScriptCore API with a webkit vended context can result in slow script dialog - https://bugs.webkit.org/show_bug.cgi?id=34172 - - Make the APIShim correctly increment and decrement the timeout - entry counter. - - * API/APIShims.h: - (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): - (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): - (JSC::APICallbackShim::APICallbackShim): - (JSC::APICallbackShim::~APICallbackShim): - -2010-01-26 Simon Hausmann - - [Qt] Fix compilation of QtScript with non-gcc compilers - - Variable length stack arrays are a gcc extension. Use QVarLengthArray - as a more portable solution that still tries to allocate on the stack - first. - - * qt/api/qscriptvalue_p.h: - (QScriptValuePrivate::call): - -2010-01-26 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - [Qt] Fix the build on platforms without JIT support. - - The JIT support should be determined at compile-time via wtf/Platform.h - - * qt/api/QtScript.pro: - -2010-01-26 Jedrzej Nowacki - - Reviewed by Simon Hausmann. - - First steps of the QtScript API. - - Two new classes were created; QScriptEngine and QScriptValue. - The first should encapsulate a javascript context and the second a script - value. - - This API is still in development, so it isn't compiled by default. - To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to - build-webkit. - - https://bugs.webkit.org/show_bug.cgi?id=32565 - - * qt/api/QtScript.pro: Added. - * qt/api/qscriptconverter_p.h: Added. - (QScriptConverter::toString): - * qt/api/qscriptengine.cpp: Added. - (QScriptEngine::QScriptEngine): - (QScriptEngine::~QScriptEngine): - (QScriptEngine::evaluate): - (QScriptEngine::collectGarbage): - * qt/api/qscriptengine.h: Added. - * qt/api/qscriptengine_p.cpp: Added. - (QScriptEnginePrivate::QScriptEnginePrivate): - (QScriptEnginePrivate::~QScriptEnginePrivate): - (QScriptEnginePrivate::evaluate): - * qt/api/qscriptengine_p.h: Added. - (QScriptEnginePrivate::get): - (QScriptEnginePrivate::collectGarbage): - (QScriptEnginePrivate::makeJSValue): - (QScriptEnginePrivate::context): - * qt/api/qscriptvalue.cpp: Added. - (QScriptValue::QScriptValue): - (QScriptValue::~QScriptValue): - (QScriptValue::isValid): - (QScriptValue::isBool): - (QScriptValue::isBoolean): - (QScriptValue::isNumber): - (QScriptValue::isNull): - (QScriptValue::isString): - (QScriptValue::isUndefined): - (QScriptValue::isError): - (QScriptValue::isObject): - (QScriptValue::isFunction): - (QScriptValue::toString): - (QScriptValue::toNumber): - (QScriptValue::toBool): - (QScriptValue::toBoolean): - (QScriptValue::toInteger): - (QScriptValue::toInt32): - (QScriptValue::toUInt32): - (QScriptValue::toUInt16): - (QScriptValue::call): - (QScriptValue::engine): - (QScriptValue::operator=): - (QScriptValue::equals): - (QScriptValue::strictlyEquals): - * qt/api/qscriptvalue.h: Added. - (QScriptValue::): - * qt/api/qscriptvalue_p.h: Added. - (QScriptValuePrivate::): - (QScriptValuePrivate::get): - (QScriptValuePrivate::QScriptValuePrivate): - (QScriptValuePrivate::isValid): - (QScriptValuePrivate::isBool): - (QScriptValuePrivate::isNumber): - (QScriptValuePrivate::isNull): - (QScriptValuePrivate::isString): - (QScriptValuePrivate::isUndefined): - (QScriptValuePrivate::isError): - (QScriptValuePrivate::isObject): - (QScriptValuePrivate::isFunction): - (QScriptValuePrivate::toString): - (QScriptValuePrivate::toNumber): - (QScriptValuePrivate::toBool): - (QScriptValuePrivate::toInteger): - (QScriptValuePrivate::toInt32): - (QScriptValuePrivate::toUInt32): - (QScriptValuePrivate::toUInt16): - (QScriptValuePrivate::equals): - (QScriptValuePrivate::strictlyEquals): - (QScriptValuePrivate::assignEngine): - (QScriptValuePrivate::call): - (QScriptValuePrivate::engine): - (QScriptValuePrivate::context): - (QScriptValuePrivate::value): - (QScriptValuePrivate::object): - (QScriptValuePrivate::inherits): - (QScriptValuePrivate::isJSBased): - (QScriptValuePrivate::isNumberBased): - (QScriptValuePrivate::isStringBased): - * qt/api/qtscriptglobal.h: Added. - * qt/tests/qscriptengine/qscriptengine.pro: Added. - * qt/tests/qscriptengine/tst_qscriptengine.cpp: Added. - (tst_QScriptEngine::tst_QScriptEngine): - (tst_QScriptEngine::~tst_QScriptEngine): - (tst_QScriptEngine::init): - (tst_QScriptEngine::cleanup): - (tst_QScriptEngine::collectGarbage): - (tst_QScriptEngine::evaluate): - * qt/tests/qscriptvalue/qscriptvalue.pro: Added. - * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: Added. - (tst_QScriptValue::tst_QScriptValue): - (tst_QScriptValue::~tst_QScriptValue): - (tst_QScriptValue::init): - (tst_QScriptValue::cleanup): - (tst_QScriptValue::ctor): - (tst_QScriptValue::toString_data): - (tst_QScriptValue::toString): - (tst_QScriptValue::copyConstructor_data): - (tst_QScriptValue::copyConstructor): - (tst_QScriptValue::assignOperator_data): - (tst_QScriptValue::assignOperator): - (tst_QScriptValue::dataSharing): - (tst_QScriptValue::constructors_data): - (tst_QScriptValue::constructors): - (tst_QScriptValue::call): - * qt/tests/tests.pri: Added. - * qt/tests/tests.pro: Added. - -2010-01-25 Dmitry Titov - - Reviewed by David Levin. - - Fix Chromium Linux tests: the pthread functions on Linux produce segfault if they receive 0 thread handle. - After r53714, we can have 0 thread handles passed to pthread_join and pthread_detach if corresponding threads - were already terminated and their threadMap entries cleared. - Add a 0 check. - - * wtf/ThreadingPthreads.cpp: - (WTF::waitForThreadCompletion): - (WTF::detachThread): - -2010-01-24 Laszlo Gombos - - Reviewed by Maciej Stachowiak. - - Refactor JITStubs.cpp so that DEFINE_STUB_FUNCTION is only used once for each function - https://bugs.webkit.org/show_bug.cgi?id=33866 - - Place the guard USE(JSVALUE32_64) inside the body of the DEFINE_STUB_FUNCTION - macro for those functions that are always present. - - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - -2010-01-22 Kevin Watters - - Reviewed by Kevin Ollivier. - - [wx] Remove the Bakefile build system, which is no longer being used. - - https://bugs.webkit.org/show_bug.cgi?id=34022 - - * JavaScriptCoreSources.bkl: Removed. - * jscore.bkl: Removed. - -2010-01-22 Steve Falkenburg - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=34025 - Enable client-based Geolocation abstraction for Mac, Windows AppleWebKit targets. - - * Configurations/FeatureDefines.xcconfig: - -2010-01-22 Dmitry Titov - - Not reviewed, attempted Snow Leopard build fix. - - * wtf/ThreadingPthreads.cpp: Add a forward declaration of a function which is not 'static'. - -2009-01-22 Dmitry Titov - - Reviewed by Maciej Stachowiak. - - Fix the leak of ThreadIdentifiers in threadMap across threads. - https://bugs.webkit.org/show_bug.cgi?id=32689 - - Test is added to DumpRenderTree.mm. - - * Android.mk: Added file ThreadIdentifierDataPthreads.(h|cpp) to build. - * Android.v8.wtf.mk: Ditto. - * GNUmakefile.am: Ditto. - * JavaScriptCore.gyp/JavaScriptCore.gyp: Ditto. - * JavaScriptCore.gypi: Ditto. - * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. - - * wtf/ThreadIdentifierDataPthreads.cpp: Added. Contains custom implementation of thread-specific data that uses custom destructor. - (WTF::ThreadIdentifierData::~ThreadIdentifierData): Removes the ThreadIdentifier from the threadMap. - (WTF::ThreadIdentifierData::identifier): - (WTF::ThreadIdentifierData::initialize): - (WTF::ThreadIdentifierData::destruct): Custom thread-specific destructor. Resets the value for the key again to cause second invoke. - (WTF::ThreadIdentifierData::initializeKeyOnceHelper): - (WTF::ThreadIdentifierData::initializeKeyOnce): Need to use pthread_once since initialization may come on any thread(s). - * wtf/ThreadIdentifierDataPthreads.h: Added. - (WTF::ThreadIdentifierData::ThreadIdentifierData): - - * wtf/Threading.cpp: - (WTF::threadEntryPoint): Move initializeCurrentThreadInternal to after the lock to make - sure it is invoked when ThreadIdentifier is already established. - - * wtf/Threading.h: Rename setThreadNameInternal -> initializeCurrentThreadInternal since it does more then only set the name now. - * wtf/ThreadingNone.cpp: - (WTF::initializeCurrentThreadInternal): Ditto. - * wtf/ThreadingWin.cpp: - (WTF::initializeCurrentThreadInternal): Ditto. - (WTF::initializeThreading): Ditto. - * wtf/gtk/ThreadingGtk.cpp: - (WTF::initializeCurrentThreadInternal): Ditto. - * wtf/qt/ThreadingQt.cpp: - (WTF::initializeCurrentThreadInternal): Ditto. - - * wtf/ThreadingPthreads.cpp: - (WTF::establishIdentifierForPthreadHandle): - (WTF::clearPthreadHandleForIdentifier): Make it not 'static' so the ~ThreadIdentifierData() in another file can call it. - (WTF::initializeCurrentThreadInternal): Set the thread-specific data. The ThreadIdentifier is already established by creating thread. - (WTF::waitForThreadCompletion): Remove call to clearPthreadHandleForIdentifier(threadID) since it is now done in ~ThreadIdentifierData(). - (WTF::detachThread): Ditto. - (WTF::currentThread): Use the thread-specific data to get the ThreadIdentifier. It's many times faster then Mutex-protected iteration through the map. - Also, set the thread-specific data if called first time on the thread. - -2010-01-21 Kwang Yul Seo - - Reviewed by Alexey Proskuryakov. - - Add ThreadSpecific for ENABLE(SINGLE_THREADED) - https://bugs.webkit.org/show_bug.cgi?id=33878 - - Implement ThreadSpecific with a simple getter/setter - when ENABLE(SINGLE_THREADED) is true. - - Due to the change in https://bugs.webkit.org/show_bug.cgi?id=33236, - an implementation of ThreadSpecific must be available to build WebKit. - This causes a build failure for platforms without a proper - ThreadSpecific implementation. - - * wtf/ThreadSpecific.h: - (WTF::::ThreadSpecific): - (WTF::::~ThreadSpecific): - (WTF::::get): - (WTF::::set): - (WTF::::destroy): - -2010-01-21 Kwang Yul Seo - - Reviewed by Maciej Stachowiak. - - Add fastStrDup to FastMalloc - https://bugs.webkit.org/show_bug.cgi?id=33937 - - The new string returned by fastStrDup is obtained with fastMalloc, - and can be freed with fastFree. This makes the memory management - more consistent because we don't need to keep strdup allocated pointers - and free them with free(). Instead we can use fastFree everywhere. - - * wtf/FastMalloc.cpp: - (WTF::fastStrDup): - * wtf/FastMalloc.h: - -2010-01-21 Brady Eidson - - Reviewed by Maciej Stachowiak. - - history.back() for same-document history traversals isn't synchronous as the specification states. - and https://bugs.webkit.org/show_bug.cgi?id=33538 - - * wtf/Platform.h: Add a "HISTORY_ALWAYS_ASYNC" enable and turn it on for Chromium. - -2010-01-21 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Always create a prototype for automatically managed classes. - - This fixes some errors where prototype chains were not correctly hooked - up, and also ensures that API classes work correctly with features like - instanceof. - - * API/JSClassRef.cpp: - (OpaqueJSClass::create): Cleaned up some of this code. Also changed it - to always create a prototype class. - - * API/tests/testapi.c: - (Derived2_class): - (main): Fixed a null value crash in the exception checking code. - * API/tests/testapi.js: Added some tests for the case where a prototype - chain would not be hooked up correctly. - -2010-01-21 Oliver Hunt - - Reviewed by Geoff Garen. - - Force JSC to create a prototype chain for API classes with a - parent class but no static functions. - - * API/JSClassRef.cpp: - (OpaqueJSClass::create): - -2010-01-21 Kent Hansen - - Reviewed by Geoffrey Garen. - - Object.getOwnPropertyDescriptor always returns undefined for JS API objects - https://bugs.webkit.org/show_bug.cgi?id=33946 - - Ideally the getOwnPropertyDescriptor() reimplementation should return an - access descriptor that wraps the property getter and setter callbacks, but - that approach is much more involved than returning a value descriptor. - Keep it simple for now. - - * API/JSCallbackObject.h: - * API/JSCallbackObjectFunctions.h: - (JSC::::getOwnPropertyDescriptor): - * API/tests/testapi.js: - -2010-01-20 Mark Rowe - - Build fix. - - * wtf/FastMalloc.cpp: - (WTF::TCMalloc_PageHeap::initializeScavenger): Remove unnecessary function call. - -2010-01-20 Mark Rowe - - Reviewed by Oliver Hunt. - - Use the inline i386 assembly for x86_64 as well rather than falling back to using pthread mutexes. - - * wtf/TCSpinLock.h: - (TCMalloc_SpinLock::Lock): - (TCMalloc_SpinLock::Unlock): - (TCMalloc_SlowLock): - -2010-01-20 Mark Rowe - - Reviewed by Oliver Hunt. - - Use GCD instead of an extra thread for FastMalloc scavenging on platforms where it is supported - - Abstract the background scavenging slightly so that an alternate implementation that uses GCD can be used on platforms - where it is supported. - - * wtf/FastMalloc.cpp: - (WTF::TCMalloc_PageHeap::init): - (WTF::TCMalloc_PageHeap::initializeScavenger): - (WTF::TCMalloc_PageHeap::signalScavenger): - (WTF::TCMalloc_PageHeap::shouldContinueScavenging): - (WTF::TCMalloc_PageHeap::Delete): - (WTF::TCMalloc_PageHeap::periodicScavenge): - * wtf/Platform.h: - -2010-01-20 Geoffrey Garen - - Reviewed by Oliver Hunt. - - REGRESSION(53460): Heap::destroy may not run - all destructors - - * runtime/Collector.cpp: - (JSC::Heap::freeBlocks): Instead of fully marking protected objects, - just set their mark bits. This prevents protected objects from keeping - unprotected objects alive. Destructor order is not guaranteed, so it's - OK to destroy objects pointed to by protected objects before destroying - protected objects. - -2010-01-19 David Levin - - Reviewed by Oliver Hunt. - - CrossThreadCopier needs to support ThreadSafeShared better. - https://bugs.webkit.org/show_bug.cgi?id=33698 - - * wtf/TypeTraits.cpp: Added tests for the new type traits. - * wtf/TypeTraits.h: - (WTF::IsSubclass): Determines if a class is a derived from another class. - (WTF::IsSubclassOfTemplate): Determines if a class is a derived from a - template class (with one parameter that is unknown). - (WTF::RemoveTemplate): Reveals the type for a template parameter. - -2010-01-20 Steve Falkenburg - - Reviewed by Darin Adler and Adam Roben. - - Feature defines are difficult to maintain on Windows builds - https://bugs.webkit.org/show_bug.cgi?id=33883 - - FeatureDefines.vsprops are now maintained in a way similar to - Configurations/FeatureDefines.xcconfig, with the added advantage - of having a single FeatureDefines file across all projects. - - * Configurations/FeatureDefines.xcconfig: Add comments about keeping feature definitions in sync. - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add FeatureDefines.vsprops inherited property sheet. - * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add FeatureDefines.vsprops inherited property sheet. - -2010-01-20 Csaba Osztrogonác - - [Qt] Unreviewed buildfix for r53547. - - * DerivedSources.pro: - -2010-01-20 Tor Arne Vestbø - - Reviewed by Simon Hausmann. - - [Qt] Make extraCompilers for generated sources depend on their scripts - - * DerivedSources.pro: - -2010-01-19 Brian Weinstein - - Reviewed by Tim Hatcher. - - When JavaScriptCore calls Debugger::Exception, have it pass a - hasHandler variable that represents if exception is being handled - in the same function (not in a parent on the call stack). - - This just adds a new parameter, no behavior is changed. - - * debugger/Debugger.h: - * interpreter/Interpreter.cpp: - (JSC::Interpreter::throwException): - -2010-01-18 Maciej Stachowiak - - Reviewed by Adam Barth. - - Inline functions that are hot in DOM manipulation - https://bugs.webkit.org/show_bug.cgi?id=33820 - - (3% speedup on Dromaeo DOM Core tests) - - * runtime/WeakGCMap.h: - (JSC::::get): inline - -2010-01-19 Laszlo Gombos - - Unreviewed build fix for JIT with RVCT. - - Remove IMPORT statement; cti_vm_throw is already defined in JITStubs.h. - Remove extra ')'. - - * jit/JITStubs.cpp: - (JSC::ctiVMThrowTrampoline): - -2010-01-19 Geoffrey Garen - - Reviewed by Oliver Hunt. - - REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/ - https://bugs.webkit.org/show_bug.cgi?id=33826 - - This bug was caused by a GC-protected object being destroyed early by - Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers - to GC-protected memory to be valid. - - The solution is to do two passes of tear-down in Heap::destroy. The first - pass tears down all unprotected objects. The second pass ASSERTs that all - previously protected objects are now unprotected, and then tears down - all perviously protected objects. These two passes simulate the two passes - that would have been required to free a protected object during normal GC. - - * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap. - - * runtime/Collector.cpp: - (JSC::Heap::destroy): Moved ASSERTs to here. - (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its - setter to the function that does the shrinking. - (JSC::Heap::freeBlocks): Implemented above algorithm. - (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink. - -2010-01-19 Gavin Barraclough - - Reviewed by NOBODY (build fix). - - Reverting r53455, breaks 2 javascriptcore tests. - - * API/JSContextRef.cpp: - * runtime/Collector.cpp: - (JSC::Heap::destroy): - (JSC::Heap::freeBlock): - (JSC::Heap::freeBlocks): - (JSC::Heap::shrinkBlocks): - -2010-01-18 Gavin Barraclough - - Reviewed by NOBODY (build fix). - - Revert r53454, since it causes much sadness in this world. - - * runtime/UString.cpp: - (JSC::UString::spliceSubstringsWithSeparators): - (JSC::UString::replaceRange): - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::baseSharedBuffer): - (JSC::UStringImpl::sharedBuffer): - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): - (JSC::UntypedPtrAndBitfield::asPtr): - (JSC::UntypedPtrAndBitfield::operator&=): - (JSC::UntypedPtrAndBitfield::operator|=): - (JSC::UntypedPtrAndBitfield::operator&): - (JSC::UStringImpl::create): - (JSC::UStringImpl::cost): - (JSC::UStringImpl::isIdentifier): - (JSC::UStringImpl::setIsIdentifier): - (JSC::UStringImpl::ref): - (JSC::UStringImpl::deref): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::bufferOwnership): - (JSC::UStringImpl::isStatic): - * wtf/StringHashFunctions.h: - (WTF::stringHash): - -2010-01-18 Geoffrey Garen - - Reviewed by Oliver Hunt. - - REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/ - https://bugs.webkit.org/show_bug.cgi?id=33826 - - This bug was caused by a GC-protected object being destroyed early by - Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers - to GC-protected memory to be valid. - - The solution is to do two passes of tear-down in Heap::destroy. The first - pass tears down all unprotected objects. The second pass ASSERTs that all - previously protected objects are now unprotected, and then tears down - all perviously protected objects. These two passes simulate the two passes - that would have been required to free a protected object during normal GC. - - * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap. - - * runtime/Collector.cpp: - (JSC::Heap::destroy): Moved ASSERTs to here. - (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its - setter to the function that does the shrinking. - (JSC::Heap::freeBlocks): Implemented above algorithm. - (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink. - -2010-01-18 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags). - - This break the OS X Leaks tool. Instead, free up some more bits from the refCount. - - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::sharedBuffer): - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UStringImpl::cost): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::): - * wtf/StringHashFunctions.h: - (WTF::stringHash): - -2010-01-18 Kent Tamura - - Reviewed by Darin Adler. - - HTMLInputElement::valueAsDate setter support for type=month. - https://bugs.webkit.org/show_bug.cgi?id=33021 - - Expose the following functions to be used by WebCore: - - WTF::msToyear() - - WTF::dayInYear() - - WTF::monthFromDayInYear() - - WTF::dayInMonthFromDayInYear() - - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * wtf/DateMath.cpp: - (WTF::msToYear): Remove "static inline". - (WTF::dayInYear): Remove "static inline". - (WTF::monthFromDayInYear): Remove "static inline". - (WTF::dayInMonthFromDayInYear): Remove "static inline". - * wtf/DateMath.h: Declare the above functions. - -2010-01-18 Darin Adler - - Fix build by reverting the previous change. - - * runtime/UString.h: Rolled out the FastAllocBase base class. - It was making UString larger, and therefore JSString larger, - and too big for a garbage collection cell. - - This raises the unpleasant possibility that many classes became - larger because we added the FastAllocBase base class. I am - worried about this, and it needs to be investigated. - -2010-01-18 Zoltan Horvath - - Reviewed by Darin Adler. - - Allow custom memory allocation control for UString class - https://bugs.webkit.org/show_bug.cgi?id=27831 - - Inherits the following class from FastAllocBase because it is - instantiated by 'new' and no need to be copyable: - - class name - instantiated at: - classs UString - JavaScriptCore/runtime/UString.cpp:160 - - * runtime/UString.h: - -2010-01-18 Evan Cheng - - Reviewed by Darin Adler. - - Add some ALWAYS_INLINE for key functions not inlined by some versions of GCC. - rdar://problem/7553780 - - * runtime/JSObject.h: - (JSC::JSObject::getPropertySlot): ALWAYS_INLINE both overloads. - * runtime/JSString.h: - (JSC::JSString::JSString): ALWAYS_INLINE the version that takes a UString. - * runtime/UString.h: - (JSC::operator==): ALWAYS_INLINE the version that compares two UString objects. - -2010-01-18 Csaba Osztrogonác - - Reviewed by Darin Adler. - - Delete dftables-xxxxxxxx.in files automatically. - https://bugs.webkit.org/show_bug.cgi?id=33796 - - * pcre/dftables: unlink unnecessary temporary file. - -2010-01-18 Tor Arne Vestbø - - Reviewed by Simon Hausmann. - - [Qt] Force qmake to generate a single makefile for DerivedSources.pro - - * DerivedSources.pro: - -2010-01-18 Csaba Osztrogonác - - Rubber-stamped by Gustavo Noronha Silva. - - Rolling out r53391 and r53392 because of random crashes on buildbots. - https://bugs.webkit.org/show_bug.cgi?id=33731 - - * bytecode/CodeBlock.h: - (JSC::CallLinkInfo::seenOnce): - (JSC::CallLinkInfo::setSeen): - (JSC::MethodCallLinkInfo::MethodCallLinkInfo): - (JSC::MethodCallLinkInfo::seenOnce): - (JSC::MethodCallLinkInfo::setSeen): - * jit/JIT.cpp: - (JSC::JIT::unlinkCall): - * jit/JITPropertyAccess.cpp: - (JSC::JIT::patchMethodCallProto): - * runtime/UString.cpp: - (JSC::UString::spliceSubstringsWithSeparators): - (JSC::UString::replaceRange): - * runtime/UString.h: - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::baseSharedBuffer): - (JSC::UStringImpl::sharedBuffer): - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): - (JSC::UntypedPtrAndBitfield::asPtr): - (JSC::UntypedPtrAndBitfield::operator&=): - (JSC::UntypedPtrAndBitfield::operator|=): - (JSC::UntypedPtrAndBitfield::operator&): - (JSC::UStringImpl::create): - (JSC::UStringImpl::cost): - (JSC::UStringImpl::isIdentifier): - (JSC::UStringImpl::setIsIdentifier): - (JSC::UStringImpl::ref): - (JSC::UStringImpl::deref): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::bufferOwnership): - (JSC::UStringImpl::isStatic): - * wtf/StringHashFunctions.h: - (WTF::stringHash): - -2010-01-18 Simon Hausmann - - Reviewed by Kenneth Rohde Christiansen. - - Fix the build with strict gcc and RVCT versions: It's not legal to cast a - pointer to a function to a void* without an intermediate cast to a non-pointer - type. A cast to a ptrdiff_t inbetween fixes it. - - * runtime/JSString.h: - (JSC::Fiber::JSString): - -2010-01-15 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags). - - This break the OS X Leaks tool. Instead, free up some more bits from the refCount. - - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::sharedBuffer): - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UStringImpl::cost): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::): - * wtf/StringHashFunctions.h: - (WTF::stringHash): - -2010-01-15 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=33731 - Remove uses of PtrAndFlags from JIT data stuctures. - - These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid - permutation of pointer states in MethodCallLinkInfo to represent the removed bits. - - * bytecode/CodeBlock.h: - (JSC::CallLinkInfo::seenOnce): - (JSC::CallLinkInfo::setSeen): - (JSC::MethodCallLinkInfo::MethodCallLinkInfo): - (JSC::MethodCallLinkInfo::seenOnce): - (JSC::MethodCallLinkInfo::setSeen): - * jit/JIT.cpp: - (JSC::JIT::unlinkCall): - * jit/JITPropertyAccess.cpp: - (JSC::JIT::patchMethodCallProto): - * runtime/UString.h: - -2010-01-16 Maciej Stachowiak - - Reviewed by Oliver Hunt. - - Cache JS string values made from DOM strings (Dromaeo speedup) - https://bugs.webkit.org/show_bug.cgi?id=33768 - - - * runtime/JSString.h: - (JSC::jsStringWithFinalizer): Added new mechanism for a string to have an optional - finalizer callback, for the benefit of weak-referencing caches. - (JSC::): - (JSC::Fiber::JSString): - (JSC::Fiber::~JSString): - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): Clear fibers so this doesn't look like a string with a finalizer. - * runtime/WeakGCMap.h: Include "Collector.h" to make this header includable by itself. - -2010-01-15 Sam Weinig - - Reviewed by Maciej Stachowiak. - - Fix for - Add ALWAYS_INLINE to jsLess for a 1% speedup on llvm-gcc. - - * runtime/Operations.h: - (JSC::jsLess): - -2010-01-14 Geoffrey Garen - - Reviewed by Oliver Hunt. - - REGRESISON: Google maps buttons not working properly - https://bugs.webkit.org/show_bug.cgi?id=31871 - - REGRESSION(r52948): JavaScript exceptions thrown on Google Maps when - getting directions for a second time - https://bugs.webkit.org/show_bug.cgi?id=33446 - - SunSpider and v8 report no change. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::tryCacheGetByID): Update our cached offset in case - flattening the dictionary changed any of its offsets. - - * jit/JITStubs.cpp: - (JSC::JITThunks::tryCacheGetByID): - (JSC::DEFINE_STUB_FUNCTION): - * runtime/Operations.h: - (JSC::normalizePrototypeChain): ditto - -2010-01-14 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=33705 - UStringImpl::create() should use internal storage - - When creating a UStringImpl copying of a UChar*, we can use an internal buffer, - by calling UStringImpl::tryCreateUninitialized(). - - Also, remove duplicate of copyChars from JSString, call UStringImpl's version. - - Small (max 0.5%) progression on Sunspidey. - - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - * runtime/UStringImpl.h: - (JSC::UStringImpl::create): - -2010-01-14 Gavin Barraclough - - Reviewed by Sam Weinig. - - Make naming & behaviour of UString[Impl] methods more consistent. - https://bugs.webkit.org/show_bug.cgi?id=33702 - - UString::create() creates a copy of the UChar* passed, but UStringImpl::create() assumes - that it should assume ownership of the provided buffer (with UString::createNonCopying() - and UStringImpl::createCopying() providing the alternate behaviours). Unify on create() - taking a copy of the provided buffer. For non-copying cases, use the name 'adopt', and - make this method take a Vector&. For cases where non-copying construction was being - used, other than from a Vector, change the code to allocate the storage along with - the UStringImpl using UStringImpl::createUninitialized(). (The adopt() method also more - closely matches that of WebCore::StringImpl). - - Also, UString::createUninitialized() and UStringImpl::createUninitialized() have incompatible - behaviours, in that the UString form sets the provided UChar* to a null or non-null value to - indicate success or failure, but UStringImpl uses the returned PassRefPtr to - indicate when allocation has failed (potentially leaving the output Char* uninitialized). - This is also incompatible with WebCore::StringImpl's behaviour, in that - StringImpl::createUninitialized() will CRASH() if unable to allocate. Some uses of - createUninitialized() in JSC are unsafe, since they do not test the result for null. - UStringImpl's indication is preferable, since we may want a successful call to set the result - buffer to 0 (specifically, StringImpl returns 0 for the buffer where createUninitialized() - returns the empty string, which seems reasonable to catch bugs early). UString's method - cannot support UStringImpl's behaviour directly, since it returns an object rather than a - pointer. - - remove UString::createUninitialized(), replace with calls to UStringImpl::createUninitialized() - - create a UStringImpl::tryCreateUninitialized() form UStringImpl::createUninitialized(), - with current behaviour, make createUninitialized() crash on failure to allocate. - - make cases in JSC that do not check the result call createUninitialized(), and cases that do - check call tryCreateUninitialized(). - - Rename computedHash() to existingHash(), to bring this in line wih WebCore::StringImpl. - - * API/JSClassRef.cpp: - (OpaqueJSClassContextData::OpaqueJSClassContextData): - * JavaScriptCore.exp: - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncToString): - * runtime/Identifier.cpp: - (JSC::CStringTranslator::translate): - (JSC::UCharBufferTranslator::translate): - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - * runtime/Lookup.cpp: - (JSC::HashTable::createTable): - * runtime/Lookup.h: - (JSC::HashTable::entry): - * runtime/StringBuilder.h: - (JSC::StringBuilder::release): - * runtime/StringConstructor.cpp: - (JSC::stringFromCharCodeSlowCase): - * runtime/StringPrototype.cpp: - (JSC::substituteBackreferencesSlow): - (JSC::stringProtoFuncToLowerCase): - (JSC::stringProtoFuncToUpperCase): - (JSC::stringProtoFuncFontsize): - (JSC::stringProtoFuncLink): - * runtime/Structure.cpp: - (JSC::Structure::despecifyDictionaryFunction): - (JSC::Structure::get): - (JSC::Structure::despecifyFunction): - (JSC::Structure::put): - (JSC::Structure::remove): - (JSC::Structure::insertIntoPropertyMapHashTable): - (JSC::Structure::checkConsistency): - * runtime/Structure.h: - (JSC::Structure::get): - * runtime/StructureTransitionTable.h: - (JSC::StructureTransitionTableHash::hash): - * runtime/UString.cpp: - (JSC::createRep): - (JSC::UString::UString): - (JSC::UString::spliceSubstringsWithSeparators): - (JSC::UString::replaceRange): - (JSC::UString::operator=): - * runtime/UString.h: - (JSC::UString::adopt): - (JSC::IdentifierRepHash::hash): - (JSC::makeString): - * runtime/UStringImpl.h: - (JSC::UStringImpl::adopt): - (JSC::UStringImpl::create): - (JSC::UStringImpl::createUninitialized): - (JSC::UStringImpl::tryCreateUninitialized): - (JSC::UStringImpl::existingHash): - -2010-01-13 Kent Hansen - - Reviewed by Oliver Hunt. - - JSON.stringify and JSON.parse needlessly process properties in the prototype chain - https://bugs.webkit.org/show_bug.cgi?id=33053 - - * runtime/JSONObject.cpp: - (JSC::Stringifier::Holder::appendNextProperty): - (JSC::Walker::walk): - -2010-01-13 Gavin Barraclough - - Reviewed by NOBODY (buildfix). - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-13 Alexey Proskuryakov - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=33641 - Assertion failure in Lexer.cpp if input stream ends while in string escape - - Test: fast/js/end-in-string-escape.html - - * parser/Lexer.cpp: (JSC::Lexer::lex): Bail out quickly on end of stream, not giving the - assertion a chance to fire. - -2010-01-13 Gavin Barraclough - - Reviewed by NOBODY (buildfix). - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-13 Gavin Barraclough - - Rubber stamped by Sam Weinig & Darin Adler. - - Three quick fixes to UStringImpl. - - The destroy() method can be switched back to a normal destructor; since we've switched - the way we protect static strings to be using an odd ref-count the destroy() won't abort. - - The cost() calculation logic was wrong. If you have multiple JSStrings wrapping substrings - of a base string, they would each report the full cost of the base string to the heap. - Instead we should only be reporting once for the base string. - - Remove the overloaded new operator calling fastMalloc, replace this with a 'using' to pick - up the implementation from the parent class. - - * JavaScriptCore.exp: - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::~UStringImpl): - * runtime/UStringImpl.h: - (JSC::UStringImpl::cost): - (JSC::UStringImpl::deref): - -2010-01-13 Jocelyn Turcotte - - Reviewed by Simon Hausmann. - - [Qt] Split the build process in two different .pro files. - This allows qmake to be run once all source files are available. - - * DerivedSources.pro: Added. - * JavaScriptCore.pri: Moved source generation to DerivedSources.pro - * pcre/pcre.pri: Moved source generation to DerivedSources.pro - -2010-01-12 Kent Hansen - - Reviewed by Geoffrey Garen. - - [ES5] Implement Object.getOwnPropertyNames - https://bugs.webkit.org/show_bug.cgi?id=32242 - - Add an extra argument to getPropertyNames() and getOwnPropertyNames() - (and all reimplementations thereof) that indicates whether non-enumerable - properties should be added. - - * API/JSCallbackObject.h: - * API/JSCallbackObjectFunctions.h: - (JSC::::getOwnPropertyNames): - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * debugger/DebuggerActivation.cpp: - (JSC::DebuggerActivation::getOwnPropertyNames): - * debugger/DebuggerActivation.h: - * runtime/Arguments.cpp: - (JSC::Arguments::getOwnPropertyNames): - * runtime/Arguments.h: - * runtime/CommonIdentifiers.h: - * runtime/JSArray.cpp: - (JSC::JSArray::getOwnPropertyNames): - * runtime/JSArray.h: - * runtime/JSByteArray.cpp: - (JSC::JSByteArray::getOwnPropertyNames): - * runtime/JSByteArray.h: - * runtime/JSFunction.cpp: - (JSC::JSFunction::getOwnPropertyNames): - * runtime/JSFunction.h: - * runtime/JSNotAnObject.cpp: - (JSC::JSNotAnObject::getOwnPropertyNames): - * runtime/JSNotAnObject.h: - * runtime/JSObject.cpp: - (JSC::getClassPropertyNames): - (JSC::JSObject::getPropertyNames): - (JSC::JSObject::getOwnPropertyNames): - * runtime/JSObject.h: - * runtime/JSVariableObject.cpp: - (JSC::JSVariableObject::getOwnPropertyNames): - * runtime/JSVariableObject.h: - * runtime/ObjectConstructor.cpp: - (JSC::ObjectConstructor::ObjectConstructor): - (JSC::objectConstructorGetOwnPropertyNames): - * runtime/RegExpMatchesArray.h: - (JSC::RegExpMatchesArray::getOwnPropertyNames): - * runtime/StringObject.cpp: - (JSC::StringObject::getOwnPropertyNames): - * runtime/StringObject.h: - * runtime/Structure.cpp: Rename getEnumerablePropertyNames() to getPropertyNames(), which takes an extra argument. - (JSC::Structure::getPropertyNames): - * runtime/Structure.h: - (JSC::): - -2010-01-12 Alexey Proskuryakov - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=33540 - Make it possible to build in debug mode with assertions disabled - - * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): - * runtime/Identifier.cpp: (JSC::Identifier::checkSameIdentifierTable): - * wtf/FastMalloc.cpp: - * wtf/HashTable.h: (WTF::HashTableConstIterator::checkValidity): - * yarr/RegexCompiler.cpp: (JSC::Yarr::compileRegex): - -2009-11-23 Yong Li - - Reviewed by Adam Treat. - - Make GIF decoder support down-sampling - https://bugs.webkit.org/show_bug.cgi?id=31806 - - * platform/image-decoders/ImageDecoder.cpp: - (WebCore::ImageDecoder::upperBoundScaledY): - (WebCore::ImageDecoder::lowerBoundScaledY): - * platform/image-decoders/ImageDecoder.h: - (WebCore::RGBA32Buffer::scaledRect): - (WebCore::RGBA32Buffer::setScaledRect): - (WebCore::ImageDecoder::scaledSize): - * platform/image-decoders/gif/GIFImageDecoder.cpp: - (WebCore::GIFImageDecoder::sizeNowAvailable): - (WebCore::GIFImageDecoder::initFrameBuffer): - (WebCore::copyOnePixel): - (WebCore::GIFImageDecoder::haveDecodedRow): - (WebCore::GIFImageDecoder::frameComplete): - -2010-01-12 Adam Barth - - Reviewed by Eric Seidel. - - ecma/Date/15.9.5.12-1.js fails every night at midnight - https://bugs.webkit.org/show_bug.cgi?id=28041 - - Change the test to use a concrete time instead of "now". - - * tests/mozilla/ecma/Date/15.9.5.10-1.js: - * tests/mozilla/ecma/Date/15.9.5.12-1.js: - -2010-01-11 Csaba Osztrogonác - - Reviewed by Ariya Hidayat. - - [Qt] Enable JIT and YARR_JIT if (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) - - * wtf/Platform.h: - -2010-01-11 Geoffrey Garen - - Reviewed by Alexey Proskuryakov. - - https://bugs.webkit.org/show_bug.cgi?id=33481 - Uninitialized data members in ArrayStorage - - SunSpider reports no change. - - * runtime/JSArray.cpp: - (JSC::JSArray::JSArray): Initialize missing data members in the two cases - where we don't use fastZeroedMalloc, so it doesn't happen automatically. - -2010-01-11 Steve Falkenburg - - Reviewed by Sam Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=33480 - - Improve debugging reliability for WTF on Windows. - Store WTF static library's PDB file into a better location. - - * JavaScriptCore.vcproj/WTF/WTF.vcproj: - -2010-01-11 Steve Falkenburg - - Windows build fix. - Remove extraneous entries from def file causing build warning. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-10 Kent Hansen - - Reviewed by Darin Adler. - - RegExp.prototype.toString returns "//" for empty regular expressions - https://bugs.webkit.org/show_bug.cgi?id=33319 - - "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA. - - * runtime/RegExpPrototype.cpp: - (JSC::regExpProtoFuncToString): - - * tests/mozilla/ecma_2/RegExp/properties-001.js: - (AddRegExpCases): - * tests/mozilla/js1_2/regexp/toString.js: - Update relevant Mozilla tests (Mozilla has had this behavior since November 2003). - -2010-01-10 Darin Adler - - * tests/mozilla/ecma/Array/15.4.1.1.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.1.2.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.2.1-1.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.2.2-1.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.2.2-2.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.2.3.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.3.2.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.3.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.4.1.js: Added property allow-tabs. - * tests/mozilla/ecma/Array/15.4.4.js: Added property allow-tabs. - * tests/mozilla/ecma/LexicalConventions/7.7.4.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.13.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.16.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.18.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.2.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.4.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.5.js: Added property allow-tabs. - * tests/mozilla/ecma/Math/15.8.2.7.js: Added property allow-tabs. - * tests/mozilla/ecma/String/15.5.1.js: Added property allow-tabs. - * tests/mozilla/ecma/String/15.5.2.js: Added property allow-tabs. - * tests/mozilla/ecma/String/15.5.3.1-3.js: Added property allow-tabs. - * tests/mozilla/ecma/String/15.5.3.1-4.js: Added property allow-tabs. - * tests/mozilla/ecma/String/15.5.3.js: Added property allow-tabs. - * tests/mozilla/ecma/TypeConversion/9.5-2.js: Added property allow-tabs. - * tests/mozilla/ecma/jsref.js: Modified property allow-tabs. - * tests/mozilla/ecma/shell.js: Modified property allow-tabs. - * tests/mozilla/ecma_2/LexicalConventions/keywords-001.js: Added property allow-tabs. - * tests/mozilla/ecma_2/RegExp/exec-001.js: Added property allow-tabs. - * tests/mozilla/ecma_2/String/match-004.js: Added property allow-tabs. - * tests/mozilla/ecma_2/String/replace-001.js: Added property allow-tabs. - * tests/mozilla/ecma_2/String/split-002.js: Added property allow-tabs. - * tests/mozilla/ecma_2/jsref.js: Modified property allow-tabs. - * tests/mozilla/ecma_2/shell.js: Added property allow-tabs. - * tests/mozilla/ecma_3/Date/shell.js: Modified property allow-tabs. - * tests/mozilla/ecma_3/Exceptions/regress-181654.js: Added property allow-tabs. - * tests/mozilla/ecma_3/RegExp/regress-209067.js: Added property allow-tabs. - * tests/mozilla/ecma_3/RegExp/regress-85721.js: Added property allow-tabs. - * tests/mozilla/importList.html: Added property allow-tabs. - * tests/mozilla/js1_1/shell.js: Added property allow-tabs. - * tests/mozilla/js1_2/Array/general1.js: Added property allow-tabs. - * tests/mozilla/js1_2/Array/general2.js: Added property allow-tabs. - * tests/mozilla/js1_2/Array/slice.js: Added property allow-tabs. - * tests/mozilla/js1_2/Array/splice1.js: Added property allow-tabs. - * tests/mozilla/js1_2/Array/splice2.js: Added property allow-tabs. - * tests/mozilla/js1_2/Objects/toString-001.js: Added property allow-tabs. - * tests/mozilla/js1_2/String/charCodeAt.js: Added property allow-tabs. - * tests/mozilla/js1_2/String/concat.js: Modified property allow-tabs. - * tests/mozilla/js1_2/String/match.js: Added property allow-tabs. - * tests/mozilla/js1_2/String/slice.js: Added property allow-tabs. - * tests/mozilla/js1_2/function/Function_object.js: Added property allow-tabs. - * tests/mozilla/js1_2/function/Number.js: Modified property allow-tabs. - * tests/mozilla/js1_2/function/String.js: Modified property allow-tabs. - * tests/mozilla/js1_2/function/nesting.js: Added property allow-tabs. - * tests/mozilla/js1_2/function/regexparg-1.js: Added property allow-tabs. - * tests/mozilla/js1_2/function/regexparg-2-n.js: Added property allow-tabs. - * tests/mozilla/js1_2/jsref.js: Added property allow-tabs. - * tests/mozilla/js1_2/operator/equality.js: Added property allow-tabs. - * tests/mozilla/js1_2/operator/strictEquality.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_dollar_number.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_input.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_input_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_lastIndex.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_lastMatch.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_lastParen.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_leftContext.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_multiline.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_object.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_rightContext.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/alphanumeric.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/asterisk.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/backslash.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/backspace.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/beginLine.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/character_class.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/compile.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/control_characters.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/digit.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/dot.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/endLine.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/everything.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/exec.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/flags.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/global.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/hexadecimal.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/ignoreCase.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/interval.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/octal.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/parentheses.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/plus.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/question_mark.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/simple_form.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/source.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/special_characters.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/string_replace.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/string_search.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/string_split.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/test.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/toString.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/vertical_bar.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/whitespace.js: Added property allow-tabs. - * tests/mozilla/js1_2/regexp/word_boundary.js: Added property allow-tabs. - * tests/mozilla/js1_2/shell.js: Added property allow-tabs. - * tests/mozilla/js1_2/statements/break.js: Added property allow-tabs. - * tests/mozilla/js1_2/statements/continue.js: Added property allow-tabs. - * tests/mozilla/js1_2/statements/do_while.js: Added property allow-tabs. - * tests/mozilla/js1_2/statements/switch.js: Added property allow-tabs. - * tests/mozilla/js1_2/statements/switch2.js: Added property allow-tabs. - * tests/mozilla/js1_3/shell.js: Added property allow-tabs. - * tests/mozilla/js1_4/shell.js: Added property allow-tabs. - * tests/mozilla/js1_5/Regress/regress-111557.js: Added property allow-tabs. - * tests/mozilla/js1_5/Regress/regress-216320.js: Added property allow-tabs. - * tests/mozilla/menuhead.html: Added property allow-tabs. - * tests/mozilla/mklistpage.pl: Added property allow-tabs. - * tests/mozilla/runtests.pl: Added property allow-tabs. - -2010-01-08 Daniel Bates - - Reviewed by Adam Barth. - - https://bugs.webkit.org/show_bug.cgi?id=33417 - - Cleans up style errors exposed by the patch for bug #33198. - Moreover, fixes all "Weird number of spaces at line-start. Are you using a 4-space indent?" - errors reported by check-webkit-style. - - No functionality was changed. So, no new tests. - - * wtf/Platform.h: - -2010-01-08 Kent Hansen - - Reviewed by Eric Seidel. - - Don't store RegExp flags string representation - https://bugs.webkit.org/show_bug.cgi?id=33321 - - It's unused; the string representation is reconstructed from flags. - - * runtime/RegExp.cpp: - (JSC::RegExp::RegExp): - * runtime/RegExp.h: - -2010-01-08 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Memory use grows grows possibly unbounded in this JavaScript Array test case - https://bugs.webkit.org/show_bug.cgi?id=31675 - - This fixes one observed bug in this test case, which is that - arrays don't report extra cost for the sparse value maps. - - SunSpider reports a small speedup. - - * runtime/JSArray.cpp: - (JSC::JSArray::putSlowCase): Report extra memory cost for - the sparse value map. - * runtime/JSArray.h: - -2010-01-08 Yong Li - - Reviewed by Darin Adler. - - Remove unnecessary #include from FastMalloc.cpp - https://bugs.webkit.org/show_bug.cgi?id=33393 - - * wtf/FastMalloc.cpp: - -2010-01-08 Eric Seidel - - No review, rolling out r52983. - http://trac.webkit.org/changeset/52983 - https://bugs.webkit.org/show_bug.cgi?id=33321 - - Broke 59 JavaScriptCore tests. I don't think Kent knew about - run-javascriptcore-tests. Sadly neither does the commit-bot, - yet. - - * runtime/RegExp.cpp: - (JSC::RegExp::RegExp): - * runtime/RegExp.h: - (JSC::RegExp::flags): - -2010-01-08 Eric Seidel - - No review, rolling out r52981. - http://trac.webkit.org/changeset/52981 - https://bugs.webkit.org/show_bug.cgi?id=33319 - - Caused two JS tests to start failing: - ecma_2/RegExp/properties-001.js and js1_2/regexp/toString.js - - * runtime/RegExpPrototype.cpp: - (JSC::regExpProtoFuncToString): - -2010-01-08 Kent Hansen - - Reviewed by Darin Adler. - - Don't store RegExp flags string representation - https://bugs.webkit.org/show_bug.cgi?id=33321 - - It's unused; the string representation is reconstructed from flags. - - * runtime/RegExp.cpp: - (JSC::RegExp::RegExp): - * runtime/RegExp.h: - -2010-01-08 Kent Hansen - - Reviewed by Darin Adler. - - RegExp.prototype.toString returns "//" for empty regular expressions - https://bugs.webkit.org/show_bug.cgi?id=33319 - - "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA. - - * runtime/RegExpPrototype.cpp: - (JSC::regExpProtoFuncToString): - -2010-01-08 Norbert Leser - - Reviewed by Darin Adler. - - RVCT compiler with "-Otime -O3" optimization tries to optimize out - inline new'ed pointers that are passed as arguments. - Proposed patch assigns new'ed pointer explicitly outside function call. - - https://bugs.webkit.org/show_bug.cgi?id=33084 - - * API/JSClassRef.cpp: - (OpaqueJSClass::OpaqueJSClass): - (OpaqueJSClassContextData::OpaqueJSClassContextData): - -2010-01-08 Gabor Loki - - Reviewed by Gavin Barraclough. - - Remove an unnecessary cacheFlush from ARM_TRADITIONAL JIT - https://bugs.webkit.org/show_bug.cgi?id=33203 - - * assembler/ARMAssembler.cpp: Remove obsolete linkBranch function. - (JSC::ARMAssembler::executableCopy): Inline a clean linkBranch code. - * assembler/ARMAssembler.h: - (JSC::ARMAssembler::getLdrImmAddress): Use inline function. - (JSC::ARMAssembler::getLdrImmAddressOnPool): Ditto. - (JSC::ARMAssembler::patchPointerInternal): Remove an unnecessary cacheFlush. - (JSC::ARMAssembler::linkJump): Use patchPointerInternal instead of linkBranch. - (JSC::ARMAssembler::linkCall): Ditto. - (JSC::ARMAssembler::relinkCall): Ditto. - -2010-01-07 Gabor Loki - - Reviewed by Gavin Barraclough. - - Build fix for JSVALUE32 when ENABLE_JIT_OPTIMIZE* are disabled - https://bugs.webkit.org/show_bug.cgi?id=33311 - - Move compileGetDirectOffset function to common part of JSVALUE32 - - * jit/JITPropertyAccess.cpp: - (JSC::JIT::compileGetDirectOffset): - -2010-01-07 Laszlo Gombos - - Reviewed by Maciej Stachowiak. - - Allow call sites to determine if ASSERT_* and LOG_* macros are operational - https://bugs.webkit.org/show_bug.cgi?id=33020 - - * wtf/Assertions.h: Set ASSERT_MSG_DISABLED, FATAL_DISABLED, - ERROR_DISABLED, LOG_DISABLED to 1 if the compiler does not support - variadic macros. Refactor for better readibility. - -2010-01-07 Daniel Bates - - Reviewed by Eric Seidel. - - https://bugs.webkit.org/show_bug.cgi?id=32987 - - Added ENABLE_XHTMLMP flag. Disabled by default. - - * Configurations/FeatureDefines.xcconfig: - -2010-01-07 Laszlo Gombos - - Reviewed by Gavin Barraclough. - - [Symbian] Port ARM traditional JIT Trampolines to RVCT - https://bugs.webkit.org/show_bug.cgi?id=30552 - - Take the GCC implementation and mechanically convert - it to RVCT syntax. - - Use 'bx rX' instead of 'mov pc, rX' when it is available. - - Developed in cooperation with Iain Campbell and Gabor Loki. - - * JavaScriptCore.pri: Extra step to generate RVCT stubs. The - script generation intentionally executed all the time not just - for RVCT targets. - - * create_rvct_stubs: Added. Perl script to expand precompiler macros - for RVCT assembler - the template is defined in JITStubs.cpp. - - * jit/JITStubs.cpp: - (JSC::ctiTrampoline): - (JSC::ctiVMThrowTrampoline): - (JSC::ctiOpThrowNotCaught): - -2010-01-07 Geoffrey Garen - - Reviewed by Sam Weinig. - - Fix a crash seen on the buildbots. - - * runtime/JSGlobalObject.cpp: - (JSC::JSGlobalObject::init): Disable specific function tracking here, - instead of in WebCore, to ensure that the disabling happens before a - specific function can be registered. - -2010-01-07 Alexey Proskuryakov - - Mac build fix. - - * JavaScriptCore.exp: Export new JSGlobalData static data members. - -2010-01-07 Alexey Proskuryakov - - Reviewed by Geoffrey Garen. - - https://bugs.webkit.org/show_bug.cgi?id=33057 - REGRESSION(r49365): typeof(xhr.responseText) != "string" in Windows - - REGRESSION: WebKit fails to start PeaceKeeper benchmark - - Test: fast/js/webcore-string-comparison.html - - In r49365, some code was moved from JSString.cpp to JSString.h, and as a result, WebCore - got a way to directly instantiate JSStrings over DLL borders. Since vftable for JSString was - not exported, objects created from WebCore got a different vptr, and JavaScriptCore - optimizations that relied on vptr of all JSString objects being equal failed. - - * config.h: Added a JS_EXPORTCLASS macro for exporting classes. It's currently the same as - JS_EXPORTDATA, but it clearly needed a new name. - - * runtime/InitializeThreading.cpp: - (JSC::initializeThreadingOnce): - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::storeVPtrs): - (JSC::JSGlobalData::JSGlobalData): - (JSC::JSGlobalData::createNonDefault): - (JSC::JSGlobalData::create): - (JSC::JSGlobalData::sharedInstance): - * runtime/JSGlobalData.h: - Store vptrs just once, no need to repeatedly pick and copy them. This makes it possible to - assert vptr correctness in object destructors (which don't have access to JSGlobalData, - and even Heap::heap(this) will fail for fake objects created from storeVPtrs()). - - * runtime/JSArray.cpp: (JSC::JSArray::~JSArray): Assert that vptr is what we expect it to be. - It's important to assert in destructor, because MSVC changes the vptr after constructor - is invoked. - * runtime/JSByteArray.cpp: (JSC::JSByteArray::~JSByteArray): Ditto. - * runtime/JSByteArray.h: Ditto. - * runtime/JSFunction.h: Ditto. - * runtime/JSFunction.cpp: (JSC::JSFunction::~JSFunction): Ditto. - - * runtime/JSCell.h: (JSC::JSCell::setVPtr): Added a method to substitute vptr for another - one. - - * runtime/JSString.h: Export JSString class together with its vftable, and tell other - libraries tp import it. This is needed on platforms that have a separate JavaScriptCore - dynamic library - and on Mac, we already did the export via JavaScriptCore.exp. - (JSC::JSString::~JSString): Assert tha vptr is what we expect it to be. - (JSC::fixupVPtr): Store a previously saved primary vftable pointer (do nothing if building - JavaScriptCore itself). - (JSC::jsSingleCharacterString): Call fixupVPtr in case this is call across DLL boundary. - (JSC::jsSingleCharacterSubstring): Ditto. - (JSC::jsNontrivialString): Ditto. - (JSC::jsString): Ditto. - (JSC::jsSubstring): Ditto. - (JSC::jsOwnedString): Ditto. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export the new static - JSGlobalData members that are used in WebCore via inline functions. - -2010-01-07 Geoffrey Garen - - Reviewed by Sam Weinig. - - Safari memory usage skyrockets using new Google AdWords interface - https://bugs.webkit.org/show_bug.cgi?id=33343 - - The memory use was caused by the global object creating too many structures - as it thrashed between different specific functions. - - * runtime/Structure.cpp: - (JSC::Structure::Structure): - (JSC::Structure::addPropertyTransition): - (JSC::Structure::changePrototypeTransition): - (JSC::Structure::despecifyFunctionTransition): - (JSC::Structure::addAnonymousSlotsTransition): - (JSC::Structure::getterSetterTransition): - (JSC::Structure::toDictionaryTransition): - (JSC::Structure::addPropertyWithoutTransition): - (JSC::Structure::despecifyAllFunctions): - * runtime/Structure.h: - (JSC::Structure::disableSpecificFunctionTracking): Track a thrash count - for specific functions. Disable specific function tracking once the - thrash count has been hit. - -2010-01-07 Csaba Osztrogonác - - Reviewed by Simon Hausmann. - - [Qt] Enable JIT in debug mode on win32 after r51141 fixed the crashes. - - * JavaScriptCore.pri: - -2010-01-07 Zoltan Horvath - - Reviewed by Holger Freyther. - - [Mac] Build fix when FAST_MALLOC_MATCH_VALIDATION=1 - https://bugs.webkit.org/show_bug.cgi?id=33312 - - Using of operator += cause compile error on Mac, so it is changed to - "= static_cast(old_ptr) + 1". - - * wtf/FastMalloc.cpp: - (WTF::TCMallocStats::realloc): - -2010-01-07 Zoltan Horvath - - Reviewed by Holger Freyther. - - [Qt] Build fix when FAST_MALLOC_MATCH_VALIDATION=1 - https://bugs.webkit.org/show_bug.cgi?id=33312 - - Remove pByte (committed in r42344 from #20422), because pByte doesn't - exist and it is unnecessary. - - * wtf/FastMalloc.cpp: - (WTF::TCMallocStats::realloc): - -2010-01-06 Gavin Barraclough - - QT build fix. - - * runtime/Identifier.cpp: - (JSC::createIdentifierTableSpecific): - -2010-01-06 Gavin Barraclough - - Windows build fix part I. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2010-01-06 Dan Bernstein - - Build fix - - * runtime/Identifier.cpp: - (JSC::createIdentifierTableSpecificCallback): - -2010-01-05 Gavin Barraclough - - Reviewed by Sam Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=33236 - Remove m_identifierTable pointer from UString - - Currently every string holds a pointer so that during destruction, - if a string has been used as an identifier, it can remove itself - from the table. By instead accessing the identifierTable via a - thread specific tracking the table associated with the current - globaldata, we can save the memory cost of this pointer. - - * API/APIShims.h: - (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): - (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): - (JSC::APICallbackShim::APICallbackShim): - (JSC::APICallbackShim::~APICallbackShim): - - - change the API shims to track the identifierTable of the current JSGlobalData. - - * API/JSContextRef.cpp: - (JSContextGroupCreate): - - - update creation of JSGlobalData for API usage to use new create method. - - fix shim instanciation bug in JSGlobalContextCreateInGroup. - - * JavaScriptCore.exp: - * runtime/Completion.cpp: - (JSC::checkSyntax): - (JSC::evaluate): - - - add asserts to check the identifierTable is being tracked correctly. - - * runtime/Identifier.cpp: - (JSC::IdentifierTable::~IdentifierTable): - (JSC::IdentifierTable::add): - (JSC::Identifier::remove): - (JSC::Identifier::checkSameIdentifierTable): - (JSC::createIdentifierTableSpecificCallback): - (JSC::createIdentifierTableSpecific): - (JSC::createDefaultDataSpecific): - - - Use currentIdentifierTable() instead of UStringImpl::m_identifierTable. - - Define methods to access the thread specific identifier tables. - - * runtime/Identifier.h: - (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData): - (JSC::defaultIdentifierTable): - (JSC::setDefaultIdentifierTable): - (JSC::currentIdentifierTable): - (JSC::setCurrentIdentifierTable): - (JSC::resetCurrentIdentifierTable): - - - Declare methods to access the thread specific identifier tables. - - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::createNonDefault): - (JSC::JSGlobalData::create): - (JSC::JSGlobalData::sharedInstance): - - - creation of JSGlobalData objects, other than for API usage, associate themselves with the current thread. - - * runtime/JSGlobalData.h: - * runtime/UStringImpl.cpp: - (JSC::UStringImpl::destroy): - - - destroy() method should be using isIdentifier(). - - * runtime/UStringImpl.h: - (JSC::UStringImpl::isIdentifier): - (JSC::UStringImpl::setIsIdentifier): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::UStringImpl): - - - replace m_identifierTable with a single m_isIdentifier bit. - - * wtf/StringHashFunctions.h: - (WTF::stringHash): - - - change string hash result from 32-bit to 31-bit, to free a bit in UStringImpl for m_isIdentifier. - -2009-12-25 Patrick Gansterer - - Reviewed by Eric Seidel. - - Buildfix for WinCE + style fixes. - https://bugs.webkit.org/show_bug.cgi?id=32939 - - * jsc.cpp: - (functionPrint): - (functionQuit): - (parseArguments): - (fillBufferWithContentsOfFile): - -2010-01-05 Patrick Gansterer - - Reviewed by Eric Seidel. - - WinCE buildfix after r52791 (renamed PLATFORM(WINCE) to OS(WINCE)). - https://bugs.webkit.org/show_bug.cgi?id=33205 - - * jit/ExecutableAllocator.h: - -2010-01-05 Patrick Gansterer - - Reviewed by Darin Adler. - - Added compiler error for unsupported platforms. - https://bugs.webkit.org/show_bug.cgi?id=33112 - - * jit/JITStubs.cpp: - -2010-01-05 Gabor Loki - - Reviewed by Maciej Stachowiak. - - Follow r52729 in ARMAssembler. - https://bugs.webkit.org/show_bug.cgi?id=33208 - - Use WTF_ARM_ARCH_AT_LEAST instead of ARM_ARCH_VERSION - - * assembler/ARMAssembler.cpp: - (JSC::ARMAssembler::encodeComplexImm): Move tmp declaration to ARMv7 - * assembler/ARMAssembler.h: - (JSC::ARMAssembler::): - (JSC::ARMAssembler::bkpt): - -2010-01-05 Maciej Stachowiak - - Unreviewed build fix for Gtk+ - - Don't use // comments in Platform.h, at least some of them seem to make the version of GCC - used on the Gtk buildbot unhappy. - - * wtf/Platform.h: - -2010-01-04 Maciej Stachowiak - - Reviewed by Darin Fisher. - - Reorganize, document and rename OS() platform macros. - https://bugs.webkit.org/show_bug.cgi?id=33198 - - * wtf/Platform.h: Rename, reorganize and document OS() macros. - - Adapt to name changes. Also fixed a few incorrect OS checks. - - * API/JSContextRef.cpp: - * assembler/MacroAssemblerARM.cpp: - (JSC::isVFPPresent): - * assembler/MacroAssemblerX86Common.h: - * bytecode/SamplingTool.cpp: - * config.h: - * interpreter/RegisterFile.cpp: - (JSC::RegisterFile::~RegisterFile): - * interpreter/RegisterFile.h: - (JSC::RegisterFile::RegisterFile): - (JSC::RegisterFile::grow): - * jit/ExecutableAllocator.h: - * jit/ExecutableAllocatorFixedVMPool.cpp: - * jit/ExecutableAllocatorPosix.cpp: - * jit/ExecutableAllocatorSymbian.cpp: - * jit/ExecutableAllocatorWin.cpp: - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * jit/JITStubs.cpp: - * jsc.cpp: - (main): - * parser/Grammar.y: - * profiler/ProfileNode.cpp: - (JSC::getCount): - * runtime/Collector.cpp: - (JSC::Heap::Heap): - (JSC::Heap::allocateBlock): - (JSC::Heap::freeBlockPtr): - (JSC::currentThreadStackBase): - (JSC::getCurrentPlatformThread): - (JSC::suspendThread): - (JSC::resumeThread): - (JSC::getPlatformThreadRegisters): - (JSC::otherThreadStackPointer): - * runtime/Collector.h: - * runtime/DateConstructor.cpp: - * runtime/DatePrototype.cpp: - (JSC::formatLocaleDate): - * runtime/InitializeThreading.cpp: - (JSC::initializeThreading): - * runtime/MarkStack.h: - (JSC::MarkStack::MarkStackArray::shrinkAllocation): - * runtime/MarkStackPosix.cpp: - * runtime/MarkStackSymbian.cpp: - * runtime/MarkStackWin.cpp: - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncLastIndexOf): - * runtime/TimeoutChecker.cpp: - (JSC::getCPUTime): - * runtime/UString.cpp: - (JSC::UString::from): - * wtf/Assertions.cpp: - * wtf/Assertions.h: - * wtf/CurrentTime.cpp: - (WTF::lowResUTCTime): - * wtf/CurrentTime.h: - (WTF::getLocalTime): - * wtf/DateMath.cpp: - * wtf/FastMalloc.cpp: - (WTF::TCMalloc_ThreadCache::InitModule): - (WTF::TCMallocStats::): - * wtf/FastMalloc.h: - * wtf/MathExtras.h: - * wtf/RandomNumber.cpp: - (WTF::randomNumber): - * wtf/RandomNumberSeed.h: - (WTF::initializeRandomNumberGenerator): - * wtf/StringExtras.h: - * wtf/TCSpinLock.h: - (TCMalloc_SpinLock::Unlock): - (TCMalloc_SlowLock): - * wtf/TCSystemAlloc.cpp: - * wtf/ThreadSpecific.h: - (WTF::::destroy): - * wtf/Threading.h: - * wtf/ThreadingPthreads.cpp: - (WTF::initializeThreading): - (WTF::isMainThread): - * wtf/ThreadingWin.cpp: - (WTF::wtfThreadEntryPoint): - (WTF::createThreadInternal): - * wtf/VMTags.h: - * wtf/unicode/icu/CollatorICU.cpp: - (WTF::Collator::userDefault): - * wtf/win/MainThreadWin.cpp: - (WTF::initializeMainThreadPlatform): - -2010-01-04 Gustavo Noronha Silva - - Add missing files to the build system - make distcheck build fix. - - * GNUmakefile.am: - -2010-01-04 Gavin Barraclough - - Reviewed by Sam Weinig, additional coding by Mark Rowe. - - https://bugs.webkit.org/show_bug.cgi?id=33163 - Add string hashing functions to WTF. - Use WTF's string hashing functions from UStringImpl. - - * GNUmakefile.am: - * JavaScriptCore.exp: - * JavaScriptCore.gypi: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/UStringImpl.cpp: - * runtime/UStringImpl.h: - (JSC::UStringImpl::computeHash): - * wtf/HashFunctions.h: - * wtf/StringHashFunctions.h: Added. - (WTF::stringHash): - -2010-01-04 Dmitry Titov - - Not reviewed, attempt to fix ARM bulid. - - * wtf/Platform.h: - -2010-01-04 Gavin Barraclough - - Rubber stamped by Geoff Garen. - - Add an 'isIdentifier' to UStringImpl, use this where appropriate - (where previously 'identifierTable' was being tested). - - * API/JSClassRef.cpp: - (OpaqueJSClass::~OpaqueJSClass): - (OpaqueJSClassContextData::OpaqueJSClassContextData): - * runtime/Identifier.cpp: - (JSC::Identifier::addSlowCase): - * runtime/Identifier.h: - (JSC::Identifier::add): - * runtime/PropertyNameArray.cpp: - (JSC::PropertyNameArray::add): - * runtime/UStringImpl.h: - (JSC::UStringImpl::isIdentifier): - -2010-01-04 Gavin Barraclough - - Reviewed by Sam "Shimmey Shimmey" Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=33158 - Refactor JSC API entry/exit to use RAII instead of copy/pasting code. - Make it easier to change set of actions taken when passing across the API boundary. - - * API/APIShims.h: Added. - (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): - (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): - (JSC::APIEntryShim::APIEntryShim): - (JSC::APICallbackShim::APICallbackShim): - (JSC::APICallbackShim::~APICallbackShim): - * API/JSBase.cpp: - (JSEvaluateScript): - (JSCheckScriptSyntax): - (JSGarbageCollect): - (JSReportExtraMemoryCost): - * API/JSCallbackConstructor.cpp: - (JSC::constructJSCallback): - * API/JSCallbackFunction.cpp: - (JSC::JSCallbackFunction::call): - * API/JSCallbackObjectFunctions.h: - (JSC::::init): - (JSC::::getOwnPropertySlot): - (JSC::::put): - (JSC::::deleteProperty): - (JSC::::construct): - (JSC::::hasInstance): - (JSC::::call): - (JSC::::getOwnPropertyNames): - (JSC::::toNumber): - (JSC::::toString): - (JSC::::staticValueGetter): - (JSC::::callbackGetter): - * API/JSContextRef.cpp: - * API/JSObjectRef.cpp: - (JSObjectMake): - (JSObjectMakeFunctionWithCallback): - (JSObjectMakeConstructor): - (JSObjectMakeFunction): - (JSObjectMakeArray): - (JSObjectMakeDate): - (JSObjectMakeError): - (JSObjectMakeRegExp): - (JSObjectGetPrototype): - (JSObjectSetPrototype): - (JSObjectHasProperty): - (JSObjectGetProperty): - (JSObjectSetProperty): - (JSObjectGetPropertyAtIndex): - (JSObjectSetPropertyAtIndex): - (JSObjectDeleteProperty): - (JSObjectCallAsFunction): - (JSObjectCallAsConstructor): - (JSObjectCopyPropertyNames): - (JSPropertyNameArrayRelease): - (JSPropertyNameAccumulatorAddName): - * API/JSValueRef.cpp: - (JSValueGetType): - (JSValueIsUndefined): - (JSValueIsNull): - (JSValueIsBoolean): - (JSValueIsNumber): - (JSValueIsString): - (JSValueIsObject): - (JSValueIsObjectOfClass): - (JSValueIsEqual): - (JSValueIsStrictEqual): - (JSValueIsInstanceOfConstructor): - (JSValueMakeUndefined): - (JSValueMakeNull): - (JSValueMakeBoolean): - (JSValueMakeNumber): - (JSValueMakeString): - (JSValueToBoolean): - (JSValueToNumber): - (JSValueToStringCopy): - (JSValueToObject): - (JSValueProtect): - (JSValueUnprotect): - * JavaScriptCore.xcodeproj/project.pbxproj: - -2010-01-04 Dan Bernstein - - Reviewed by Ada Chan and Mark Rowe. - - Updated copyright string - - * Info.plist: - * JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: - -2010-01-04 Adam Roben - - No review, rolling out r52741. - http://trac.webkit.org/changeset/52741 - https://bugs.webkit.org/show_bug.cgi?id=33056 - - * wtf/AlwaysInline.h: - -2010-01-04 Patrick Gansterer - - Reviewed by Darin Adler. - - Add cacheFlush support for WinCE - https://bugs.webkit.org/show_bug.cgi?id=33110 - - * jit/ExecutableAllocator.h: - (JSC::ExecutableAllocator::cacheFlush): - -2010-01-04 Patrick Gansterer - - Reviewed by Adam Roben. - - Implement NO_RETURN for COMPILER(MSVC). - https://bugs.webkit.org/show_bug.cgi?id=33056 - - * wtf/AlwaysInline.h: - -2010-01-04 Maciej Stachowiak - - Reviewed by Simon Hausmann. - - Fix some PLATFORM(*_ENDIAN) uses to CPU() - https://bugs.webkit.org/show_bug.cgi?id=33148 - - * runtime/JSCell.cpp: - (JSC::): - * runtime/JSValue.h: - (JSC::JSValue::): - -2010-01-04 Maciej Stachowiak - - Reviewed by Adam Barth. - - Document CPU() macros in comments. - https://bugs.webkit.org/show_bug.cgi?id=33147 - - * wtf/Platform.h: - -2010-01-04 Maciej Stachowiak - - Reviewed by Adam Barth. - - Reorganize, document and rename CPU() platform macros. - https://bugs.webkit.org/show_bug.cgi?id=33145 - ExecutableAllocatorSymbian appears to have buggy ARM version check - https://bugs.webkit.org/show_bug.cgi?id=33138 - - * wtf/Platform.h: - Rename all macros related to detection of particular CPUs or - classes of CPUs to CPU(), reorganize and document them. - - All remaining changes are adapting to the renames, plus fixing the - second bug cited above. - - * assembler/ARMAssembler.cpp: - * assembler/ARMAssembler.h: - * assembler/ARMv7Assembler.h: - * assembler/AbstractMacroAssembler.h: - (JSC::AbstractMacroAssembler::Imm32::Imm32): - * assembler/MacroAssembler.h: - * assembler/MacroAssemblerARM.cpp: - * assembler/MacroAssemblerARM.h: - * assembler/MacroAssemblerCodeRef.h: - (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): - * assembler/MacroAssemblerX86.h: - * assembler/MacroAssemblerX86Common.h: - * assembler/MacroAssemblerX86_64.h: - * assembler/X86Assembler.h: - (JSC::X86Registers::): - (JSC::X86Assembler::): - (JSC::X86Assembler::movl_mEAX): - (JSC::X86Assembler::movl_EAXm): - (JSC::X86Assembler::repatchLoadPtrToLEA): - (JSC::X86Assembler::X86InstructionFormatter::memoryModRM): - * jit/ExecutableAllocator.h: - * jit/ExecutableAllocatorFixedVMPool.cpp: - * jit/ExecutableAllocatorPosix.cpp: - * jit/ExecutableAllocatorSymbian.cpp: - (JSC::ExecutableAllocator::intializePageSize): - * jit/JIT.cpp: - * jit/JIT.h: - * jit/JITArithmetic.cpp: - * jit/JITInlineMethods.h: - (JSC::JIT::beginUninterruptedSequence): - (JSC::JIT::restoreArgumentReferenceForTrampoline): - (JSC::JIT::emitCount): - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * jit/JITPropertyAccess.cpp: - (JSC::JIT::privateCompileGetByIdProto): - (JSC::JIT::privateCompileGetByIdProtoList): - (JSC::JIT::privateCompileGetByIdChainList): - (JSC::JIT::privateCompileGetByIdChain): - * jit/JITStubs.cpp: - (JSC::JITThunks::JITThunks): - * jit/JITStubs.h: - * runtime/Collector.cpp: - (JSC::currentThreadStackBase): - (JSC::getPlatformThreadRegisters): - (JSC::otherThreadStackPointer): - * wrec/WREC.h: - * wrec/WRECGenerator.cpp: - (JSC::WREC::Generator::generateEnter): - (JSC::WREC::Generator::generateReturnSuccess): - (JSC::WREC::Generator::generateReturnFailure): - * wrec/WRECGenerator.h: - * wtf/FastMalloc.cpp: - * wtf/TCSpinLock.h: - (TCMalloc_SpinLock::Lock): - (TCMalloc_SpinLock::Unlock): - (TCMalloc_SlowLock): - * wtf/Threading.h: - * wtf/dtoa.cpp: - * yarr/RegexJIT.cpp: - (JSC::Yarr::RegexGenerator::generateEnter): - (JSC::Yarr::RegexGenerator::generateReturn): - * yarr/RegexJIT.h: - -2010-01-04 Maciej Stachowiak - - Reviewed by Adam Barth. - - Clean up COMPILER macros and remove unused ones. - https://bugs.webkit.org/show_bug.cgi?id=33132 - - Removed values are COMPILER(BORLAND) and COMPILER(CYGWIN) - they were - not used anywhere. - - * wtf/Platform.h: - -2010-01-03 Maciej Stachowiak - - Reviewed by Eric Seidel. - - Update wtf/Platform.h to document the new system for porting macros. - https://bugs.webkit.org/show_bug.cgi?id=33130 - - * wtf/Platform.h: - -2009-12-29 Laszlo Gombos - - Reviewed by Maciej Stachowiak. - - PLATFORM(CAIRO) should be defined by WIN_CAIRO define - https://bugs.webkit.org/show_bug.cgi?id=22250 - - * wtf/Platform.h: Define WTF_PLATFORM_CAIRO for GTK port only - For the WinCairo port WTF_PLATFORM_CAIRO is already defined in config.h - -2009-12-28 Shu Chang - - Reviewed by Laszlo Gombos. - - [Qt] Delete ThreadPrivate instance after it is finished. - https://bugs.webkit.org/show_bug.cgi?id=32614 - - * wtf/qt/ThreadingQt.cpp: - (WTF::ThreadMonitor::instance): - (WTF::ThreadMonitor::threadFinished): - (WTF::createThreadInternal): - (WTF::detachThread): - -2009-12-28 Patrick Gansterer - - Reviewed by Maciej Stachowiak. - - Cleanup of #define JS_EXPORT. - - * API/JSBase.h: - -2009-12-27 Patrick Gansterer - - Reviewed by Adam Barth. - - WinCE buildfix (HWND_MESSAGE isn't supported there) - - * wtf/win/MainThreadWin.cpp: - (WTF::initializeMainThreadPlatform): - -2009-12-27 Patrick Gansterer - - Reviewed by Adam Barth. - - Added a file with WinMain function to link agains in WinCE. - - * os-win32/WinMain.cpp: Added. - (convertToUtf8): - (WinMain): - -2009-12-24 Laszlo Gombos - - Unreviewed; revert of r52550. - - The change regressed the following LayoutTests for QtWebKit. - - fast/workers/worker-call.html -> crashed - fast/workers/worker-close.html -> crashed - - * wtf/qt/ThreadingQt.cpp: - (WTF::waitForThreadCompletion): - (WTF::detachThread): - -2009-12-24 Shu Chang - - Reviewed by Laszlo Gombos. - - [Qt] Fix memory leak by deleting instance of ThreadPrivate - in function waitForThreadCompletion(), synchronously, or in - detachThread(), asynchronously. - https://bugs.webkit.org/show_bug.cgi?id=32614 - - * wtf/qt/ThreadingQt.cpp: - (WTF::waitForThreadCompletion): - (WTF::detachThread): - -2009-12-23 Kwang Yul Seo - - Reviewed by Laszlo Gombos. - - Include stddef.h for ptrdiff_t - https://bugs.webkit.org/show_bug.cgi?id=32891 - - ptrdiff_t is typedef-ed in stddef.h. - Include stddef.h in jit/ExecutableAllocator.h. - - * jit/ExecutableAllocator.h: - -2009-12-23 Patrick Gansterer - - Reviewed by Eric Seidel. - - Buildfix after r47092. - - * wtf/wince/MemoryManager.cpp: - (WTF::tryFastMalloc): - (WTF::tryFastZeroedMalloc): - (WTF::tryFastCalloc): - (WTF::tryFastRealloc): - -2009-12-23 Kent Tamura - - Reviewed by Darin Adler. - - HTMLInputElement::valueAsDate getter support. - https://bugs.webkit.org/show_bug.cgi?id=32876 - - Expose dateToDaysFrom1970(). - - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * wtf/DateMath.cpp: - (WTF::dateToDaysFrom1970): - * wtf/DateMath.h: - -2009-12-22 Darin Adler - - Reviewed by Mark Rowe. - - Turn off datagrid by default, at least for all platforms Apple ships. - The datagrid implementation isn't ready for general web use yet. - - * Configurations/FeatureDefines.xcconfig: Turn off datagrid by default. - -2009-12-22 Steve Block - - Reviewed by David Levin. - - Updates Android's scheduleDispatchFunctionsOnMainThread() to use new - AndroidThreading class, rather than using JavaSharedClient directly. - This fixes the current layering violation. - https://bugs.webkit.org/show_bug.cgi?id=32651 - - The pattern is copied from Chromium, which uses the ChromiumThreading - class. This patch also fixes the style in ChromiumThreading.h. - - * wtf/android/AndroidThreading.h: Added. Declares AndroidThreading. - * wtf/android/MainThreadAndroid.cpp: Modified - (WTF::scheduleDispatchFunctionsOnMainThread): Uses AndroidThreading. - * wtf/chromium/ChromiumThreading.h: Modified. Fixes style. - -2009-12-22 Gavin Barraclough - - Reviewed by Sam Weinig. - - Fix a couple of problems with UntypedPtrAndBitfield. - - Add a m_leaksPtr to reduce false positives from leaks in debug builds - (this isn't perfect because we'd like a solution for release builds, - but this is now at least as good as a PtrAndFlags would be). - - Switch SmallStringsto use a regular string for the base, rather than - a static one. UntypedPtrAndBitfield assumes all strings are at least - 8 byte aligned; this migt not be true of static strings. Shared buffers - are heap allocated, as are all UStringImpls other than static strings. - Static strings cannot end up being the owner string of substrings, - since the only static strings are length 0. - - * runtime/SmallStrings.cpp: - (JSC::SmallStringsStorage::SmallStringsStorage): - * runtime/UStringImpl.h: - (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): - (JSC::UStringImpl::UStringImpl): - -2009-12-22 Kwang Yul Seo - - Reviewed by Darin Adler. - - RVCT (__ARMCC_VERSION < 400000) does not provide strcasecmp and strncasecmp - https://bugs.webkit.org/show_bug.cgi?id=32857 - - Add implementation of strcasecmp and strncasecmp for RVCT < 4.0 - because earlier versions of RVCT 4.0 does not provide these functions. - - * wtf/StringExtras.cpp: Added. - (strcasecmp): - (strncasecmp): - * wtf/StringExtras.h: - -2009-12-22 Kwang Yul Seo - - Reviewed by Darin Adler. - - Define ALWAYS_INLINE and WTF_PRIVATE_INLINE to __forceinline for RVCT - https://bugs.webkit.org/show_bug.cgi?id=32853 - - Use __forceinline forces RVCT to compile a C or C++ function - inline. The compiler attempts to inline the function, regardless of - the characteristics of the function. - - * wtf/AlwaysInline.h: - * wtf/FastMalloc.h: - -2009-12-21 Simon Hausmann - - Prospective GTK build fix: Add UStringImpl.cpp/h to the build. - - * GNUmakefile.am: - -2009-12-21 Simon Hausmann - - Fix the Qt build, add UStringImpl.cpp to the build. - - * JavaScriptCore.pri: - -2009-12-21 Gavin Barraclough - - Windows Build fix part 5. - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - -2009-12-21 Gavin Barraclough - - Reviewed by NOBODY (build fix). - Fix breakage of world introduced in build fix to r52463. - - * runtime/UStringImpl.h: - -2009-12-21 Gavin Barraclough - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=32831 - Replace UString::Rep implementation, following introduction of ropes to JSC. - - * Remove redundant overcapacity mechanisms. - * Reduce memory cost of Rep's. - * Add an inline storage mechanism akin to that in WebCore's StringImpl. - - ~1% Sunspider progression. - - * JavaScriptCore.exp: - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - * runtime/SmallStrings.cpp: - (JSC::SmallStringsStorage::SmallStringsStorage): - * runtime/UString.cpp: - (JSC::initializeUString): - (JSC::createRep): - (JSC::UString::createFromUTF8): - (JSC::UString::createUninitialized): - (JSC::UString::spliceSubstringsWithSeparators): - (JSC::UString::replaceRange): - (JSC::UString::ascii): - (JSC::UString::operator=): - (JSC::UString::toStrictUInt32): - (JSC::equal): - * runtime/UString.h: - (JSC::UString::isEmpty): - (JSC::UString::cost): - (JSC::makeString): - * runtime/UStringImpl.cpp: Added. - (JSC::UStringImpl::baseSharedBuffer): - (JSC::UStringImpl::sharedBuffer): - (JSC::UStringImpl::destroy): - (JSC::UStringImpl::computeHash): - * runtime/UStringImpl.h: Added. - (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): - (JSC::UntypedPtrAndBitfield::asPtr): - (JSC::UntypedPtrAndBitfield::operator&=): - (JSC::UntypedPtrAndBitfield::operator|=): - (JSC::UntypedPtrAndBitfield::operator&): - (JSC::UStringImpl::create): - (JSC::UStringImpl::createCopying): - (JSC::UStringImpl::createUninitialized): - (JSC::UStringImpl::data): - (JSC::UStringImpl::size): - (JSC::UStringImpl::cost): - (JSC::UStringImpl::hash): - (JSC::UStringImpl::computedHash): - (JSC::UStringImpl::setHash): - (JSC::UStringImpl::identifierTable): - (JSC::UStringImpl::setIdentifierTable): - (JSC::UStringImpl::ref): - (JSC::UStringImpl::deref): - (JSC::UStringImpl::allocChars): - (JSC::UStringImpl::copyChars): - (JSC::UStringImpl::computeHash): - (JSC::UStringImpl::null): - (JSC::UStringImpl::empty): - (JSC::UStringImpl::checkConsistency): - (JSC::UStringImpl::): - (JSC::UStringImpl::UStringImpl): - (JSC::UStringImpl::operator new): - (JSC::UStringImpl::bufferOwnerString): - (JSC::UStringImpl::bufferOwnership): - (JSC::UStringImpl::isStatic): - -2009-12-18 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - Move some build decisions from Qt build system into source files - https://bugs.webkit.org/show_bug.cgi?id=31956 - - * JavaScriptCore.pri: Compile files unconditionally - * jit/ExecutableAllocatorPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN) - * jit/ExecutableAllocatorWin.cpp: Guard with PLATFORM(WIN_OS) - * runtime/MarkStackPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN) - * runtime/MarkStackSymbian.cpp: Guard with PLATFORM(SYMBIAN) - * runtime/MarkStackWin.cpp: Guard with PLATFORM(WIN_OS) - * wtf/Platform.h: Guard ENABLE_JSC_MULTIPLE_THREADS with ENABLE_SINGLE_THREADED for the Qt port - * wtf/ThreadingNone.cpp: Guard with ENABLE(SINGLE_THREADED) - * wtf/qt/ThreadingQt.cpp: Guard with !ENABLE(SINGLE_THREADED) - -2009-12-18 Gavin Barraclough - - Reviewed by Sam Weinig. - - Add createNonCopying method to UString to make replace constructor passed bool, - to make behaviour more explicit. Add createFromUTF8 to UString (wrapping method - on UString::Rep), since other cases of transliteration (e.g. from ascii) are - performed in UString constructors. Add/use setHash & size() accessors on Rep, - rather than accessing _hash/len directly. - - * API/JSClassRef.cpp: - (OpaqueJSClass::OpaqueJSClass): - * API/OpaqueJSString.cpp: - (OpaqueJSString::ustring): - * JavaScriptCore.exp: - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncToString): - * runtime/Identifier.cpp: - (JSC::Identifier::equal): - (JSC::CStringTranslator::translate): - (JSC::UCharBufferTranslator::translate): - (JSC::Identifier::addSlowCase): - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - * runtime/JSString.h: - (JSC::JSString::Rope::Fiber::refAndGetLength): - (JSC::JSString::Rope::append): - * runtime/StringBuilder.h: - (JSC::StringBuilder::release): - * runtime/StringConstructor.cpp: - (JSC::stringFromCharCodeSlowCase): - * runtime/StringPrototype.cpp: - (JSC::substituteBackreferencesSlow): - (JSC::stringProtoFuncToLowerCase): - (JSC::stringProtoFuncToUpperCase): - (JSC::stringProtoFuncFontsize): - (JSC::stringProtoFuncLink): - * runtime/UString.cpp: - (JSC::UString::UString): - (JSC::UString::createNonCopying): - (JSC::UString::createFromUTF8): - * runtime/UString.h: - (JSC::UString::Rep::setHash): - (JSC::UString::~UString): - (JSC::makeString): - -2009-12-18 Geoffrey Garen - - Reviewed by Cameron Zwarich and Gavin Barraclough. - - Changed Register constructors to assignment operators, to streamline - moving values into registers. (In theory, there's no difference between - the two, since the constructor should just inline away, but there seems - to be a big difference in the addled mind of the GCC optimizer.) - - In the interpreter, this is a 3.5% SunSpider speedup and a 1K-2K - reduction in stack usage per privateExecute stack frame. - - * interpreter/CallFrame.h: - (JSC::ExecState::setCalleeArguments): - (JSC::ExecState::setCallerFrame): - (JSC::ExecState::setScopeChain): - (JSC::ExecState::init): - (JSC::ExecState::setArgumentCount): - (JSC::ExecState::setCallee): - (JSC::ExecState::setCodeBlock): Added a little bit of casting so these - functions could use the new Register assignment operators. - - * interpreter/Register.h: - (JSC::Register::withInt): - (JSC::Register::Register): - (JSC::Register::operator=): Swapped in assignment operators for constructors. - -2009-12-18 Yongjun Zhang - - Reviewed by Simon Hausmann. - - https://bugs.webkit.org/show_bug.cgi?id=32713 - [Qt] make wtf/Assertions.h compile in winscw compiler. - - Add string arg before ellipsis to help winscw compiler resolve variadic - macro definitions in wtf/Assertions.h. - - * wtf/Assertions.h: - -2009-12-18 Geoffrey Garen - - Reviewed by Adam Roben. - - Fixed intermittent failure seen on Windows buildbot, and in other JSC - API clients. - - Added a WeakGCPtr class and changed OpaqueJSClass::cachedPrototype to - use it, to avoid vending a stale object as a prototype. - - * API/JSClassRef.cpp: - (OpaqueJSClassContextData::OpaqueJSClassContextData): - (OpaqueJSClass::prototype): - * API/JSClassRef.h: Use WeakGCPtr. - - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/WeakGCPtr.h: Added. - (JSC::WeakGCPtr::WeakGCPtr): - (JSC::WeakGCPtr::get): - (JSC::WeakGCPtr::clear): - (JSC::WeakGCPtr::operator*): - (JSC::WeakGCPtr::operator->): - (JSC::WeakGCPtr::operator!): - (JSC::WeakGCPtr::operator bool): - (JSC::WeakGCPtr::operator UnspecifiedBoolType): - (JSC::WeakGCPtr::assign): - (JSC::::operator): - (JSC::operator==): - (JSC::operator!=): - (JSC::static_pointer_cast): - (JSC::const_pointer_cast): - (JSC::getPtr): Added WeakGCPtr to the project. - -2009-12-18 Gavin Barraclough - - Reviewed by Sam Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=32720 - - * JavaScriptCore.exp: - - Remove exports for UString::append - * JavaScriptCore.xcodeproj/project.pbxproj: - - Make StringBuilder a private header (was project). - -2009-12-18 Martin Robinson - - Reviewed by Gustavo Noronha Silva. - - [GTK] GRefPtr does not take a reference when assigned a raw pointer - https://bugs.webkit.org/show_bug.cgi?id=32709 - - Ensure that when assigning a raw pointer to a GRefPtr, the reference - count is incremented. Also remove the GRefPtr conversion overload as - GRefPtr types have necessarily incompatible reference counting. - - * wtf/gtk/GRefPtr.h: - (WTF::GRefPtr::operator=): - -2009-12-18 Simon Hausmann - - Reviewed by Tor Arne Vestbø. - - [Qt] Clean up the qmake build system to distinguish between trunk builds and package builds - - https://bugs.webkit.org/show_bug.cgi?id=32716 - - * pcre/pcre.pri: Use standalone_package instead of QTDIR_build - -2009-12-18 Martin Robinson - - Reviewed by Gustavo Noronha Silva. - - [GTK] Compile warning from line 29 of GRefPtr.cpp - https://bugs.webkit.org/show_bug.cgi?id=32703 - - Fix memory leak and compiler warning in GRefPtr GHashTable template - specialization. - - * wtf/gtk/GRefPtr.cpp: - (WTF::refGPtr): - -2009-12-17 Sam Weinig - - Reviewed by Mark Rowe. - - Add BUILDING_ON_SNOW_LEOPARD and TARGETING_SNOW_LEOPARD #defines. - - * wtf/Platform.h: - -2009-12-17 Adam Roben - - Sync JavaScriptCore.vcproj with JavaScriptCore.xcodeproj and the - source tree - - Fixes . - - Reviewed by Ada Chan. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Moved - around files and filters so that the structure matches - JavaScriptCore.xcodeproj and the source tree. A few headers that were - previously omitted have been added, as well as JSZombie.{cpp,h}. - -2009-12-17 Adam Roben - - Remove HeavyProfile and TreeProfile completely - - These were mostly removed in r42808, but the empty files were left in - place. - - Fixes . - - Reviewed by John Sullivan. - - * Android.mk: - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.pri: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - * JavaScriptCoreSources.bkl: - Removed HeavyProfile/TreeProfile source files. - - * profiler/HeavyProfile.cpp: Removed. - * profiler/HeavyProfile.h: Removed. - * profiler/TreeProfile.cpp: Removed. - * profiler/TreeProfile.h: Removed. - -2009-12-17 Martin Robinson - - Reviewed by Gustavo Noronha Silva. - - [GTK] WebKit GTK needs a wrapper for ref counted glib/gobject structs - https://bugs.webkit.org/show_bug.cgi?id=21599 - - Implement GRefPtr, a smart pointer for reference counted GObject types. - - * GNUmakefile.am: - * wtf/gtk/GOwnPtr.cpp: - (WTF::GDir): - * wtf/gtk/GRefPtr.h: Added. - (WTF::): - (WTF::GRefPtr::GRefPtr): - (WTF::GRefPtr::~GRefPtr): - (WTF::GRefPtr::clear): - (WTF::GRefPtr::get): - (WTF::GRefPtr::operator*): - (WTF::GRefPtr::operator->): - (WTF::GRefPtr::operator!): - (WTF::GRefPtr::operator UnspecifiedBoolType): - (WTF::GRefPtr::hashTableDeletedValue): - (WTF::::operator): - (WTF::::swap): - (WTF::swap): - (WTF::operator==): - (WTF::operator!=): - (WTF::static_pointer_cast): - (WTF::const_pointer_cast): - (WTF::getPtr): - (WTF::adoptGRef): - (WTF::refGPtr): - (WTF::derefGPtr): - -2009-12-17 Gustavo Noronha Silva - - Unreviewed. Build fixes for make distcheck. - - * GNUmakefile.am: - -2009-12-16 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Fixed Interpreter::privateExecute macro generates - bloated code - - This patch cuts Interpreter stack use by about a third. - - * bytecode/Opcode.h: Changed Opcode to const void* to work with the - const static initiliazation we want to do in Interpreter::privateExecute. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::Interpreter): Moved hashtable initialization here to - avoid polluting Interpreter::privateExecute's stack, and changed it from a - series of add() calls to one add() call in a loop, to cut down on code size. - - (JSC::Interpreter::privateExecute): Changed a series of label computations - to a copy of a compile-time constant array to cut down on code size. - -2009-12-16 Mark Rowe - - Build fix. Disable debug variants of WebKit frameworks. - - * JavaScriptCore.xcodeproj/project.pbxproj: - -2009-12-15 Geoffrey Garen - - Reviewed by Sam "r=me" Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=32498 - - REGRESSION(r51978-r52039): AJAX "Mark This Forum Read" function no longer - works - - Fixed a tyop. - - * runtime/Operations.h: - (JSC::jsAdd): Use the '&&' operator, not the ',' operator. - -2009-12-15 Geoffrey Garen - - Try to fix the windows build: don't export this inlined function. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-12-15 Geoffrey Garen - - Reviewed by Beth Dakin. - - Inlined JSCell's operator new. - - 3.7% speedup on bench-allocate-nonretained.js. - - * JavaScriptCore.exp: - * runtime/JSCell.cpp: - * runtime/JSCell.h: - (JSC::JSCell::operator new): - -2009-12-15 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Removed the number heap, replacing it with a one-item free list for - numbers, taking advantage of the fact that two number cells fit inside - the space for one regular cell, and number cells don't require destruction. - - SunSpider says 1.6% faster in JSVALUE32 mode (the only mode that - heap-allocates numbers). - - SunSpider says 1.1% faster in JSVALUE32_64 mode. v8 says 0.8% faster - in JSVALUE32_64 mode. 10% speedup on bench-alloc-nonretained.js. 6% - speedup on bench-alloc-retained.js. - - There's a lot of formulaic change in this patch, but not much substance. - - * JavaScriptCore.exp: - * debugger/Debugger.cpp: - (JSC::Debugger::recompileAllJSFunctions): - * runtime/Collector.cpp: - (JSC::Heap::Heap): - (JSC::Heap::destroy): - (JSC::Heap::allocateBlock): - (JSC::Heap::freeBlock): - (JSC::Heap::freeBlockPtr): - (JSC::Heap::freeBlocks): - (JSC::Heap::recordExtraCost): - (JSC::Heap::allocate): - (JSC::Heap::resizeBlocks): - (JSC::Heap::growBlocks): - (JSC::Heap::shrinkBlocks): - (JSC::Heap::markConservatively): - (JSC::Heap::clearMarkBits): - (JSC::Heap::markedCells): - (JSC::Heap::sweep): - (JSC::Heap::markRoots): - (JSC::Heap::objectCount): - (JSC::Heap::addToStatistics): - (JSC::Heap::statistics): - (JSC::Heap::isBusy): - (JSC::Heap::reset): - (JSC::Heap::collectAllGarbage): - (JSC::Heap::primaryHeapBegin): - (JSC::Heap::primaryHeapEnd): - * runtime/Collector.h: - (JSC::): Removed all code pertaining to the number heap, and changed all - heap template functions and classes to non-template functions and classes. - - (JSC::Heap::allocateNumber): A new optimization to replace the number - heap: allocate half-sized number cells in pairs, returning the first - cell and caching the second cell for the next allocation. - - * runtime/CollectorHeapIterator.h: - (JSC::LiveObjectIterator::LiveObjectIterator): - (JSC::LiveObjectIterator::operator++): - (JSC::DeadObjectIterator::DeadObjectIterator): - (JSC::DeadObjectIterator::operator++): - (JSC::ObjectIterator::ObjectIterator): - (JSC::ObjectIterator::operator++): - * runtime/JSCell.h: - (JSC::JSCell::isNumber): Removed all code pertaining to the number heap, - and changed all heap template functions and classes to non-template functions - and classes. - -2009-12-15 Zoltan Horvath - - Reviewed by Darin Adler. - - Allow custom memory allocation control for WeakGCMap class - https://bugs.webkit.org/show_bug.cgi?id=32547 - - Inherits WeakGCMap from FastAllocBase because it is instantiated by - 'new' at: WebCore/dom/Document.cpp:512. - - * runtime/WeakGCMap.h: - -2009-12-15 Zoltan Horvath - - Reviewed by Darin Adler. - - Allow custom memory allocation control for dtoa's P5Node struct - https://bugs.webkit.org/show_bug.cgi?id=32544 - - Inherits P5Node struct from Noncopyable because it is instantiated by - 'new' at wtf/dtoa.cpp:588 and don't need to be copyable. - - * wtf/dtoa.cpp: - -2009-12-14 Geoffrey Garen - - Reviewed by Simon Fraser. - - https://bugs.webkit.org/show_bug.cgi?id=32524 - REGRESSION(52084): fast/dom/prototypes.html failing two CSS tests - - * wtf/StdLibExtras.h: - (WTF::bitCount): The original patch put the parentheses in the wrong - place, completely changing the calculation and making it almost always - wrong. Moved the parentheses around the '+' operation, like the original - compiler warning suggested. - -2009-12-14 Gabor Loki - - Unreviewed trivial buildfix. - - Fix crosses initialization of usedPrimaryBlocks for JSValue32 - - * runtime/Collector.cpp: - (JSC::Heap::markConservatively): - -2009-12-14 Csaba Osztrogonác - - Reviewed by Simon Hausmann. - - GCC 4.3.x warning fixed. Suggested parantheses added. - warning: ../../../JavaScriptCore/wtf/StdLibExtras.h:77: warning: suggest parentheses around + or - in operand of & - - * wtf/StdLibExtras.h: - (WTF::bitCount): - -2009-12-13 Geoffrey Garen - - Reviewed by Sam Weinig. - - Changed GC from mark-sweep to mark-allocate. - - Added WeakGCMap to keep WebCore blissfully ignorant about objects that - have become garbage but haven't run their destructors yet. - - 1% SunSpider speedup. - 7.6% v8 speedup (37% splay speedup). - 17% speedup on bench-alloc-nonretained.js. - 18% speedup on bench-alloc-retained.js. - - * API/JSBase.cpp: - (JSGarbageCollect): - * API/JSContextRef.cpp: - * JavaScriptCore.exp: - * JavaScriptCore.xcodeproj/project.pbxproj: Updated for renames and new - files. - - * debugger/Debugger.cpp: - (JSC::Debugger::recompileAllJSFunctions): Updated to use the Collector - iterator abstraction. - - * jsc.cpp: - (functionGC): Updated for rename. - - * runtime/Collector.cpp: Slightly reduced the number of allocations per - collection, so that small workloads only allocate on collector block, - rather than two. - - (JSC::Heap::Heap): Updated to use the new allocateBlock function. - - (JSC::Heap::destroy): Updated to use the new freeBlocks function. - - (JSC::Heap::allocateBlock): New function to initialize a block when - allocating it. - - (JSC::Heap::freeBlock): Consolidated the responsibility for running - destructors into this function. - - (JSC::Heap::freeBlocks): Updated to use freeBlock. - - (JSC::Heap::recordExtraCost): Sweep the heap in this reporting function, - so that allocation, which is more common, doesn't have to check extraCost. - - (JSC::Heap::heapAllocate): Run destructors right before recycling a - garbage cell. This has better cache utilization than a separate sweep phase. - - (JSC::Heap::resizeBlocks): - (JSC::Heap::growBlocks): - (JSC::Heap::shrinkBlocks): New set of functions for managing the size of - the heap, now that the heap doesn't maintain any information about its - size. - - (JSC::isPointerAligned): - (JSC::isHalfCellAligned): - (JSC::isPossibleCell): - (JSC::isCellAligned): - (JSC::Heap::markConservatively): Cleaned up this code a bit. - - (JSC::Heap::clearMarkBits): - (JSC::Heap::markedCells): Some helper functions for examining the the mark - bitmap. - - (JSC::Heap::sweep): Simplified this function by using a DeadObjectIterator. - - (JSC::Heap::markRoots): Reordered some operations for clarity. - - (JSC::Heap::objectCount): - (JSC::Heap::addToStatistics): - (JSC::Heap::statistics): Rewrote these functions to calculate an object - count on demand, since the heap doesn't maintain this information by - itself. - - (JSC::Heap::reset): New function for resetting the heap once we've - exhausted heap space. - - (JSC::Heap::collectAllGarbage): This function matches the old collect() - behavior, but it's now an uncommon function used only by API. - - * runtime/Collector.h: - (JSC::CollectorBitmap::count): - (JSC::CollectorBitmap::isEmpty): Added some helper functions for managing - the collector mark bitmap. - - (JSC::Heap::reportExtraMemoryCost): Changed reporting from cell equivalents - to bytes, so it's easier to understand. - - * runtime/CollectorHeapIterator.h: - (JSC::CollectorHeapIterator::CollectorHeapIterator): - (JSC::CollectorHeapIterator::operator!=): - (JSC::CollectorHeapIterator::operator*): - (JSC::CollectorHeapIterator::advance): - (JSC::::LiveObjectIterator): - (JSC::::operator): - (JSC::::DeadObjectIterator): - (JSC::::ObjectIterator): New iterators for encapsulating details about - heap layout, and what's live and dead on the heap. - - * runtime/JSArray.cpp: - (JSC::JSArray::putSlowCase): - (JSC::JSArray::increaseVectorLength): Delay reporting extra cost until - we're fully constructed, so the heap mark phase won't visit us in an - invalid state. - - * runtime/JSCell.h: - (JSC::JSCell::): - (JSC::JSCell::createDummyStructure): - (JSC::JSCell::JSCell): - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::JSGlobalData): - * runtime/JSGlobalData.h: Added a dummy cell to simplify allocation logic. - - * runtime/JSString.h: - (JSC::jsSubstring): Don't report extra cost for substrings, since they - share a buffer that's already reported extra cost. - - * runtime/Tracing.d: - * runtime/Tracing.h: Changed these dtrace hooks not to report object - counts, since they're no longer cheap to compute. - - * runtime/UString.h: Updated for renames. - - * runtime/WeakGCMap.h: Added. - (JSC::WeakGCMap::isEmpty): - (JSC::WeakGCMap::uncheckedGet): - (JSC::WeakGCMap::uncheckedBegin): - (JSC::WeakGCMap::uncheckedEnd): - (JSC::::get): - (JSC::::take): - (JSC::::set): - (JSC::::uncheckedRemove): Mentioned above. - - * wtf/StdLibExtras.h: - (WTF::bitCount): Added a bit population count function, so the heap can - count live objects to fulfill statistics questions. - -The very last cell in the block is not allocated -- should not be marked. - -2009-12-13 Geoffrey Garen - - Windows build fix: Export some new symbols. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-12-13 Geoffrey Garen - - Windows build fix: Removed some old exports. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-12-13 Geoffrey Garen - - Windows build fix: Use unsigned instead of uint32_t to avoid dependencies. - - * wtf/StdLibExtras.h: - (WTF::bitCount): - -2009-12-13 Gavin Barraclough - - Reviewed by NOBODY (speculative Windows build fix). - - * runtime/JSGlobalObjectFunctions.cpp: - -2009-12-13 Gavin Barraclough - - Reviewed by Sam Weinig. - - https://bugs.webkit.org/show_bug.cgi?id=32496 - Switch remaining cases of string construction to use StringBuilder. - Builds strings using a vector rather than using string append / addition. - - * JavaScriptCore.exp: - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/Executable.cpp: - (JSC::FunctionExecutable::paramString): - * runtime/FunctionConstructor.cpp: - (JSC::constructFunction): - * runtime/JSGlobalObjectFunctions.cpp: - (JSC::encode): - (JSC::decode): - (JSC::globalFuncEscape): - (JSC::globalFuncUnescape): - * runtime/JSONObject.cpp: - (JSC::Stringifier::stringify): - (JSC::Stringifier::indent): - * runtime/JSString.h: - * runtime/LiteralParser.cpp: - (JSC::LiteralParser::Lexer::lexString): - * runtime/NumberPrototype.cpp: - (JSC::integerPartNoExp): - (JSC::numberProtoFuncToFixed): - (JSC::numberProtoFuncToPrecision): - * runtime/Operations.h: - (JSC::jsString): - * runtime/StringPrototype.cpp: - (JSC::substituteBackreferencesSlow): - (JSC::substituteBackreferences): - (JSC::stringProtoFuncConcat): - -2009-12-08 Jeremy Moskovich - - Reviewed by Eric Seidel. - - Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController. - https://bugs.webkit.org/show_bug.cgi?id=31802 - - The goal here is to allow for a zero runtime hit for ports that decide to select - the API at compile time. - When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled - at runtime. Core Text is used for OS Versions >= 10.6. - - * wtf/Platform.h: #define USE_CORE_TEXT and USE_ATSUI on Chrome/Mac. - -2009-12-11 Maciej Stachowiak - - Reviewed by Oliver Hunt. - - Unify codegen for forward and backward variants of branches - https://bugs.webkit.org/show_bug.cgi?id=32463 - - * jit/JIT.h: - (JSC::JIT::emit_op_loop): Implemented in terms of forward variant. - (JSC::JIT::emit_op_loop_if_true): ditto - (JSC::JIT::emitSlow_op_loop_if_true): ditto - (JSC::JIT::emit_op_loop_if_false): ditto - (JSC::JIT::emitSlow_op_loop_if_false): ditto - (JSC::JIT::emit_op_loop_if_less): ditto - (JSC::JIT::emitSlow_op_loop_if_less): ditto - * jit/JITOpcodes.cpp: - -2009-12-11 Sam Weinig - - Reviewed by Anders Carlsson. - - Allow WTFs concept of the main thread to differ from pthreads when necessary. - - * wtf/ThreadingPthreads.cpp: - (WTF::initializeThreading): - (WTF::isMainThread): - * wtf/mac/MainThreadMac.mm: - (WTF::initializeMainThreadPlatform): - (WTF::scheduleDispatchFunctionsOnMainThread): - -2009-12-11 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32454 - Refactor construction of simple strings to avoid string concatenation. - - Building strings through concatenation has a memory and performance cost - - a memory cost since we must over-allocate the buffer to leave space to append - into, and performance in that the string may still require reallocation (and - thus copying during construction). Instead move the full construction to - within a single function call (makeString), so that the arguments' lengths - can be calculated and an appropriate sized buffer allocated before copying - any characters. - - ~No performance change (~2% progression on date tests). - - * bytecode/CodeBlock.cpp: - (JSC::escapeQuotes): - (JSC::valueToSourceString): - (JSC::constantName): - (JSC::idName): - (JSC::CodeBlock::registerName): - (JSC::regexpToSourceString): - (JSC::regexpName): - * bytecompiler/NodesCodegen.cpp: - (JSC::substitute): - * profiler/Profiler.cpp: - (JSC::Profiler::createCallIdentifier): - * runtime/DateConstructor.cpp: - (JSC::callDate): - * runtime/DateConversion.cpp: - (JSC::formatDate): - (JSC::formatDateUTCVariant): - (JSC::formatTime): - (JSC::formatTimeUTC): - * runtime/DateConversion.h: - (JSC::): - * runtime/DatePrototype.cpp: - (JSC::dateProtoFuncToString): - (JSC::dateProtoFuncToUTCString): - (JSC::dateProtoFuncToDateString): - (JSC::dateProtoFuncToTimeString): - (JSC::dateProtoFuncToGMTString): - * runtime/ErrorPrototype.cpp: - (JSC::errorProtoFuncToString): - * runtime/ExceptionHelpers.cpp: - (JSC::createUndefinedVariableError): - (JSC::createErrorMessage): - (JSC::createInvalidParamError): - * runtime/FunctionPrototype.cpp: - (JSC::insertSemicolonIfNeeded): - (JSC::functionProtoFuncToString): - * runtime/ObjectPrototype.cpp: - (JSC::objectProtoFuncToString): - * runtime/RegExpConstructor.cpp: - (JSC::constructRegExp): - * runtime/RegExpObject.cpp: - (JSC::RegExpObject::match): - * runtime/RegExpPrototype.cpp: - (JSC::regExpProtoFuncCompile): - (JSC::regExpProtoFuncToString): - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncBig): - (JSC::stringProtoFuncSmall): - (JSC::stringProtoFuncBlink): - (JSC::stringProtoFuncBold): - (JSC::stringProtoFuncFixed): - (JSC::stringProtoFuncItalics): - (JSC::stringProtoFuncStrike): - (JSC::stringProtoFuncSub): - (JSC::stringProtoFuncSup): - (JSC::stringProtoFuncFontcolor): - (JSC::stringProtoFuncFontsize): - (JSC::stringProtoFuncAnchor): - * runtime/UString.h: - (JSC::): - (JSC::makeString): - -2009-12-10 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32400 - Switch remaining cases of string addition to use ropes. - - Re-landing r51975 - added toPrimitiveString method, - performs toPrimitive then subsequent toString operations. - - ~1% progression on Sunspidey. - - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * runtime/JSString.h: - (JSC::JSString::JSString): - (JSC::JSString::appendStringInConstruct): - * runtime/Operations.cpp: - (JSC::jsAddSlowCase): - * runtime/Operations.h: - (JSC::jsString): - (JSC::jsAdd): - -2009-12-11 Adam Roben - - Windows build fix - - * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Added - $(WebKitOutputDir)/include/private to the include path. - -2009-12-11 Adam Roben - - Move QuartzCorePresent.h to include/private - - This fixes other projects that use wtf/Platform.h - - Rubber-stamped by Steve Falkenburg. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Let VS do its thang. - * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Write - QuartzCorePresent.h to $(WebKitOutputDir)/include/private. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: - * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: - Added $(WebKitOutputDir)/include/private to the include path. - -2009-12-11 Adam Roben - - Fix clean builds and everything rebuilding on every build - - Reviewed by Sam Weinig. - - * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Don't - write out QuartzCorePresent.h if it exists but is older than - QuartzCore.h. Also, create the directory we write QuartzCorePresent.h - into first. - -2009-12-11 Adam Roben - - Windows build fix for systems with spaces in their paths - - * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Quote some paths. - -2009-12-11 Chris Marrin - - Reviewed by Adam Roben. - - Add check for presence of QuartzCore headers - https://bugs.webkit.org/show_bug.cgi?id=31856 - - The script now checks for the presence of QuartzCore.h. If present - it will turn on ACCELERATED_COMPOSITING and 3D_RENDERING to enable - HW compositing on Windows. The script writes QuartzCorePresent.h to - the build directory which has a define telling whether QuartzCore is - present. - - * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: - * wtf/Platform.h: - -2009-12-11 Kent Tamura - - Reviewed by Darin Adler. - - Fix a problem that JSC::gregorianDateTimeToMS() returns a negative - value for a huge year value. - https://bugs.webkit.org/show_bug.cgi?id=32304 - - * wtf/DateMath.cpp: - (WTF::dateToDaysFrom1970): Renamed from dateToDayInYear, and changed the return type to double. - (WTF::calculateDSTOffset): Follow the dateToDaysFrom1970() change. - (WTF::timeClip): Use maxECMAScriptTime. - (JSC::gregorianDateTimeToMS): Follow the dateToDaysFrom1970() change. - -2009-12-10 Adam Barth - - No review, rolling out r51975. - http://trac.webkit.org/changeset/51975 - - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * runtime/JSString.h: - (JSC::JSString::JSString): - (JSC::JSString::appendStringInConstruct): - * runtime/Operations.cpp: - (JSC::jsAddSlowCase): - * runtime/Operations.h: - (JSC::jsString): - (JSC::jsAdd): - -2009-12-10 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Incorrect caching of prototype lookup with dictionary base - https://bugs.webkit.org/show_bug.cgi?id=32402 - - Make sure we don't add cached prototype lookup to the proto_list - lookup chain if the top level object is a dictionary. - - * jit/JITStubs.cpp: - (JSC::JITThunks::tryCacheGetByID): - -2009-12-10 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32400 - Switch remaining cases of string addition to use ropes. - - ~1% progression on Sunspidey. - - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * runtime/JSString.h: - (JSC::JSString::JSString): - (JSC::JSString::appendStringInConstruct): - * runtime/Operations.cpp: - (JSC::jsAddSlowCase): - * runtime/Operations.h: - (JSC::jsString): - (JSC::jsAdd): - -2009-12-10 Kent Hansen - - Reviewed by Geoffrey Garen. - - Remove JSObject::getPropertyAttributes() and all usage of it. - https://bugs.webkit.org/show_bug.cgi?id=31933 - - getOwnPropertyDescriptor() should be used instead. - - * JavaScriptCore.exp: - * JavaScriptCore.order: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * debugger/DebuggerActivation.cpp: - (JSC::DebuggerActivation::getOwnPropertyDescriptor): - * debugger/DebuggerActivation.h: - * runtime/JSObject.cpp: - (JSC::JSObject::propertyIsEnumerable): - * runtime/JSObject.h: - * runtime/JSVariableObject.cpp: - * runtime/JSVariableObject.h: - -2009-12-10 Gavin Barraclough - - Reviewed by Oliver Hunt & Mark Rowe. - - https://bugs.webkit.org/show_bug.cgi?id=32367 - Add support for short Ropes (up to 3 entries) inline within JSString. - (rather than externally allocating an object to hold the rope). - Switch jsAdd of (JSString* + JSString*) to now make use of Ropes. - - ~1% progression on Sunspidey. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * runtime/JSString.cpp: - (JSC::JSString::resolveRope): - (JSC::JSString::toBoolean): - (JSC::JSString::getStringPropertyDescriptor): - * runtime/JSString.h: - (JSC::JSString::Rope::Fiber::deref): - (JSC::JSString::Rope::Fiber::ref): - (JSC::JSString::Rope::Fiber::refAndGetLength): - (JSC::JSString::Rope::append): - (JSC::JSString::JSString): - (JSC::JSString::~JSString): - (JSC::JSString::value): - (JSC::JSString::tryGetValue): - (JSC::JSString::length): - (JSC::JSString::canGetIndex): - (JSC::JSString::appendStringInConstruct): - (JSC::JSString::appendValueInConstructAndIncrementLength): - (JSC::JSString::isRope): - (JSC::JSString::string): - (JSC::JSString::ropeLength): - (JSC::JSString::getStringPropertySlot): - * runtime/Operations.h: - (JSC::jsString): - (JSC::jsAdd): - (JSC::resolveBase): - -2009-12-09 Anders Carlsson - - Reviewed by Geoffrey Garen. - - Fix three more things found by compiling with clang++. - - * runtime/Structure.h: - (JSC::StructureTransitionTable::reifySingleTransition): - Add the 'std' qualifier to the call to make_pair. - - * wtf/DateMath.cpp: - (WTF::initializeDates): - Incrementing a bool is deprecated according to the C++ specification. - - * wtf/PtrAndFlags.h: - (WTF::PtrAndFlags::PtrAndFlags): - Name lookup should not be done in dependent bases, so explicitly qualify the call to set. - -2009-12-09 Maciej Stachowiak - - Reviewed by Oliver Hunt. - - Google reader gets stuck in the "Loading..." state and does not complete - https://bugs.webkit.org/show_bug.cgi?id=32256 - - - * jit/JITArithmetic.cpp: - (JSC::JIT::emitSlow_op_jless): Fix some backward branches. - -2009-12-09 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32228 - Make destruction of ropes non-recursive to prevent stack exhaustion. - Also, pass a UString& into initializeFiber rather than a Ustring::Rep*, - since the Rep is not being ref counted this could result in usage of a - Rep with refcount zero (where the Rep comes from a temporary UString - returned from a function). - - * runtime/JSString.cpp: - (JSC::JSString::Rope::destructNonRecursive): - (JSC::JSString::Rope::~Rope): - * runtime/JSString.h: - (JSC::JSString::Rope::initializeFiber): - * runtime/Operations.h: - (JSC::concatenateStrings): - -2009-12-09 Zoltan Herczeg - - Reviewed by Eric Seidel. - - https://bugs.webkit.org/show_bug.cgi?id=31930 - - Update to r51457. ASSERTs changed to COMPILE_ASSERTs. - The speedup is 25%. - - * runtime/JSGlobalData.cpp: - (JSC::VPtrSet::VPtrSet): - -2009-12-09 Steve Block - - Reviewed by Adam Barth. - - Updates Android Makefiles with latest additions. - https://bugs.webkit.org/show_bug.cgi?id=32278 - - * Android.mk: Modified. - * Android.v8.wtf.mk: Modified. - -2009-12-09 Sam Weinig - - Reviewed by Gavin Barraclough. - - Fix a bug found while trying to compile JavaScriptCore with clang++. - - * yarr/RegexPattern.h: - (JSC::Yarr::PatternTerm::PatternTerm): Don't self assign here. Use false instead. - -2009-12-09 Anders Carlsson - - Reviewed by Sam Weinig. - - Attempt to fix the Windows build. - - * wtf/FastMalloc.h: - -2009-12-09 Anders Carlsson - - Reviewed by Sam Weinig. - - Fix some things found while trying to compile JavaScriptCore with clang++. - - * wtf/FastMalloc.h: - Add correct exception specifications for the allocation/deallocation operators. - - * wtf/Vector.h: - * wtf/VectorTraits.h: - Fix a bunch of struct/class mismatches. - -2009-12-08 Maciej Stachowiak - - Reviewed by Darin Adler. - - move code generation portions of Nodes.cpp to bytecompiler directory - https://bugs.webkit.org/show_bug.cgi?id=32284 - - * bytecompiler/NodesCodegen.cpp: Copied from parser/Nodes.cpp. Removed parts that - are not about codegen. - * parser/Nodes.cpp: Removed everything that is about codegen. - - Update build systems: - - * Android.mk: - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.pri: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - * JavaScriptCore.xcodeproj/project.pbxproj: - * JavaScriptCoreSources.bkl: - -2009-12-08 Kevin Watters - - Reviewed by Kevin Ollivier. - - [wx] Mac plugins support. - - https://bugs.webkit.org/show_bug.cgi?id=32236 - - * wtf/Platform.h: - -2009-12-08 Dmitry Titov - - Rubber-stamped by David Levin. - - Revert and reopen "Add asserts to RefCounted to make sure ref/deref happens on the right thread." - It may have caused massive increase of reported leaks on the bots. - https://bugs.webkit.org/show_bug.cgi?id=31639 - - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.vcproj/WTF/WTF.vcproj: - * JavaScriptCore.xcodeproj/project.pbxproj: - * runtime/Structure.cpp: - (JSC::Structure::Structure): - * wtf/RefCounted.h: - (WTF::RefCountedBase::ref): - (WTF::RefCountedBase::hasOneRef): - (WTF::RefCountedBase::refCount): - (WTF::RefCountedBase::derefBase): - * wtf/ThreadVerifier.h: Removed. - -2009-12-08 Gustavo Noronha Silva - - Reviewed by Darin Adler. - - Make WebKit build correctly on FreeBSD, IA64, and Alpha. - Based on work by Petr Salinger , - and Colin Watson . - - * wtf/Platform.h: - -2009-12-08 Dmitry Titov - - Reviewed by Darin Adler. - - Add asserts to RefCounted to make sure ref/deref happens on the right thread. - https://bugs.webkit.org/show_bug.cgi?id=31639 - - * runtime/Structure.cpp: - (JSC::Structure::Structure): Disable thread verification on this class since it uses addressOfCount(). - * wtf/RefCounted.h: - (WTF::RefCountedBase::ref): Add ASSERT. - (WTF::RefCountedBase::hasOneRef): Ditto. - (WTF::RefCountedBase::refCount): Ditto. - (WTF::RefCountedBase::derefBase): Ditto. - (WTF::RefCountedBase::disableThreadVerification): delegate to ThreadVerifier method. - * wtf/ThreadVerifier.h: Added. - (WTF::ThreadVerifier::ThreadVerifier): New Debug-only class to verify that ref/deref of RefCounted is done on the same thread. - (WTF::ThreadVerifier::activate): Activates checks. Called when ref count becomes above 2. - (WTF::ThreadVerifier::deactivate): Deactivates checks. Called when ref count drops below 2. - (WTF::ThreadVerifier::disableThreadVerification): used on objects that should not be checked (StringImpl etc) - (WTF::ThreadVerifier::verifyThread): - * GNUmakefile.am: Add ThreadVerifier.h to the build file. - * JavaScriptCore.gypi: Ditto. - * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto. - * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. - -2009-12-08 Steve Block - - Reviewed by Adam Barth. - - [Android] Adds Makefiles for Android port. - https://bugs.webkit.org/show_bug.cgi?id=31325 - - * Android.mk: Added. - * Android.v8.wtf.mk: Added. - -2009-12-07 Dmitry Titov - - Rubber-stamped by Darin Adler. - - Remove ENABLE_SHARED_SCRIPT flags - https://bugs.webkit.org/show_bug.cgi?id=32245 - This patch was obtained by "git revert" command and then un-reverting of ChangeLog files. - - * Configurations/FeatureDefines.xcconfig: - * wtf/Platform.h: - -2009-12-07 Gavin Barraclough - - Reviewed by NOBODY (Windows build fixage part I). - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-12-05 Gavin Barraclough - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32184 - Handle out-of-memory conditions with JSC Ropes with a JS exception, rather than crashing. - Switch from using fastMalloc to tryFastMalloc, pass an ExecState to record the exception on. - - * API/JSCallbackObjectFunctions.h: - (JSC::::toString): - * API/JSValueRef.cpp: - (JSValueIsStrictEqual): - * JavaScriptCore.exp: - * bytecompiler/BytecodeGenerator.cpp: - (JSC::BytecodeGenerator::emitEqualityOp): - * debugger/DebuggerCallFrame.cpp: - (JSC::DebuggerCallFrame::functionName): - (JSC::DebuggerCallFrame::calculatedFunctionName): - * interpreter/Interpreter.cpp: - (JSC::Interpreter::callEval): - (JSC::Interpreter::privateExecute): - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - * profiler/ProfileGenerator.cpp: - (JSC::ProfileGenerator::addParentForConsoleStart): - * profiler/Profiler.cpp: - (JSC::Profiler::willExecute): - (JSC::Profiler::didExecute): - (JSC::Profiler::createCallIdentifier): - (JSC::createCallIdentifierFromFunctionImp): - * profiler/Profiler.h: - * runtime/ArrayPrototype.cpp: - (JSC::arrayProtoFuncIndexOf): - (JSC::arrayProtoFuncLastIndexOf): - * runtime/DateConstructor.cpp: - (JSC::constructDate): - * runtime/FunctionPrototype.cpp: - (JSC::functionProtoFuncToString): - * runtime/InternalFunction.cpp: - (JSC::InternalFunction::name): - (JSC::InternalFunction::displayName): - (JSC::InternalFunction::calculatedDisplayName): - * runtime/InternalFunction.h: - * runtime/JSCell.cpp: - (JSC::JSCell::getString): - * runtime/JSCell.h: - (JSC::JSValue::getString): - * runtime/JSONObject.cpp: - (JSC::gap): - (JSC::Stringifier::Stringifier): - (JSC::Stringifier::appendStringifiedValue): - * runtime/JSObject.cpp: - (JSC::JSObject::putDirectFunction): - (JSC::JSObject::putDirectFunctionWithoutTransition): - (JSC::JSObject::defineOwnProperty): - * runtime/JSObject.h: - * runtime/JSPropertyNameIterator.cpp: - (JSC::JSPropertyNameIterator::get): - * runtime/JSString.cpp: - (JSC::JSString::Rope::~Rope): - (JSC::JSString::resolveRope): - (JSC::JSString::getPrimitiveNumber): - (JSC::JSString::toNumber): - (JSC::JSString::toString): - (JSC::JSString::toThisString): - (JSC::JSString::getStringPropertyDescriptor): - * runtime/JSString.h: - (JSC::JSString::Rope::createOrNull): - (JSC::JSString::Rope::operator new): - (JSC::JSString::value): - (JSC::JSString::tryGetValue): - (JSC::JSString::getIndex): - (JSC::JSString::getStringPropertySlot): - (JSC::JSValue::toString): - * runtime/JSValue.h: - * runtime/NativeErrorConstructor.cpp: - (JSC::NativeErrorConstructor::NativeErrorConstructor): - * runtime/Operations.cpp: - (JSC::JSValue::strictEqualSlowCase): - * runtime/Operations.h: - (JSC::JSValue::equalSlowCaseInline): - (JSC::JSValue::strictEqualSlowCaseInline): - (JSC::JSValue::strictEqual): - (JSC::jsLess): - (JSC::jsLessEq): - (JSC::jsAdd): - (JSC::concatenateStrings): - * runtime/PropertyDescriptor.cpp: - (JSC::PropertyDescriptor::equalTo): - * runtime/PropertyDescriptor.h: - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncReplace): - (JSC::stringProtoFuncToLowerCase): - (JSC::stringProtoFuncToUpperCase): - -2009-12-07 Nikolas Zimmermann - - Reviewed by Holger Freyther. - - Turn on (SVG) Filters support, by default. - https://bugs.webkit.org/show_bug.cgi?id=32224 - - * Configurations/FeatureDefines.xcconfig: Enable FILTERS build flag. - -2009-12-07 Steve Falkenburg - - Build fix. Be flexible about which version of ICU is used on Windows. - - * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Add optional xcopy commands to copy ICU 4.2. - -2009-12-07 Maciej Stachowiak - - Reviewed by Oliver Hunt. - - op_loop_if_less JIT codegen is broken for 64-bit - https://bugs.webkit.org/show_bug.cgi?id=32221 - - * jit/JITOpcodes.cpp: - (JSC::JIT::emit_op_loop_if_false): Fix codegen in this version - test was backwards. - -2009-12-07 Oliver Hunt - - Reviewed by Maciej Stachowiak. - - Object.create fails if properties on the descriptor are getters - https://bugs.webkit.org/show_bug.cgi?id=32219 - - Correctly initialise the PropertySlots with the descriptor object. - - * runtime/ObjectConstructor.cpp: - (JSC::toPropertyDescriptor): - -2009-12-06 Maciej Stachowiak - - Not reviewed, build fix. - - Actually tested 64-bit *and* 32-bit build this time. - - * jit/JITOpcodes.cpp: - (JSC::JIT::emit_op_loop_if_false): - -2009-12-06 Maciej Stachowiak - - Not reviewed, build fix. - - Really really fix 64-bit build for prior patch (actually tested this time). - - * jit/JITOpcodes.cpp: - (JSC::JIT::emit_op_loop_if_false): - (JSC::JIT::emitSlow_op_loop_if_false): - -2009-12-06 Maciej Stachowiak - - Not reviewed, build fix. - - Really fix 64-bit build for prior patch. - - * jit/JITArithmetic.cpp: - (JSC::JIT::emitSlow_op_jless): - -2009-12-06 Maciej Stachowiak - - Not reviewed, build fix. - - Fix 64-bit build for prior patch. - - * jit/JITOpcodes.cpp: - (JSC::JIT::emitSlow_op_loop_if_less): - -2009-12-05 Maciej Stachowiak - - Reviewed by Oliver Hunt. - - conway benchmark spends half it's time in op_less (jump fusion fails) - https://bugs.webkit.org/show_bug.cgi?id=32190 - - <1% speedup on SunSpider and V8 - 2x speedup on "conway" benchmark - - Two optimizations: - 1) Improve codegen for logical operators &&, || and ! in a condition context - - When generating code for combinations of &&, || and !, in a - condition context (i.e. in an if statement or loop condition), we - used to produce a value, and then separately jump based on its - truthiness. Now we pass the false and true targets in, and let the - logical operators generate jumps directly. This helps in four - ways: - - a) Individual clauses of a short-circuit logical operator can now - jump directly to the then or else clause of an if statement (or to - the top or exit of a loop) instead of jumping to a jump. - - b) It used to be that jump fusion with the condition of the first - clause of a logical operator was inhibited, because the register - was ref'd to be used later, in the actual condition jump; this no - longer happens since a jump straight to the final target is - generated directly. - - c) It used to be that jump fusion with the condition of the second - clause of a logical operator was inhibited, because there was a - jump target right after the second clause and before the actual - condition jump. But now it's no longer necessary for the first - clause to jump there so jump fusion is not blocked. - - d) We avoid generating excess mov statements in some cases. - - As a concrete example this source: - - if (!((x < q && y < q) || (t < q && z < q))) { - // ... - } - - Used to generate this bytecode: - - [ 34] less r1, r-15, r-19 - [ 38] jfalse r1, 7(->45) - [ 41] less r1, r-16, r-19 - [ 45] jtrue r1, 14(->59) - [ 48] less r1, r-17, r-19 - [ 52] jfalse r1, 7(->59) - [ 55] less r1, r-18, r-19 - [ 59] jtrue r1, 17(->76) - - And now generates this bytecode (also taking advantage of the second optimization below): - - [ 34] jnless r-15, r-19, 8(->42) - [ 38] jless r-16, r-19, 26(->64) - [ 42] jnless r-17, r-19, 8(->50) - [ 46] jless r-18, r-19, 18(->64) - - Note the jump fusion and the fact that there's less jump - indirection - three of the four jumps go straight to the target - clause instead of indirecting through another jump. - - 2) Implement jless opcode to take advantage of the above, since we'll now often generate - a less followed by a jtrue where fusion is not forbidden. - - * parser/Nodes.h: - (JSC::ExpressionNode::hasConditionContextCodegen): Helper function to determine - whether a node supports special conditional codegen. Return false as this is the default. - (JSC::ExpressionNode::emitBytecodeInConditionContext): Assert not reached - only really - defined for nodes that do have conditional codegen. - (JSC::UnaryOpNode::expr): Add const version. - (JSC::LogicalNotNode::hasConditionContextCodegen): Returne true only if subexpression - supports it. - (JSC::LogicalOpNode::hasConditionContextCodegen): Return true. - * parser/Nodes.cpp: - (JSC::LogicalNotNode::emitBytecodeInConditionContext): Implemented - just swap - the true and false targets for the child node. - (JSC::LogicalOpNode::emitBytecodeInConditionContext): Implemented - handle jumps - directly, improving codegen quality. Also handles further nested conditional codegen. - (JSC::ConditionalNode::emitBytecode): Use condition context codegen when available. - (JSC::IfNode::emitBytecode): ditto - (JSC::IfElseNode::emitBytecode): ditto - (JSC::DoWhileNode::emitBytecode): ditto - (JSC::WhileNode::emitBytecode): ditto - (JSC::ForNode::emitBytecode): ditto - - * bytecode/Opcode.h: - - Added loop_if_false opcode - needed now that falsey jumps can be backwards. - - Added jless opcode to take advantage of new fusion opportunities. - * bytecode/CodeBlock.cpp: - (JSC::CodeBlock::dump): Handle above. - * bytecompiler/BytecodeGenerator.cpp: - (JSC::BytecodeGenerator::emitJumpIfTrue): Add peephole for less + jtrue ==> jless. - (JSC::BytecodeGenerator::emitJumpIfFalse): Add handling of backwrds falsey jumps. - * bytecompiler/BytecodeGenerator.h: - (JSC::BytecodeGenerator::emitNodeInConditionContext): Wrapper to handle tracking of - overly deep expressions etc. - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): Implement the two new opcodes (loop_if_false, jless). - * jit/JIT.cpp: - (JSC::JIT::privateCompileMainPass): Implement JIT support for the two new opcodes. - (JSC::JIT::privateCompileSlowCases): ditto - * jit/JIT.h: - * jit/JITArithmetic.cpp: - (JSC::JIT::emit_op_jless): - (JSC::JIT::emitSlow_op_jless): ditto - (JSC::JIT::emitBinaryDoubleOp): ditto - * jit/JITOpcodes.cpp: - (JSC::JIT::emitSlow_op_loop_if_less): ditto - (JSC::JIT::emit_op_loop_if_false): ditto - (JSC::JIT::emitSlow_op_loop_if_false): ditto - * jit/JITStubs.cpp: - * jit/JITStubs.h: - (JSC::): - -2009-12-04 Kent Hansen - - Reviewed by Darin Adler. - - JavaScript delete operator should return false for string properties - https://bugs.webkit.org/show_bug.cgi?id=32012 - - * runtime/StringObject.cpp: - (JSC::StringObject::deleteProperty): - -2009-12-03 Drew Wilson - - Rolled back r51633 because it causes a perf regression in Chromium. - - * wtf/Platform.h: - -2009-12-03 Gavin Barraclough - - Try and fix the Windows build. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a symbol that should be exported. - -2009-12-03 Mark Rowe - - Try and fix the Mac build. - - * JavaScriptCore.exp: Export a symbol that should be exported. - -2009-12-03 Oliver Hunt - - Reviewed by Gavin Barraclough. - - REGRESSION(4.0.3-48777): Crash in JSC::ExecState::propertyNames() (Debug-only?) - https://bugs.webkit.org/show_bug.cgi?id=32133 - - Work around odd GCC-ism and correct the scopechain for use by - calls made while a cachedcall is active on the callstack. - - * interpreter/CachedCall.h: - (JSC::CachedCall::newCallFrame): - * runtime/JSArray.cpp: - (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key): - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncReplace): - -2009-12-03 Gavin Barraclough - - Reviewed by Oliver "Brraaaaiiiinnnnnzzzzzzzz" Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=32136 - Add a rope representation to JSString. Presently JSString always holds its data in UString form. - Instead, allow the result of a string concatenation to be represented in a tree form - with a - variable sized, reference-counted rope node retaining a set of UString::Reps (or other rope nopes). - - Strings must still currently be resolved down to a flat UString representation before being used, - but by holding the string in a rope representation during construction we can avoid copying data - until we know the final size of the string. - - ~2% progression on SunSpider (~25% on date-format-xparb, ~20% on string-validate-input). - - * JavaScriptCore.exp: - - - Update exports. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): - - - Make use of new JSString::length() method to avoid prematurely resolving ropes. - - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - - - Switch the string length trampoline to read the length directly from JSString::m_length, - rather than from the JSString's UString::Rep's 'len' property. - - * jit/JITStubs.cpp: - (JSC::DEFINE_STUB_FUNCTION): - - - Modify op_add such that addition of two strings, where either or both strings are already - in rope representation, produces a rope as a result. - - * runtime/JSString.cpp: - (JSC::JSString::Rope::~Rope): - (JSC::copyChars): - (JSC::JSString::resolveRope): - (JSC::JSString::getPrimitiveNumber): - (JSC::JSString::toBoolean): - (JSC::JSString::toNumber): - (JSC::JSString::toString): - (JSC::JSString::toThisString): - (JSC::JSString::getStringPropertyDescriptor): - * runtime/JSString.h: - (JSC::JSString::Rope::Fiber::Fiber): - (JSC::JSString::Rope::Fiber::destroy): - (JSC::JSString::Rope::Fiber::isRope): - (JSC::JSString::Rope::Fiber::rope): - (JSC::JSString::Rope::Fiber::string): - (JSC::JSString::Rope::create): - (JSC::JSString::Rope::initializeFiber): - (JSC::JSString::Rope::ropeLength): - (JSC::JSString::Rope::stringLength): - (JSC::JSString::Rope::fibers): - (JSC::JSString::Rope::Rope): - (JSC::JSString::Rope::operator new): - (JSC::JSString::JSString): - (JSC::JSString::value): - (JSC::JSString::length): - (JSC::JSString::isRope): - (JSC::JSString::rope): - (JSC::JSString::string): - (JSC::JSString::canGetIndex): - (JSC::jsSingleCharacterSubstring): - (JSC::JSString::getIndex): - (JSC::jsSubstring): - (JSC::JSString::getStringPropertySlot): - - - Add rope form. - - * runtime/Operations.h: - (JSC::jsAdd): - (JSC::concatenateStrings): - - - Update string concatenation, and addition of ropes, to produce ropes. - - * runtime/StringObject.cpp: - (JSC::StringObject::getOwnPropertyNames): - - - Make use of new JSString::length() method to avoid prematurely resolving ropes. - -2009-11-23 Jeremy Moskovich - - Reviewed by Eric Seidel. - - Switch Chrome/Mac to use Core Text APIs rather than ATSUI APIs. - https://bugs.webkit.org/show_bug.cgi?id=31802 - - No test since this is already covered by existing pixel tests. - - * wtf/Platform.h: #define USE_CORE_TEXT for Chrome/Mac. - -2009-12-02 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Add files missed in prior patch. - - * runtime/JSZombie.cpp: - (JSC::): - (JSC::JSZombie::leakedZombieStructure): - * runtime/JSZombie.h: Added. - (JSC::JSZombie::JSZombie): - (JSC::JSZombie::isZombie): - (JSC::JSZombie::classInfo): - (JSC::JSZombie::isGetterSetter): - (JSC::JSZombie::isAPIValueWrapper): - (JSC::JSZombie::isPropertyNameIterator): - (JSC::JSZombie::getCallData): - (JSC::JSZombie::getConstructData): - (JSC::JSZombie::getUInt32): - (JSC::JSZombie::toPrimitive): - (JSC::JSZombie::getPrimitiveNumber): - (JSC::JSZombie::toBoolean): - (JSC::JSZombie::toNumber): - (JSC::JSZombie::toString): - (JSC::JSZombie::toObject): - (JSC::JSZombie::markChildren): - (JSC::JSZombie::put): - (JSC::JSZombie::deleteProperty): - (JSC::JSZombie::toThisObject): - (JSC::JSZombie::toThisString): - (JSC::JSZombie::toThisJSString): - (JSC::JSZombie::getJSNumber): - (JSC::JSZombie::getOwnPropertySlot): - -2009-12-02 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Add zombies to JSC - https://bugs.webkit.org/show_bug.cgi?id=32103 - - Add a compile time flag to make the JSC collector replace "unreachable" - objects with zombie objects. The zombie object is a JSCell subclass that - ASSERTs on any attempt to use the JSCell methods. In addition there are - a number of additional assertions in bottleneck code to catch zombie usage - as quickly as possible. - - Grrr. Argh. Brains. - - * JavaScriptCore.xcodeproj/project.pbxproj: - * interpreter/Register.h: - (JSC::Register::Register): - * runtime/ArgList.h: - (JSC::MarkedArgumentBuffer::append): - (JSC::ArgList::ArgList): - * runtime/Collector.cpp: - (JSC::Heap::destroy): - (JSC::Heap::sweep): - * runtime/Collector.h: - * runtime/JSCell.h: - (JSC::JSCell::isZombie): - (JSC::JSValue::isZombie): - * runtime/JSValue.h: - (JSC::JSValue::decode): - (JSC::JSValue::JSValue): - * wtf/Platform.h: - -2009-12-01 Jens Alfke - - Reviewed by Darin Adler. - - Added variants of find/contains/add that allow a foreign key type to be used. - This will allow AtomicString-keyed maps to be queried by C string without - having to create a temporary AtomicString (see HTTPHeaderMap.) - The code for this is adapted from the equivalent in HashSet.h. - - * wtf/HashMap.h: - (WTF::HashMap::find): - (WTF::HashMap::contains): - (WTF::HashMap::add): - * wtf/HashSet.h: Changed "method" to "function member" in a comment. - -2009-12-01 Gustavo Noronha Silva - - Revert 51551 because it broke GTK+. - - * wtf/Platform.h: - -2009-11-30 Gavin Barraclough - - Windows Build fix. Reviewed by NOBODY. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-11-24 Gavin Barraclough - - Reviewed by Geoff Garen. - - Bug 31859 - Make world selection for JSC IsolatedWorlds automagical. - - WebCore presently has to explicitly specify the world before entering into JSC, - which is a little fragile (particularly since property access via a - getter/setter might invoke execution). Instead derive the current world from - the lexical global object. - - Remove the temporary duct tape of willExecute/didExecute virtual hooks on the JSGlobalData::ClientData - these are no longer necessary. - - * API/JSBase.cpp: - (JSEvaluateScript): - * API/JSObjectRef.cpp: - (JSObjectCallAsFunction): - * JavaScriptCore.exp: - * runtime/JSGlobalData.cpp: - * runtime/JSGlobalData.h: - -2009-11-30 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Remove obsolete PLATFORM(KDE) code - https://bugs.webkit.org/show_bug.cgi?id=31958 - - KDE is now using unpatched QtWebKit. - - * parser/Lexer.cpp: Remove obsolete KDE_USE_FINAL guard - * wtf/Platform.h: Remove PLATFORM(KDE) definition and code - section that is guarded with it. - -2009-11-30 Jan-Arve Sæther - - Reviewed by Simon Hausmann. - - [Qt] Fix compilation with win32-icc - - The Intel compiler does not support the __has_trivial_constructor type - trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The - reason for that is that the Intel Compiler depends on the Microsoft - Platform SDK, and in order to try to be "fully" MS compatible it will - "pretend" to be the same MS compiler as was shipped with the MS PSDK. - (Thus, compiling with win32-icc with VC8 SDK will make the source code - "think" the compiler at hand supports this type trait). - - * wtf/TypeTraits.h: - -2009-11-29 Laszlo Gombos - - Reviewed by Eric Seidel. - - [Qt] Mac build has JIT disabled - https://bugs.webkit.org/show_bug.cgi?id=31828 - - * wtf/Platform.h: Enable JIT for Qt Mac builds - -2009-11-28 Laszlo Gombos - - Reviewed by Eric Seidel. - - Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows - https://bugs.webkit.org/show_bug.cgi?id=31943 - - * runtime/MarkStack.h: - (JSC::MarkStack::MarkStackArray::shrinkAllocation): - -2009-11-28 Zoltan Herczeg - - Reviewed by Gavin Barraclough. - - https://bugs.webkit.org/show_bug.cgi?id=31930 - - Seems a typo. We don't need ~270k memory to determine the vptrs. - - * runtime/JSGlobalData.cpp: - (JSC::VPtrSet::VPtrSet): - -2009-11-27 Shinichiro Hamaji - - Unreviewed. - - Move GOwnPtr* from wtf to wtf/gtk - https://bugs.webkit.org/show_bug.cgi?id=31793 - - Build fix for chromium after r51423. - Exclude gtk directory from chromium build. - - * JavaScriptCore.gyp/JavaScriptCore.gyp: - -2009-11-25 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Incorrect behaviour of jneq_null in the interpreter - https://bugs.webkit.org/show_bug.cgi?id=31901 - - Correct the logic of jneq_null. This is already covered by existing tests. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): - -2009-11-26 Laszlo Gombos - - Reviewed by Oliver Hunt. - - Move GOwnPtr* from wtf to wtf/gtk - https://bugs.webkit.org/show_bug.cgi?id=31793 - - * GNUmakefile.am: Change the path for GOwnPtr.*. - * JavaScriptCore.gyp/JavaScriptCore.gyp: Remove - GOwnPtr.cpp from the exclude list. - * JavaScriptCore.gypi: Change the path for GOwnPtr.*. - * wscript: Remove GOwnPtr.cpp from the exclude list. - * wtf/GOwnPtr.cpp: Removed. - * wtf/GOwnPtr.h: Removed. - * wtf/Threading.h: Change the path for GOwnPtr.h. - * wtf/gtk/GOwnPtr.cpp: Copied from JavaScriptCore/wtf/GOwnPtr.cpp. - * wtf/gtk/GOwnPtr.h: Copied from JavaScriptCore/wtf/GOwnPtr.h. - * wtf/unicode/glib/UnicodeGLib.h: Change the path for GOwnPtr.h. - -2009-11-24 Dmitry Titov - - Reviewed by Eric Seidel. - - Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit - https://bugs.webkit.org/show_bug.cgi?id=31444 - - * Configurations/FeatureDefines.xcconfig: - * wtf/Platform.h: - -2009-11-24 Chris Marrin - - Reviewed by Simon Fraser. - - Add ability to enable ACCELERATED_COMPOSITING on Windows (currently disabled) - https://bugs.webkit.org/show_bug.cgi?id=27314 - - * wtf/Platform.h: - -2009-11-24 Jason Smith - - Reviewed by Alexey Proskuryakov. - - RegExp#exec's returned Array-like object behaves differently from - regular Arrays - https://bugs.webkit.org/show_bug.cgi?id=31689 - - * JavaScriptCore/runtime/RegExpConstructor.cpp: ensure that undefined - values are added to the returned RegExpMatchesArray - -2009-11-24 Oliver Hunt - - Reviewed by Alexey Proskuryakov. - - JSON.stringify performance on undefined is very poor - https://bugs.webkit.org/show_bug.cgi?id=31839 - - Switch from a UString to a Vector when building - the JSON string, allowing us to safely remove the substr-copy - we otherwise did when unwinding an undefined property. - - Also turns out to be a ~5% speedup on stringification. - - * runtime/JSONObject.cpp: - (JSC::Stringifier::StringBuilder::append): - (JSC::Stringifier::stringify): - (JSC::Stringifier::Holder::appendNextProperty): - -2009-11-24 Mark Rowe - - Fix production builds where the source tree may be read-only. - - * JavaScriptCore.xcodeproj/project.pbxproj: - -2009-11-23 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - Include "config.h" to meet Coding Style Guidelines - https://bugs.webkit.org/show_bug.cgi?id=31792 - - * wtf/unicode/UTF8.cpp: - * wtf/unicode/glib/UnicodeGLib.cpp: - * wtf/unicode/wince/UnicodeWince.cpp: - -2009-11-23 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Streamlined some Math functions where we expect or know the result not - to be representable as an int. - - SunSpider says 0.6% faster. - - * runtime/JSNumberCell.h: - (JSC::JSValue::JSValue): - * runtime/JSValue.h: - (JSC::JSValue::): - (JSC::jsDoubleNumber): - (JSC::JSValue::JSValue): Added a function for making a numeric JSValue - and skipping the "can I encode this as an int?" check, avoiding the - overhead of int <-> double roundtripping and double <-> double comparison - and branching. - - * runtime/MathObject.cpp: - (JSC::mathProtoFuncACos): - (JSC::mathProtoFuncASin): - (JSC::mathProtoFuncATan): - (JSC::mathProtoFuncATan2): - (JSC::mathProtoFuncCos): - (JSC::mathProtoFuncExp): - (JSC::mathProtoFuncLog): - (JSC::mathProtoFuncRandom): - (JSC::mathProtoFuncSin): - (JSC::mathProtoFuncSqrt): - (JSC::mathProtoFuncTan): For these functions, which we expect or know - to produce results not representable as ints, call jsDoubleNumber instead - of jsNumber. - -2009-11-23 Mark Rowe - - Unreviewed. Unbreak the regression tests after r51329. - - * API/JSBase.cpp: - (JSEvaluateScript): Null-check clientData before dereferencing it. - * API/JSObjectRef.cpp: - (JSObjectCallAsFunction): Ditto. - -2009-11-23 Gavin Barraclough - - Reviewed by Geoff Garen. - - Part 1/3 of REGRESSION: Many web pages fail to render after interesting script runs in isolated world - - Some clients of the JavaScriptCore API expect to be able to make callbacks over the JSC API, - and for this to automagically cause execution to take place in the world associated with the - global object associated with the ExecState (JSContextRef) passed. However this is not how - things work - the world must be explicitly set within WebCore. - - Making this work just for API calls to evaluate & call will be a far from perfect solution, - since direct (non-API) use of JSC still relies on WebCore setting the current world correctly. - A better solution would be to make this all work automagically all throughout WebCore, but this - will require more refactoring. - - Since the API is in JSC but worlds only exist in WebCore, add callbacks on the JSGlobalData::ClientData - to allow it to update the current world on entry/exit via the JSC API. This is temporary duck - tape, and should be removed once the current world no longer needs to be explicitly tracked. - - * API/JSBase.cpp: - (JSEvaluateScript): - * API/JSObjectRef.cpp: - (JSObjectCallAsFunction): - * JavaScriptCore.exp: - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::ClientData::beginningExecution): - (JSC::JSGlobalData::ClientData::completedExecution): - * runtime/JSGlobalData.h: - -2009-11-23 Steve Block - - Reviewed by Dmitry Titov. - - Adds MainThreadAndroid.cpp with Android-specific WTF threading functions. - https://bugs.webkit.org/show_bug.cgi?id=31807 - - * wtf/android: Added. - * wtf/android/MainThreadAndroid.cpp: Added. - (WTF::timeoutFired): - (WTF::initializeMainThreadPlatform): - (WTF::scheduleDispatchFunctionsOnMainThread): - -2009-11-23 Alexey Proskuryakov - - Reviewed by Brady Eidson. - - https://bugs.webkit.org/show_bug.cgi?id=31748 - Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport - - * JavaScriptCore.exp: Export callOnMainThreadAndWait. - -2009-11-23 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - [Symbian] Fix lastIndexOf() for Symbian - https://bugs.webkit.org/show_bug.cgi?id=31773 - - Symbian soft floating point library has problems with operators - comparing NaN to numbers. Without a workaround lastIndexOf() - function does not work. - - Patch developed by David Leong. - - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncLastIndexOf):Add an extra test - to check for NaN for Symbian. - -2009-11-23 Steve Block - - Reviewed by Eric Seidel. - - Android port lacks implementation of atomicIncrement and atomicDecrement. - https://bugs.webkit.org/show_bug.cgi?id=31715 - - * wtf/Threading.h: Modified. - (WTF::atomicIncrement): Added Android implementation. - (WTF::atomicDecrement): Added Android implementation. - -2009-11-22 Laszlo Gombos - - Unreviewed. - - [Qt] Sort source lists and remove obsolete comments - from the build system. - - * JavaScriptCore.pri: - -2009-11-21 Laszlo Gombos - - Reviewed by Eric Seidel. - - [Qt][Mac] Turn on multiple JavaScript threads for QtWebkit on Mac - https://bugs.webkit.org/show_bug.cgi?id=31753 - - * wtf/Platform.h: - -2009-11-19 Steve Block - - Android port lacks configuration in Platform.h and config.h. - https://bugs.webkit.org/show_bug.cgi?id=31671 - - * wtf/Platform.h: Modified. Added Android-specific configuration. - -2009-11-19 Alexey Proskuryakov - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=31690 - Make SocketStreamHandleCFNet work on Windows - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * wtf/MainThread.cpp: - (WTF::FunctionWithContext::FunctionWithContext): - (WTF::dispatchFunctionsFromMainThread): - (WTF::callOnMainThreadAndWait): - * wtf/MainThread.h: - Re-add callOnMainThreadAndWait(), which was removed in bug 23926. - -2009-11-19 Dmitry Titov - - Reviewed by David Levin. - - isMainThread() on Chromium (Mac and Linux) is so slow it timeouts LayoutTests.. - https://bugs.webkit.org/show_bug.cgi?id=31693 - - * wtf/ThreadingPthreads.cpp: - (WTF::initializeThreading): grab and use the pthread_t of the main thread instead of ThreadIdentifier. - (WTF::isMainThread): Ditto. - -2009-11-19 Laszlo Gombos - - Reviewed by Darin Adler. - - Remove HAVE(STRING_H) guard from JavaScriptCore - https://bugs.webkit.org/show_bug.cgi?id=31668 - - * config.h: - * runtime/UString.cpp: - -2009-11-19 Dumitru Daniliuc - - Reviewed by Dmitry Titov. - - Fixing a bug in MessageQueue::removeIf() that leads to an - assertion failure. - - https://bugs.webkit.org/show_bug.cgi?id=31657 - - * wtf/MessageQueue.h: - (WTF::MessageQueue::removeIf): - -2009-11-19 Laszlo Gombos - - Reviewed by Darin Adler. - - Remove HAVE(FLOAT_H) guard - https://bugs.webkit.org/show_bug.cgi?id=31661 - - JavaScriptCore has a dependency on float.h, there is - no need to guard float.h. - - * runtime/DatePrototype.cpp: Remove include directive - for float.h as it is included in MathExtras.h already. - * runtime/Operations.cpp: Ditto. - * runtime/UString.cpp: Ditto. - * wtf/dtoa.cpp: Ditto. - * wtf/MathExtras.h: Remove HAVE(FLOAT_H) guard. - * wtf/Platform.h: Ditto. - -2009-11-19 Thiago Macieira - - Reviewed by Simon Hausmann. - - Build fix for 32-bit Sparc machines: these machines are big-endian. - - * wtf/Platform.h: - -2009-11-18 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Remove support for Qt v4.3 or older versions - https://bugs.webkit.org/show_bug.cgi?id=29469 - - * JavaScriptCore.pro: - * jsc.pro: - * wtf/unicode/qt4/UnicodeQt4.h: - -2009-11-18 Kent Tamura - - Reviewed by Darin Adler. - - Move UString::from(double) implementation to new - WTF::doubleToStringInJavaScriptFormat(), and expose it because WebCore - code will use it. - https://bugs.webkit.org/show_bug.cgi?id=31330 - - - Introduce new function createRep(const char*, unsigned) and - UString::UString(const char*, unsigned) to reduce 2 calls to strlen(). - - Fix a bug that dtoa() doesn't update *rve if the input value is NaN - or Infinity. - - No new tests because this doesn't change the behavior. - - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * runtime/UString.cpp: - (JSC::createRep): - (JSC::UString::UString): - (JSC::UString::from): Move the code to doubleToStringInJavaScriptFormat(). - * runtime/UString.h: - * wtf/dtoa.cpp: - (WTF::dtoa): Fix a bug about rve. - (WTF::append): A helper for doubleToStringInJavaScriptFormat(). - (WTF::doubleToStringInJavaScriptFormat): Move the code from UString::from(double). - * wtf/dtoa.h: - -2009-11-18 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Remove WTF_USE_JAVASCRIPTCORE_BINDINGS as it is no longer used - https://bugs.webkit.org/show_bug.cgi?id=31643 - - * JavaScriptCore.pro: - -2009-11-18 Nate Chapin - - Reviewed by Darin Fisher. - - Remove Chromium's unnecessary dependency on wtf's tcmalloc files. - - https://bugs.webkit.org/show_bug.cgi?id=31648 - - * JavaScriptCore.gyp/JavaScriptCore.gyp: - -2009-11-18 Thiago Macieira - - Reviewed by Gavin Barraclough. - - [Qt] Implement symbol hiding for JSC's JIT functions. - - These functions are implemented directly in assembly, so they need the - proper directives to enable/disable visibility. On ELF systems, it's - .hidden, whereas on Mach-O systems (Mac) it's .private_extern. On - Windows, it's not necessary since you have to explicitly export. I - also implemented the AIX idiom, though it's unlikely anyone will - implement AIX/POWER JIT. - https://bugs.webkit.org/show_bug.cgi?id=30864 - - * jit/JITStubs.cpp: - -2009-11-18 Oliver Hunt - - Reviewed by Alexey Proskuryakov. - - Interpreter may do an out of range access when throwing an exception in the profiler. - https://bugs.webkit.org/show_bug.cgi?id=31635 - - Add bounds check. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::throwException): - -2009-11-18 Gabor Loki - - Reviewed by Darin Adler. - - Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux - https://bugs.webkit.org/show_bug.cgi?id=31631 - - * jit/ExecutableAllocator.h: - (JSC::ExecutableAllocator::cacheFlush): - -2009-11-18 Harald Fernengel - - Reviewed by Simon Hausmann. - - [Qt] Fix detection of linux-g++ - - Never use "linux-g++*" to check for linux-g++, since this will break embedded - builds which use linux-arm-g++ and friends. Use 'linux*-g++*' to check for any - g++ on linux mkspec. - - * JavaScriptCore.pri: - -2009-11-17 Jon Honeycutt - - Add JSContextRefPrivate.h to list of copied files. - - Reviewed by Mark Rowe. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: - -2009-11-17 Martin Robinson - - Reviewed by Adam Barth. - - [GTK] Style cleanup for GOwnPtr - https://bugs.webkit.org/show_bug.cgi?id=31506 - - Remove forward declaration in GOwnPtr and do some style cleanup. - - * wtf/GOwnPtr.cpp: - * wtf/GOwnPtr.h: - (WTF::GOwnPtr::GOwnPtr): - (WTF::GOwnPtr::~GOwnPtr): - (WTF::GOwnPtr::get): - (WTF::GOwnPtr::release): - (WTF::GOwnPtr::outPtr): - (WTF::GOwnPtr::set): - (WTF::GOwnPtr::clear): - (WTF::GOwnPtr::operator*): - (WTF::GOwnPtr::operator->): - (WTF::GOwnPtr::operator!): - (WTF::GOwnPtr::operator UnspecifiedBoolType): - (WTF::GOwnPtr::swap): - (WTF::swap): - (WTF::operator==): - (WTF::operator!=): - (WTF::getPtr): - (WTF::freeOwnedGPtr): - -2009-11-17 Oliver Hunt - - Reviewed by Maciej Stachowiak. - - Incorrect use of JavaScriptCore API in DumpRenderTree - https://bugs.webkit.org/show_bug.cgi?id=31577 - - Add assertions to the 'toJS' functions to catch mistakes like - this early. Restructure existing code which blindly passed potentially - null values to toJS when forwarding exceptions so that a null check is - performed first. - - * API/APICast.h: - (toJS): - (toJSForGC): - * API/JSCallbackObjectFunctions.h: - (JSC::::getOwnPropertySlot): - (JSC::::put): - (JSC::::deleteProperty): - (JSC::::construct): - (JSC::::hasInstance): - (JSC::::call): - (JSC::::toNumber): - (JSC::::toString): - (JSC::::staticValueGetter): - (JSC::::callbackGetter): - * API/tests/testapi.c: Fix errors in the API tester. - (MyObject_getProperty): - (MyObject_convertToType): - (EvilExceptionObject_convertToType): - -2009-11-16 Zoltan Herczeg - - Reviewed by Gavin Barraclough. - - https://bugs.webkit.org/show_bug.cgi?id=31050 - - Minor fixes for JSVALUE32_64: branchConvertDoubleToInt32 - failed on a CortexA8 CPU, but not on a simulator; and - JITCall.cpp modifications was somehow not committed to mainline. - - * assembler/ARMAssembler.h: - (JSC::ARMAssembler::fmrs_r): - * assembler/MacroAssemblerARM.h: - (JSC::MacroAssemblerARM::branchConvertDoubleToInt32): - * jit/JITCall.cpp: - (JSC::JIT::compileOpCall): - -2009-11-16 Joerg Bornemann - - Reviewed by Simon Hausmann. - - Fix Qt build on Windows CE 6. - - * JavaScriptCore.pri: Add missing include path. - * wtf/Platform.h: Include ce_time.h for Windows CE 6. - -2009-11-13 Zoltan Herczeg - - Reviewed by Gavin Barraclough. - - https://bugs.webkit.org/show_bug.cgi?id=31050 - - Adding optimization support for mode JSVALUE32_64 - on ARM systems. - - * jit/JIT.h: - * jit/JITCall.cpp: - (JSC::JIT::compileOpCall): - * jit/JITPropertyAccess.cpp: - (JSC::JIT::emit_op_method_check): - (JSC::JIT::compileGetByIdHotPath): - (JSC::JIT::compileGetByIdSlowCase): - (JSC::JIT::emit_op_put_by_id): - -2009-11-14 Zoltan Herczeg - - Reviewed by Gavin Barraclough. - - https://bugs.webkit.org/show_bug.cgi?id=31050 - - Adding JSVALUE32_64 support for ARM (but not turning it - on by default). All optimizations must be disabled, since - this patch is only the first of a series of patches. - - During the work, a lot of x86 specific code revealed and - made platform independent. - See revisions: 50531 50541 50593 50594 50595 - - * assembler/ARMAssembler.h: - (JSC::ARMAssembler::): - (JSC::ARMAssembler::fdivd_r): - * assembler/MacroAssemblerARM.h: - (JSC::MacroAssemblerARM::lshift32): - (JSC::MacroAssemblerARM::neg32): - (JSC::MacroAssemblerARM::rshift32): - (JSC::MacroAssemblerARM::branchOr32): - (JSC::MacroAssemblerARM::set8): - (JSC::MacroAssemblerARM::setTest8): - (JSC::MacroAssemblerARM::loadDouble): - (JSC::MacroAssemblerARM::divDouble): - (JSC::MacroAssemblerARM::convertInt32ToDouble): - (JSC::MacroAssemblerARM::zeroDouble): - * jit/JIT.cpp: - * jit/JIT.h: - * jit/JITOpcodes.cpp: - (JSC::JIT::privateCompileCTIMachineTrampolines): - * jit/JITStubs.cpp: - * wtf/StdLibExtras.h: - -2009-11-13 Dominik Röttsches - - Reviewed by Eric Seidel. - - Unify TextBoundaries implementations by only relying on WTF Unicode abstractions - https://bugs.webkit.org/show_bug.cgi?id=31468 - - Adding isAlphanumeric abstraction, required - by TextBoundaries.cpp. - - * wtf/unicode/glib/UnicodeGLib.h: - (WTF::Unicode::isAlphanumeric): - * wtf/unicode/icu/UnicodeIcu.h: - (WTF::Unicode::isAlphanumeric): - -2009-11-13 Norbert Leser - - Reviewed by Eric Seidel. - - Added macros for USERINCLUDE paths within symbian blocks - to guarantee inclusion of respective header files from local path - first (to avoid clashes with same names of header files in system include path). - - * JavaScriptCore.pri: - -2009-11-13 Oliver Hunt - - Reviewed by Geoff Garen. - - JSValueProtect and JSValueUnprotect don't protect API wrapper values - https://bugs.webkit.org/show_bug.cgi?id=31485 - - Make JSValueProtect/Unprotect use a new 'toJS' function, 'toJSForGC' that - does not attempt to to strip out API wrapper objects. - - * API/APICast.h: - (toJSForGC): - * API/JSValueRef.cpp: - (JSValueProtect): - (JSValueUnprotect): - * API/tests/testapi.c: - (makeGlobalNumberValue): - (main): - -2009-11-13 İsmail Dönmez - - Reviewed by Antti Koivisto. - - Fix typo, ce_time.cpp should be ce_time.c - - * JavaScriptCore.pri: - -2009-11-12 Steve VanDeBogart - - Reviewed by Adam Barth. - - Calculate the time offset only if we were able to parse - the date string. This saves an IPC in Chromium for - invalid date strings. - https://bugs.webkit.org/show_bug.cgi?id=31416 - - * wtf/DateMath.cpp: - (WTF::parseDateFromNullTerminatedCharacters): - (JSC::parseDateFromNullTerminatedCharacters): - -2009-11-12 Oliver Hunt - - Rollout r50896 until i can work out why it causes failures. - - * bytecompiler/BytecodeGenerator.cpp: - (JSC::BytecodeGenerator::emitReturn): - * interpreter/Interpreter.cpp: - (JSC::Interpreter::execute): - * parser/Nodes.cpp: - (JSC::EvalNode::emitBytecode): - -2009-11-12 Steve Falkenburg - - Reviewed by Stephanie Lewis. - - Remove LIBRARY directive from def file to fix Debug_All target. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-11-12 Gustavo Noronha Silva - - Rubber-stamped by Holger Freyther. - - Revert r50204, since it makes DRT crash on 32 bits release builds - for GTK+. - - * wtf/FastMalloc.h: - -2009-11-12 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Start unifying entry logic for function and eval code. - - Eval now uses a ret instruction to end execution, and sets up - a callframe more in line with what we do for function entry. - - * bytecompiler/BytecodeGenerator.cpp: - (JSC::BytecodeGenerator::emitReturn): - * interpreter/Interpreter.cpp: - (JSC::Interpreter::execute): - * parser/Nodes.cpp: - (JSC::EvalNode::emitBytecode): - -2009-11-12 Richard Moe Gustavsen - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Disable pthread_setname_np. - - This allows Qt builds on Mac from 10.6 to run on earlier version - where this symbol is not present. - https://bugs.webkit.org/show_bug.cgi?id=31403 - - * wtf/Platform.h: - -2009-11-12 Thiago Macieira - - Reviewed by Kenneth Rohde Christiansen. - - [Qt] Fix linking on Linux 32-bit. - - It was missing the ".text" directive at the top of the file, - indicating that code would follow. Without it, the assembler created - "NOTYPE" symbols, which would result in linker errors. - https://bugs.webkit.org/show_bug.cgi?id=30863 - - * jit/JITStubs.cpp: - -2009-11-11 Laszlo Gombos - - Reviewed by Alexey Proskuryakov. - - Refactor multiple JavaScriptCore threads - https://bugs.webkit.org/show_bug.cgi?id=31328 - - Remove the id field from the PlatformThread structure - as it is not used. - - * runtime/Collector.cpp: - (JSC::getCurrentPlatformThread): - (JSC::suspendThread): - (JSC::resumeThread): - (JSC::getPlatformThreadRegisters): - -2009-11-10 Geoffrey Garen - - Linux build fix: Added an #include for UINT_MAX. - - * runtime/WeakRandom.h: - -2009-11-10 Geoffrey Garen - - JavaScriptGlue build fix: Marked a file 'private' instead of 'project'. - - * JavaScriptCore.xcodeproj/project.pbxproj: - -2009-11-10 Geoffrey Garen - - Reviewed by Gavin "avGni arBalroguch" Barraclough. - - Faster Math.random, based on GameRand. - - SunSpider says 1.4% faster. - - * GNUmakefile.am: - * JavaScriptCore.gypi: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - * JavaScriptCore.xcodeproj/project.pbxproj: Added the header to the project. - - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::JSGlobalData): - * runtime/JSGlobalData.h: Use an object to track random number generation - state, initialized to the current time. - - * runtime/MathObject.cpp: - (JSC::MathObject::MathObject): - (JSC::mathProtoFuncRandom): Use the new hotness. - - * runtime/WeakRandom.h: Added. - (JSC::WeakRandom::WeakRandom): - (JSC::WeakRandom::get): - (JSC::WeakRandom::advance): The new hotness. - -2009-11-09 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Imported the v8 DST cache. - - SunSpider says 1.5% faster. - - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::resetDateCache): Reset the DST cache when resetting - other date data. - - * runtime/JSGlobalData.h: - (JSC::DSTOffsetCache::DSTOffsetCache): - (JSC::DSTOffsetCache::reset): Added a struct for the DST cache. - - * wtf/DateMath.cpp: - (WTF::calculateDSTOffsetSimple): - (WTF::calculateDSTOffset): - (WTF::parseDateFromNullTerminatedCharacters): - (JSC::getDSTOffset): - (JSC::gregorianDateTimeToMS): - (JSC::msToGregorianDateTime): - (JSC::parseDateFromNullTerminatedCharacters): - * wtf/DateMath.h: The imported code for probing and updating the cache. - -2009-11-09 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Fixed an edge case that could cause the engine not to notice a timezone - change. - - No test because this case would require manual intervention to change - the timezone during the test. - - SunSpider reports no change. - - * runtime/DateInstanceCache.h: - (JSC::DateInstanceCache::DateInstanceCache): - (JSC::DateInstanceCache::reset): Added a helper function for resetting - this cache. Also, shrank the cache, since we'll be resetting it often. - - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::resetDateCache): Include resetting the DateInstanceCache - in resetting Date data. (Otherwise, a cache hit could bypass a necessary - timezone update check.) - -2009-11-09 Geoffrey Garen - - Reviewed by Sam Weinig. - - Some manual inlining and constant propogation in Date code. - - SunSpider reports a 0.4% speedup on date-*, no overall speedup. Shark - says some previously evident stalls are now gone. - - * runtime/DateConstructor.cpp: - (JSC::callDate): - * runtime/DateConversion.cpp: - (JSC::formatTime): - (JSC::formatTimeUTC): Split formatTime into UTC and non-UTC variants. - - * runtime/DateConversion.h: - * runtime/DateInstance.cpp: - (JSC::DateInstance::calculateGregorianDateTime): - (JSC::DateInstance::calculateGregorianDateTimeUTC): - * runtime/DateInstance.h: - (JSC::DateInstance::gregorianDateTime): - (JSC::DateInstance::gregorianDateTimeUTC): Split gregorianDateTime into - a UTC and non-UTC variant, and split each variant into a fast inline - case and a slow out-of-line case. - - * runtime/DatePrototype.cpp: - (JSC::formatLocaleDate): - (JSC::dateProtoFuncToString): - (JSC::dateProtoFuncToUTCString): - (JSC::dateProtoFuncToISOString): - (JSC::dateProtoFuncToDateString): - (JSC::dateProtoFuncToTimeString): - (JSC::dateProtoFuncGetFullYear): - (JSC::dateProtoFuncGetUTCFullYear): - (JSC::dateProtoFuncToGMTString): - (JSC::dateProtoFuncGetMonth): - (JSC::dateProtoFuncGetUTCMonth): - (JSC::dateProtoFuncGetDate): - (JSC::dateProtoFuncGetUTCDate): - (JSC::dateProtoFuncGetDay): - (JSC::dateProtoFuncGetUTCDay): - (JSC::dateProtoFuncGetHours): - (JSC::dateProtoFuncGetUTCHours): - (JSC::dateProtoFuncGetMinutes): - (JSC::dateProtoFuncGetUTCMinutes): - (JSC::dateProtoFuncGetSeconds): - (JSC::dateProtoFuncGetUTCSeconds): - (JSC::dateProtoFuncGetTimezoneOffset): - (JSC::setNewValueFromTimeArgs): - (JSC::setNewValueFromDateArgs): - (JSC::dateProtoFuncSetYear): - (JSC::dateProtoFuncGetYear): Updated for the gregorianDateTime change above. - -2009-11-09 Geoffrey Garen - - Build fix: export a new symbol. - - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-11-09 Geoffrey Garen - - Reviewed by Sam "Home Wrecker" Weinig. - - Added a tiny cache for Date parsing. - - SunSpider says 1.2% faster. - - * runtime/DateConversion.cpp: - (JSC::parseDate): Try to reuse the last parsed Date, if present. - - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::resetDateCache): - * runtime/JSGlobalData.h: Added storage for last parsed Date. Refactored - this code to make resetting the date cache easier. - - * runtime/JSGlobalObject.h: - (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for - refactoring. - - * wtf/DateMath.cpp: - (JSC::parseDateFromNullTerminatedCharacters): - * wtf/DateMath.h: Changed ExecState to be first parameter, as is the JSC custom. - -2009-11-09 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Can cache prototype lookups on uncacheable dictionaries. - https://bugs.webkit.org/show_bug.cgi?id=31198 - - Replace fromDictionaryTransition with flattenDictionaryObject and - flattenDictionaryStructure. This change is necessary as we need to - guarantee that our attempt to convert away from a dictionary structure - will definitely succeed, and in some cases this requires mutating the - object storage itself. - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::tryCacheGetByID): - * jit/JITStubs.cpp: - (JSC::JITThunks::tryCacheGetByID): - (JSC::DEFINE_STUB_FUNCTION): - * runtime/BatchedTransitionOptimizer.h: - (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer): - * runtime/JSObject.h: - (JSC::JSObject::flattenDictionaryObject): - * runtime/Operations.h: - (JSC::normalizePrototypeChain): - * runtime/Structure.cpp: - (JSC::Structure::flattenDictionaryStructure): - (JSC::comparePropertyMapEntryIndices): - * runtime/Structure.h: - -2009-11-09 Laszlo Gombos - - Not reviewed, build fix. - - Remove extra character from r50701. - - * JavaScriptCore.pri: - -2009-11-09 Laszlo Gombos - - Not reviewed, build fix. - - Revert r50695 because it broke QtWebKit (clean builds). - - * JavaScriptCore.pri: - -2009-11-09 Norbert Leser - - Reviewed by Kenneth Rohde Christiansen. - - Prepended $$PWD to GENERATED_SOURCES_DIR to avoid potential ambiguities when included from WebCore.pro. - Some preprocessors consider this GENERATED_SOURCES_DIR relative to current invoking dir (e.g., ./WebCore), - and not the working dir of JavaCriptCore.pri (i.e., ../JavaScriptCore/). - - * JavaScriptCore.pri: - -2009-11-09 Laszlo Gombos - - Reviewed by Kenneth Rohde Christiansen. - - Use explicit parentheses to silence gcc 4.4 -Wparentheses warnings - https://bugs.webkit.org/show_bug.cgi?id=31040 - - * interpreter/Interpreter.cpp: - (JSC::Interpreter::privateExecute): - -2009-11-08 David Levin - - Reviewed by NOBODY (speculative snow leopard and windows build fixes). - - * wtf/DateMath.cpp: - (WTF::parseDateFromNullTerminatedCharacters): - (JSC::gregorianDateTimeToMS): - (JSC::msToGregorianDateTime): - (JSC::parseDateFromNullTerminatedCharacters): - * wtf/DateMath.h: - (JSC::GregorianDateTime::GregorianDateTime): - -2009-11-08 David Levin - - Reviewed by NOBODY (chromium build fix). - - Hopefully, the last build fix. - - Create better separation in DateMath about the JSC - and non-JSC portions. Also, only expose the non-JSC - version in the exports. - - * JavaScriptCore.exp: - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - * wtf/DateMath.cpp: - (WTF::parseDateFromNullTerminatedCharacters): - (JSC::getUTCOffset): - (JSC::gregorianDateTimeToMS): - (JSC::msToGregorianDateTime): - (JSC::parseDateFromNullTerminatedCharacters): - * wtf/DateMath.h: - (JSC::gmtoffset): - -2009-11-08 David Levin - - Reviewed by NOBODY (chromium build fix). - - For the change in DateMath. - - * config.h: - * wtf/DateMath.cpp: - -2009-11-06 Geoffrey Garen - - Windows build fix: export some symbols. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-11-06 Geoffrey Garen - - Build fix: updated export file. - - * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: - -2009-11-06 Geoffrey Garen - - Build fix: added some #includes. - - * wtf/CurrentTime.h: - * wtf/DateMath.h: - -2009-11-06 Geoffrey Garen - - Reviewed by Oliver Hunt. - - https://bugs.webkit.org/show_bug.cgi?id=31197 - Implemented a timezone cache not based on Mac OS X's notify_check API. - - If the VM calculates the local timezone offset from UTC, it caches the - result until the end of the current VM invocation. (We don't want to cache - forever, because the user's timezone may change over time.) - - This removes notify_* overhead on Mac, and, more significantly, removes - OS time and date call overhead on non-Mac platforms. - - ~8% speedup on Date microbenchmark on Mac. SunSpider reports maybe a tiny - speedup on Mac. (Speedup on non-Mac platforms should be even more noticeable.) - - * JavaScriptCore.exp: - - * interpreter/CachedCall.h: - (JSC::CachedCall::CachedCall): - * interpreter/Interpreter.cpp: - (JSC::Interpreter::execute): - * runtime/JSGlobalObject.h: - (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Made the - DynamicGlobalObjectScope constructor responsible for checking whether a - dynamicGlobalObject has already been set. This eliminated some duplicate - client code, and allowed me to avoid adding even more duplicate client - code. Made DynamicGlobalObjectScope responsible for resetting the - local timezone cache upon first entry to the VM. - - * runtime/DateConstructor.cpp: - (JSC::constructDate): - (JSC::callDate): - (JSC::dateParse): - (JSC::dateUTC): - * runtime/DateConversion.cpp: - (JSC::parseDate): - * runtime/DateConversion.h: - * runtime/DateInstance.cpp: - (JSC::DateInstance::gregorianDateTime): - * runtime/DateInstance.h: - * runtime/DateInstanceCache.h: - * runtime/DatePrototype.cpp: - (JSC::setNewValueFromTimeArgs): - (JSC::setNewValueFromDateArgs): - (JSC::dateProtoFuncSetYear): - * runtime/InitializeThreading.cpp: - (JSC::initializeThreadingOnce): - * runtime/JSGlobalData.cpp: - (JSC::JSGlobalData::JSGlobalData): - * runtime/JSGlobalData.h: - * wtf/DateMath.cpp: - (WTF::getCurrentUTCTime): - (WTF::getCurrentUTCTimeWithMicroseconds): - (WTF::getLocalTime): - (JSC::getUTCOffset): Use the new cache. Also, see below. - (JSC::gregorianDateTimeToMS): - (JSC::msToGregorianDateTime): - (JSC::initializeDates): - (JSC::parseDateFromNullTerminatedCharacters): Simplified the way this function - accounts for the local timezone offset, to accomodate our new caching API, - and a (possibly misguided) caller in WebCore. Also, see below. - * wtf/DateMath.h: - (JSC::GregorianDateTime::GregorianDateTime): Moved most of the code in - DateMath.* into the JSC namespace. The code needed to move so it could - naturally interact with ExecState and JSGlobalData to support caching. - Logically, it seemed right to move it, too, since this code is not really - as low-level as the WTF namespace might imply -- it implements a set of - date parsing and conversion quirks that are finely tuned to the JavaScript - language. Also removed the Mac OS X notify_* infrastructure. - - * wtf/CurrentTime.h: - (WTF::currentTimeMS): - (WTF::getLocalTime): Moved the rest of the DateMath code here, and renamed - it to make it consistent with WTF's currentTime function. - -2009-11-06 Gabor Loki - - Unreviewed trivial buildfix after r50595. - - Rename the remaining rshiftPtr calls to rshift32 - - * jit/JITArithmetic.cpp: - (JSC::JIT::emit_op_rshift): - * jit/JITInlineMethods.h: - (JSC::JIT::emitFastArithImmToInt): +2010-02-09 Janne Koskinen -2009-11-06 Gavin Barraclough + Reviewed by Laszlo Gombos. - Reviewed by Oliver Hunt. + [Qt] use nanval() for Symbian as nonInlineNaN + https://bugs.webkit.org/show_bug.cgi?id=34170 - Tidy up the shift methods on the macro-assembler interface. + numeric_limits::quiet_NaN is broken in Symbian + causing NaN to be evaluated as a number. - Currently behaviour of shifts of a magnitude > 0x1f is undefined. - Instead defined that all shifts are masked to this range. This makes a lot of - practical sense, both since having undefined behaviour is not particularly - desirable, and because this behaviour is commonly required (particularly since - it is required bt ECMA-262 for shifts). + * runtime/JSValue.cpp: + (JSC::nonInlineNaN): - Update the ARM assemblers to provide this behaviour. Remove (now) redundant - masks from JITArithmetic, and remove rshiftPtr (this was used in case that - could be rewritten in a simpler form using rshift32, only optimized JSVALUE32 - on x86-64, which uses JSVALUE64!) +2010-01-07 Norbert Leser - * assembler/MacroAssembler.h: - * assembler/MacroAssemblerARM.h: - (JSC::MacroAssemblerARM::lshift32): - (JSC::MacroAssemblerARM::rshift32): - * assembler/MacroAssemblerARMv7.h: - (JSC::MacroAssemblerARMv7::lshift32): - (JSC::MacroAssemblerARMv7::rshift32): - * assembler/MacroAssemblerX86_64.h: - * jit/JITArithmetic.cpp: - (JSC::JIT::emit_op_lshift): - (JSC::JIT::emit_op_rshift): + Reviewed by NOBODY (OOPS!). -2009-11-05 Gavin Barraclough + RVCT compiler with "-Otime -O3" optimization tries to optimize out + inline new'ed pointers that are passed as arguments. + Proposed patch assigns new'ed pointer explicitly outside function call. - Rubber Stamped by Oliver Hunt. + * API/JSClassRef.cpp: + (OpaqueJSClass::OpaqueJSClass): + (OpaqueJSClassContextData::OpaqueJSClassContextData): - Remove a magic number (1) from the JIT, instead compute the value with OBJECT_OFFSET. +2009-11-19 Thiago Macieira - * jit/JITInlineMethods.h: - (JSC::JIT::emitPutJITStubArg): - (JSC::JIT::emitPutJITStubArgConstant): - (JSC::JIT::emitGetJITStubArg): - (JSC::JIT::emitPutJITStubArgFromVirtualRegister): - * jit/JITStubCall.h: - (JSC::JITStubCall::JITStubCall): - (JSC::JITStubCall::getArgument): - * jit/JITStubs.h: + Reviewed by Simon Hausmann. -2009-11-05 Zoltan Herczeg + Build fix for 32-bit Sparc machines: these machines are big-endian. - Reviewed by Gavin Barraclough. + * wtf/Platform.h: - https://bugs.webkit.org/show_bug.cgi?id=31159 - Fix branchDouble behaviour on ARM THUMB2 JIT. +2009-12-08 Gustavo Noronha Silva - The x86 branchDouble behaviour is reworked, and all JIT - ports should follow the x86 port. See bug 31104 and 31151 + Reviewed by Darin Adler. - This patch contains a fix for the traditional ARM port + Make WebKit build correctly on FreeBSD, IA64, and Alpha. + Based on work by Petr Salinger , + and Colin Watson . - * assembler/ARMAssembler.h: - (JSC::ARMAssembler::): - (JSC::ARMAssembler::fmrs_r): - (JSC::ARMAssembler::ftosid_r): - * assembler/MacroAssemblerARM.h: - (JSC::MacroAssemblerARM::): - (JSC::MacroAssemblerARM::branchDouble): - (JSC::MacroAssemblerARM::branchConvertDoubleToInt32): + * wtf/Platform.h: -2009-11-05 Chris Jerdonek +2009-12-18 Yongjun Zhang - Reviewed by Eric Seidel. + Reviewed by Simon Hausmann. - Removed the "this is part of the KDE project" comments from - all *.h, *.cpp, *.idl, and *.pm files. - - https://bugs.webkit.org/show_bug.cgi?id=31167 - - The maintenance and architecture page in the project wiki lists - this as a task. - - This change includes no changes or additions to test cases - since the change affects only comments. - - * wtf/wince/FastMallocWince.h: + https://bugs.webkit.org/show_bug.cgi?id=32713 + [Qt] make wtf/Assertions.h compile in winscw compiler. -2009-11-05 Gabor Loki + Add string arg before ellipsis to help winscw compiler resolve variadic + macro definitions in wtf/Assertions.h. - Reviewed by Gavin Barraclough. + * wtf/Assertions.h: - Use ARMv7 specific encoding for immediate constants on ARMv7 target - https://bugs.webkit.org/show_bug.cgi?id=31060 +2009-11-30 Jan-Arve Sæther - * assembler/ARMAssembler.cpp: - (JSC::ARMAssembler::getOp2): Use INVALID_IMM - (JSC::ARMAssembler::getImm): Use encodeComplexImm for complex immediate - (JSC::ARMAssembler::moveImm): Ditto. - (JSC::ARMAssembler::encodeComplexImm): Encode a constant by one or two - instructions or a PC relative load. - * assembler/ARMAssembler.h: Use INVALID_IMM if a constant cannot be - encoded as an immediate constant. - (JSC::ARMAssembler::): - (JSC::ARMAssembler::movw_r): 16-bit immediate load - (JSC::ARMAssembler::movt_r): High halfword 16-bit immediate load - (JSC::ARMAssembler::getImm16Op2): Encode immediate constant for - movw_r and mowt_r + Reviewed by Simon Hausmann. -2009-11-04 Mark Mentovai + [Qt] Fix compilation with win32-icc - Reviewed by Mark Rowe. + The Intel compiler does not support the __has_trivial_constructor type + trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The + reason for that is that the Intel Compiler depends on the Microsoft + Platform SDK, and in order to try to be "fully" MS compatible it will + "pretend" to be the same MS compiler as was shipped with the MS PSDK. + (Thus, compiling with win32-icc with VC8 SDK will make the source code + "think" the compiler at hand supports this type trait). - Provide TARGETING_TIGER and TARGETING_LEOPARD as analogues to - BUILDING_ON_TIGER and BUILDING_ON_LEOPARD. The TARGETING_ macros - consider the deployment target; the BUILDING_ON_ macros consider the - headers being built against. + * wtf/TypeTraits.h: - * wtf/Platform.h: +2009-11-28 Laszlo Gombos -2009-11-04 Gavin Barraclough + Reviewed by Eric Seidel. - Reviewed by Oliver Hunt. + Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows + https://bugs.webkit.org/show_bug.cgi?id=31943 - https://bugs.webkit.org/show_bug.cgi?id=31151 - Fix branchDouble behaviour on ARM THUMB2 JIT. + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): - The ARMv7 JIT is currently using ARMv7Assembler::ConditionEQ to branch - for DoubleEqualOrUnordered, however this is incorrect – ConditionEQ won't - branch on unordered operands. Similarly, DoubleLessThanOrUnordered & - DoubleLessThanOrEqualOrUnordered use ARMv7Assembler::ConditionLO & - ARMv7Assembler::ConditionLS, whereas they should be using - ARMv7Assembler::ConditionLT & ARMv7Assembler::ConditionLE. +2009-11-18 Gabor Loki - Fix these, and fill out the missing DoubleConditions. + Reviewed by Darin Adler. - * assembler/MacroAssemblerARMv7.h: - (JSC::MacroAssemblerARMv7::): - (JSC::MacroAssemblerARMv7::branchDouble): + Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=31631 -2009-11-04 Gavin Barraclough + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): - Rubber Stamped by Oliver Hunt. +2009-11-23 Laszlo Gombos - Enable native call optimizations on ARMv7. (Existing ARM_TRADITIONAL - implementation was generic, worked perfectly, just needed turning on). + Reviewed by Kenneth Rohde Christiansen. - * jit/JITOpcodes.cpp: - * wtf/Platform.h: + [Symbian] Fix lastIndexOf() for Symbian + https://bugs.webkit.org/show_bug.cgi?id=31773 -2009-11-04 Gavin Barraclough + Symbian soft floating point library has problems with operators + comparing NaN to numbers. Without a workaround lastIndexOf() + function does not work. - Rubber Stamped by Mark Rowe, Oliver Hunt, and Sam Weinig. + Patch developed by David Leong. - Add a missing assert to the ARMv7 JIT. + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncLastIndexOf):Add an extra test + to check for NaN for Symbian. - * assembler/ARMv7Assembler.h: - (JSC::ARMThumbImmediate::ARMThumbImmediate): +2009-11-18 Harald Fernengel -2009-11-04 Mark Rowe + Reviewed by Simon Hausmann. - Rubber-stamped by Oliver Hunt. + [Qt] Fix detection of linux-g++ - Remove bogus op_ prefix on dumped version of three opcodes. + Never use "linux-g++*" to check for linux-g++, since this will break embedded + builds which use linux-arm-g++ and friends. Use 'linux*-g++*' to check for any + g++ on linux mkspec. - * bytecode/CodeBlock.cpp: - (JSC::CodeBlock::dump): + * JavaScriptCore.pri: -2009-11-04 Mark Rowe +2009-11-16 Joerg Bornemann - Reviewed by Sam Weinig. + Reviewed by Simon Hausmann. - Fix dumping of constants in bytecode so that they aren't printed as large positive register numbers. + Fix Qt build on Windows CE 6. - We do this by having the registerName function return information about the constant if the register - number corresponds to a constant. This requires that registerName, and several functions that call it, - be converted to member functions of CodeBlock so that the constant value can be retrieved. The - ExecState also needs to be threaded down through these functions so that it can be passed on to - constantName when needed. + * JavaScriptCore.pri: Add missing include path. + * wtf/Platform.h: Include ce_time.h for Windows CE 6. - * bytecode/CodeBlock.cpp: - (JSC::constantName): - (JSC::CodeBlock::registerName): - (JSC::CodeBlock::printUnaryOp): - (JSC::CodeBlock::printBinaryOp): - (JSC::CodeBlock::printConditionalJump): - (JSC::CodeBlock::printGetByIdOp): - (JSC::CodeBlock::printPutByIdOp): - (JSC::CodeBlock::dump): - * bytecode/CodeBlock.h: - (JSC::CodeBlock::isConstantRegisterIndex): +2009-11-12 Thiago Macieira -2009-11-04 Pavel Heimlich + Reviewed by Kenneth Rohde Christiansen. - Reviewed by Alexey Proskuryakov. + [Qt] Fix linking on Linux 32-bit. - https://bugs.webkit.org/show_bug.cgi?id=30647 - Solaris build failure due to strnstr. + It was missing the ".text" directive at the top of the file, + indicating that code would follow. Without it, the assembler created + "NOTYPE" symbols, which would result in linker errors. + https://bugs.webkit.org/show_bug.cgi?id=30863 - * wtf/StringExtras.h: Enable strnstr on Solaris, too. + * jit/JITStubs.cpp: -2009-11-04 Gavin Barraclough +2009-11-13 İsmail Dönmez - Reviewed by Oliver Hunt. + Reviewed by Antti Koivisto. - https://bugs.webkit.org/show_bug.cgi?id=31104 - Refactor x86-specific behaviour out of the JIT. + Fix typo, ce_time.cpp should be ce_time.c - - Add explicit double branch conditions for ordered and unordered comparisons (presently the brehaviour is a mix). - - Refactor double to int conversion out into the MacroAssembler. - - Remove broken double to int conversion for !JSVALUE32_64 builds - this code was broken and slowing us down, fixing it showed it not to be an improvement. - - Remove exclusion of double to int conversion from (1 % X) cases in JSVALUE32_64 builds - if this was of benefit this is no longer the case; simplify. + * JavaScriptCore.pri: - * assembler/MacroAssemblerARM.h: - (JSC::MacroAssemblerARM::): - * assembler/MacroAssemblerARMv7.h: - (JSC::MacroAssemblerARMv7::): - * assembler/MacroAssemblerX86Common.h: - (JSC::MacroAssemblerX86Common::): - (JSC::MacroAssemblerX86Common::convertInt32ToDouble): - (JSC::MacroAssemblerX86Common::branchDouble): - (JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32): - * jit/JITArithmetic.cpp: - (JSC::JIT::emitBinaryDoubleOp): - (JSC::JIT::emit_op_div): - (JSC::JIT::emitSlow_op_jnless): - (JSC::JIT::emitSlow_op_jnlesseq): - * jit/JITOpcodes.cpp: - (JSC::JIT::emit_op_jfalse): +2009-11-12 Richard Moe Gustavsen -2009-11-04 Mark Mentovai + Reviewed by Kenneth Rohde Christiansen. - Reviewed by Eric Seidel. + [Qt] Disable pthread_setname_np. - Remove BUILDING_ON_LEOPARD from JavaScriptCore.gyp. This is supposed - to be set as needed only in wtf/Platform.h. + This allows Qt builds on Mac from 10.6 to run on earlier version + where this symbol is not present. + https://bugs.webkit.org/show_bug.cgi?id=31403 - * JavaScriptCore.gyp/JavaScriptCore.gyp: + * wtf/Platform.h: 2009-11-02 Oliver Hunt @@ -7852,161 +177,19 @@ The very last cell in the block is not allocated -- should not be marked. * jit/JITStubs.cpp: (JSC::JITThunks::tryCacheGetByID): -2009-11-02 Laszlo Gombos - - Reviewed by Darin Adler. - - PLATFORM(CF) should be set when building for Qt on Darwin - https://bugs.webkit.org/show_bug.cgi?id=23671 - - * wtf/Platform.h: Turn on CF support if both QT and DARWIN - platforms are defined. - -2009-11-02 Dmitry Titov - - Reviewed by David Levin. - - Remove threadsafe refcounting from tasks used with WTF::MessageQueue. - https://bugs.webkit.org/show_bug.cgi?id=30612 - - * wtf/MessageQueue.h: - (WTF::MessageQueue::alwaysTruePredicate): - (WTF::MessageQueue::~MessageQueue): - (WTF::MessageQueue::append): - (WTF::MessageQueue::appendAndCheckEmpty): - (WTF::MessageQueue::prepend): - (WTF::MessageQueue::waitForMessage): - (WTF::MessageQueue::waitForMessageFilteredWithTimeout): - (WTF::MessageQueue::tryGetMessage): - (WTF::MessageQueue::removeIf): - The MessageQueue is changed to act as a queue of OwnPtr. It takes ownership - of posted tasks and passes it to the new owner (in another thread) when the task is fetched. - All methods have arguments of type PassOwnPtr and return the same type. - - * wtf/Threading.cpp: - (WTF::createThread): - Superficial change to trigger rebuild of JSC project on Windows, - workaround for https://bugs.webkit.org/show_bug.cgi?id=30890 - -2009-10-30 Geoffrey Garen - - Reviewed by Oliver Hunt. - - Fixed failing layout test: restore a special case I accidentally deleted. - - * runtime/DatePrototype.cpp: - (JSC::setNewValueFromDateArgs): In the case of applying a change to a date - that is NaN, reset the date to 0 *and* then apply the change; don't just - reset the date to 0. - -2009-10-30 Geoffrey Garen - - Windows build fix: update for object-to-pointer change. - - * runtime/DatePrototype.cpp: - (JSC::formatLocaleDate): - -2009-10-29 Geoffrey Garen - - Reviewed by Darin Adler. - - https://bugs.webkit.org/show_bug.cgi?id=30942 - Use pointers instead of copies to pass GregorianDateTime objects around. - - SunSpider reports a shocking 4.5% speedup on date-format-xparb, and 1.3% - speedup on date-format-tofte. - - * runtime/DateInstance.cpp: - (JSC::DateInstance::gregorianDateTime): - * runtime/DateInstance.h: - * runtime/DatePrototype.cpp: - (JSC::formatLocaleDate): - (JSC::dateProtoFuncToString): - (JSC::dateProtoFuncToUTCString): - (JSC::dateProtoFuncToISOString): - (JSC::dateProtoFuncToDateString): - (JSC::dateProtoFuncToTimeString): - (JSC::dateProtoFuncGetFullYear): - (JSC::dateProtoFuncGetUTCFullYear): - (JSC::dateProtoFuncToGMTString): - (JSC::dateProtoFuncGetMonth): - (JSC::dateProtoFuncGetUTCMonth): - (JSC::dateProtoFuncGetDate): - (JSC::dateProtoFuncGetUTCDate): - (JSC::dateProtoFuncGetDay): - (JSC::dateProtoFuncGetUTCDay): - (JSC::dateProtoFuncGetHours): - (JSC::dateProtoFuncGetUTCHours): - (JSC::dateProtoFuncGetMinutes): - (JSC::dateProtoFuncGetUTCMinutes): - (JSC::dateProtoFuncGetSeconds): - (JSC::dateProtoFuncGetUTCSeconds): - (JSC::dateProtoFuncGetTimezoneOffset): - (JSC::setNewValueFromTimeArgs): - (JSC::setNewValueFromDateArgs): - (JSC::dateProtoFuncSetYear): - (JSC::dateProtoFuncGetYear): Renamed getGregorianDateTime to gregorianDateTime, - since it no longer has an out parameter. Uses 0 to indicate invalid dates. - -2009-10-30 Zoltan Horvath - - Reviewed by Darin Adler. - - Allow custom memory allocation control for JavaScriptCore's ListHashSet - https://bugs.webkit.org/show_bug.cgi?id=30853 - - Inherits ListHashSet class from FastAllocBase because it is - instantiated by 'new' in WebCore/rendering/RenderBlock.cpp:1813. - - * wtf/ListHashSet.h: - -2009-10-30 Oliver Hunt - - Reviewed by Gavin Barraclough. - - Regression: crash enumerating properties of an object with getters or setters - https://bugs.webkit.org/show_bug.cgi?id=30948 - - Add a guard to prevent us trying to cache property enumeration on - objects with getters or setters. - - * runtime/JSPropertyNameIterator.cpp: - (JSC::JSPropertyNameIterator::create): - -2009-10-30 Roland Steiner - - Reviewed by Eric Seidel. - - Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. - - Bug 28420 - Implement HTML5 rendering - (https://bugs.webkit.org/show_bug.cgi?id=28420) - - No new tests (no functional change). - - * Configurations/FeatureDefines.xcconfig: +2009-10-30 Tor Arne Vestbø -2009-10-29 Oliver Hunt + Reviewed by NOBODY (OOPS!). - Reviewed by Maciej Stachowiak. + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() - REGRESSION (r50218-r50262): E*TRADE accounts page is missing content - https://bugs.webkit.org/show_bug.cgi?id=30947 - + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. - The logic for flagging that a structure has non-enumerable properties - was in addPropertyWithoutTransition, rather than in the core Structure::put - method. Despite this I was unable to produce a testcase that caused - the failure that etrade was experiencing, but the new assertion in - getEnumerablePropertyNames triggers on numerous layout tests without - the fix, so in effecti all for..in enumeration in any test ends up - doing the required consistency check. + https://bugs.webkit.org/show_bug.cgi?id=29381 - * runtime/Structure.cpp: - (JSC::Structure::addPropertyWithoutTransition): - (JSC::Structure::put): - (JSC::Structure::getEnumerablePropertyNames): - (JSC::Structure::checkConsistency): + * runtime/TimeoutChecker.h: Add getter for the timeout interval 2009-10-29 Gabor Loki diff --git a/src/3rdparty/webkit/JavaScriptCore/Info.plist b/src/3rdparty/webkit/JavaScriptCore/Info.plist index 77c9eb8..17949b0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/Info.plist +++ b/src/3rdparty/webkit/JavaScriptCore/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -7,7 +7,7 @@ CFBundleExecutable ${PRODUCT_NAME} CFBundleGetInfoString - ${BUNDLE_VERSION}, Copyright 2003-2010 Apple Inc.; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2001 Peter Kelly <pmk@post.com>; Copyright 1997-2005 University of Cambridge; Copyright 1991, 2000, 2001 by Lucent Technologies. + ${BUNDLE_VERSION}, Copyright 2003-2009 Apple Inc.; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2001 Peter Kelly <pmk@post.com>; Copyright 1997-2005 University of Cambridge; Copyright 1991, 2000, 2001 by Lucent Technologies. CFBundleIdentifier com.apple.${PRODUCT_NAME} CFBundleInfoDictionaryVersion diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi index c0eb086..03c23c3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi @@ -64,7 +64,6 @@ 'bytecode/StructureStubInfo.h', 'bytecompiler/BytecodeGenerator.cpp', 'bytecompiler/BytecodeGenerator.h', - 'bytecompiler/NodesCodegen.cpp', 'bytecompiler/Label.h', 'bytecompiler/LabelScope.h', 'bytecompiler/RegisterID.h', @@ -120,7 +119,6 @@ 'jit/JITInlineMethods.h', 'jit/JITOpcodes.cpp', 'jit/JITPropertyAccess.cpp', - 'jit/JITPropertyAccess32_64.cpp', 'jit/JITStubCall.h', 'jit/JITStubs.cpp', 'jit/JITStubs.h', @@ -150,6 +148,8 @@ 'pcre/ucpinternal.h', 'pcre/ucptable.cpp', 'profiler/CallIdentifier.h', + 'profiler/HeavyProfile.cpp', + 'profiler/HeavyProfile.h', 'profiler/Profile.cpp', 'profiler/Profile.h', 'profiler/ProfileGenerator.cpp', @@ -159,6 +159,8 @@ 'profiler/Profiler.cpp', 'profiler/Profiler.h', 'profiler/ProfilerServer.h', + 'profiler/TreeProfile.cpp', + 'profiler/TreeProfile.h', 'runtime/ArgList.cpp', 'runtime/ArgList.h', 'runtime/Arguments.cpp', @@ -330,7 +332,6 @@ 'runtime/Tracing.h', 'runtime/UString.cpp', 'runtime/UString.h', - 'runtime/WeakRandom.h', 'wrec/CharacterClass.cpp', 'wrec/CharacterClass.h', 'wrec/CharacterClassConstructor.cpp', @@ -368,8 +369,8 @@ 'wtf/FastMalloc.h', 'wtf/Forward.h', 'wtf/GetPtr.h', - 'wtf/gtk/GOwnPtr.cpp', - 'wtf/gtk/GOwnPtr.h', + 'wtf/GOwnPtr.cpp', + 'wtf/GOwnPtr.h', 'wtf/gtk/MainThreadGtk.cpp', 'wtf/gtk/ThreadingGtk.cpp', 'wtf/HashCountedSet.h', @@ -399,6 +400,8 @@ 'wtf/PassRefPtr.h', 'wtf/Platform.h', 'wtf/PtrAndFlags.h', + 'wtf/qt/MainThreadQt.cpp', + 'wtf/qt/ThreadingQt.cpp', 'wtf/RandomNumber.cpp', 'wtf/RandomNumber.h', 'wtf/RandomNumberSeed.h', @@ -411,16 +414,11 @@ 'wtf/SegmentedVector.h', 'wtf/StdLibExtras.h', 'wtf/StringExtras.h', - 'wtf/StringHashFunctions.h', 'wtf/TCPackedCache.h', - 'wtf/qt/MainThreadQt.cpp', - 'wtf/qt/ThreadingQt.cpp', 'wtf/TCPageMap.h', 'wtf/TCSpinLock.h', 'wtf/TCSystemAlloc.cpp', 'wtf/TCSystemAlloc.h', - 'wtf/ThreadIdentifierDataPthreads.cpp', - 'wtf/ThreadIdentifierDataPthreads.h', 'wtf/Threading.cpp', 'wtf/Threading.h', 'wtf/ThreadingNone.cpp', @@ -442,7 +440,6 @@ 'wtf/unicode/UTF8.cpp', 'wtf/unicode/UTF8.h', 'wtf/UnusedParam.h', - 'wtf/ValueCheck.h', 'wtf/Vector.h', 'wtf/VectorTraits.h', 'wtf/VMTags.h', diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order index d6f6caa..3ae3ec6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order @@ -1625,6 +1625,7 @@ __ZN3JSC18EmptyStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10Registe __ZN3JSCL27compareByStringPairForQSortEPKvS1_ __Z22jsc_pcre_ucp_othercasej __ZN3JSCL35objectProtoFuncPropertyIsEnumerableEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE +__ZNK3JSC8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj __ZN3WTF7HashMapIjN3JSC7JSValueENS_7IntHashIjEENS_10HashTraitsIjEENS5_IS2_EEE3setERKjRKS2_ __ZN3WTF9HashTableIjSt4pairIjN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIjEE __ZN3JSC12RegisterFile21releaseExcessCapacityEv @@ -1840,6 +1841,7 @@ __ZN3JSC6JSCell14toThisJSStringEPNS_9ExecStateE __ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE __ZN3JSCL27objectProtoFuncLookupSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE __ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE +__ZNK3JSC16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj __ZN3JSC9ExecState22regExpConstructorTableEPS0_ __ZN3JSCL24regExpConstructorDollar7EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE __ZN3JSCL24regExpConstructorDollar8EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index d4cfe10..bb531e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -1,23 +1,14 @@ # JavaScriptCore - Qt4 build info VPATH += $$PWD -CONFIG(standalone_package) { - isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/generated -} else { - isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = generated -} - CONFIG(debug, debug|release) { + isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = generated$${QMAKE_DIR_SEP}debug OBJECTS_DIR = obj/debug } else { # Release + isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = generated$${QMAKE_DIR_SEP}release OBJECTS_DIR = obj/release } -symbian: { - # Need to guarantee this comes before system includes of /epoc32/include - MMP_RULES += "USERINCLUDE ../JavaScriptCore/profiler" -} - INCLUDEPATH = \ $$PWD \ $$PWD/.. \ @@ -28,7 +19,6 @@ INCLUDEPATH = \ $$PWD/interpreter \ $$PWD/jit \ $$PWD/parser \ - $$PWD/pcre \ $$PWD/profiler \ $$PWD/runtime \ $$PWD/wrec \ @@ -37,11 +27,12 @@ INCLUDEPATH = \ $$PWD/yarr \ $$PWD/API \ $$PWD/ForwardingHeaders \ - $$JSC_GENERATED_SOURCES_DIR \ + $$GENERATED_SOURCES_DIR \ $$INCLUDEPATH DEFINES += BUILDING_QT__ BUILDING_JavaScriptCore BUILDING_WTF +GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} win32-* { LIBS += -lwinmm } @@ -56,6 +47,11 @@ contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_YARR=0 } +# In debug mode JIT disabled until crash fixed +win32-* { + CONFIG(debug):!contains(DEFINES, ENABLE_JIT=1): DEFINES+=ENABLE_JIT=0 +} + # Rules when JIT enabled (not disabled) !contains(DEFINES, ENABLE_JIT=0) { linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { @@ -72,7 +68,33 @@ wince* { include(pcre/pcre.pri) +LUT_FILES += \ + runtime/DatePrototype.cpp \ + runtime/JSONObject.cpp \ + runtime/NumberConstructor.cpp \ + runtime/StringPrototype.cpp \ + runtime/ArrayPrototype.cpp \ + runtime/MathObject.cpp \ + runtime/RegExpConstructor.cpp \ + runtime/RegExpObject.cpp + +KEYWORDLUT_FILES += \ + parser/Keywords.table + +JSCBISON += \ + parser/Grammar.y + SOURCES += \ + wtf/Assertions.cpp \ + wtf/ByteArray.cpp \ + wtf/HashTable.cpp \ + wtf/MainThread.cpp \ + wtf/RandomNumber.cpp \ + wtf/RefCountedLeakCounter.cpp \ + wtf/TypeTraits.cpp \ + wtf/unicode/CollatorDefault.cpp \ + wtf/unicode/icu/CollatorICU.cpp \ + wtf/unicode/UTF8.cpp \ API/JSBase.cpp \ API/JSCallbackConstructor.cpp \ API/JSCallbackFunction.cpp \ @@ -83,40 +105,60 @@ SOURCES += \ API/JSStringRef.cpp \ API/JSValueRef.cpp \ API/OpaqueJSString.cpp \ - assembler/ARMAssembler.cpp \ - assembler/MacroAssemblerARM.cpp \ + runtime/InitializeThreading.cpp \ + runtime/JSGlobalData.cpp \ + runtime/JSGlobalObject.cpp \ + runtime/JSStaticScopeObject.cpp \ + runtime/JSVariableObject.cpp \ + runtime/JSActivation.cpp \ + runtime/JSNotAnObject.cpp \ + runtime/JSONObject.cpp \ + runtime/LiteralParser.cpp \ + runtime/MarkStack.cpp \ + runtime/TimeoutChecker.cpp \ bytecode/CodeBlock.cpp \ - bytecode/JumpTable.cpp \ - bytecode/Opcode.cpp \ - bytecode/SamplingTool.cpp \ bytecode/StructureStubInfo.cpp \ - bytecompiler/BytecodeGenerator.cpp \ - bytecompiler/NodesCodegen.cpp \ - debugger/DebuggerActivation.cpp \ - debugger/DebuggerCallFrame.cpp \ - debugger/Debugger.cpp \ - interpreter/CallFrame.cpp \ - interpreter/Interpreter.cpp \ - interpreter/RegisterFile.cpp \ - jit/ExecutableAllocatorPosix.cpp \ - jit/ExecutableAllocatorSymbian.cpp \ - jit/ExecutableAllocatorWin.cpp \ - jit/ExecutableAllocator.cpp \ - jit/JITArithmetic.cpp \ - jit/JITCall.cpp \ + bytecode/JumpTable.cpp \ + assembler/ARMAssembler.cpp \ + assembler/MacroAssemblerARM.cpp \ jit/JIT.cpp \ + jit/JITCall.cpp \ + jit/JITArithmetic.cpp \ jit/JITOpcodes.cpp \ jit/JITPropertyAccess.cpp \ - jit/JITPropertyAccess32_64.cpp \ + jit/ExecutableAllocator.cpp \ jit/JITStubs.cpp \ - parser/Lexer.cpp \ - parser/Nodes.cpp \ - parser/ParserArena.cpp \ - parser/Parser.cpp \ - profiler/Profile.cpp \ - profiler/ProfileGenerator.cpp \ - profiler/ProfileNode.cpp \ - profiler/Profiler.cpp \ + bytecompiler/BytecodeGenerator.cpp \ + runtime/ExceptionHelpers.cpp \ + runtime/JSPropertyNameIterator.cpp \ + interpreter/Interpreter.cpp \ + bytecode/Opcode.cpp \ + bytecode/SamplingTool.cpp \ + yarr/RegexCompiler.cpp \ + yarr/RegexInterpreter.cpp \ + yarr/RegexJIT.cpp \ + interpreter/RegisterFile.cpp + +symbian { + SOURCES += jit/ExecutableAllocatorSymbian.cpp \ + runtime/MarkStackSymbian.cpp +} else { + win32-*|wince* { + SOURCES += jit/ExecutableAllocatorWin.cpp \ + runtime/MarkStackWin.cpp + } else { + SOURCES += jit/ExecutableAllocatorPosix.cpp \ + runtime/MarkStackPosix.cpp + } +} + +!contains(DEFINES, USE_SYSTEM_MALLOC) { + SOURCES += wtf/TCSystemAlloc.cpp +} + +# AllInOneFile.cpp helps gcc analize and optimize code +# Other compilers may be able to do this at link time +SOURCES += \ runtime/ArgList.cpp \ runtime/Arguments.cpp \ runtime/ArrayConstructor.cpp \ @@ -127,67 +169,62 @@ SOURCES += \ runtime/CallData.cpp \ runtime/Collector.cpp \ runtime/CommonIdentifiers.cpp \ - runtime/Completion.cpp \ runtime/ConstructData.cpp \ + wtf/CurrentTime.cpp \ runtime/DateConstructor.cpp \ runtime/DateConversion.cpp \ runtime/DateInstance.cpp \ runtime/DatePrototype.cpp \ - runtime/ErrorConstructor.cpp \ + debugger/Debugger.cpp \ + debugger/DebuggerCallFrame.cpp \ + debugger/DebuggerActivation.cpp \ + wtf/dtoa.cpp \ runtime/Error.cpp \ + runtime/ErrorConstructor.cpp \ runtime/ErrorInstance.cpp \ runtime/ErrorPrototype.cpp \ - runtime/ExceptionHelpers.cpp \ + interpreter/CallFrame.cpp \ runtime/Executable.cpp \ runtime/FunctionConstructor.cpp \ runtime/FunctionPrototype.cpp \ runtime/GetterSetter.cpp \ runtime/GlobalEvalFunction.cpp \ runtime/Identifier.cpp \ - runtime/InitializeThreading.cpp \ runtime/InternalFunction.cpp \ - runtime/JSActivation.cpp \ - runtime/JSAPIValueWrapper.cpp \ + runtime/Completion.cpp \ runtime/JSArray.cpp \ + runtime/JSAPIValueWrapper.cpp \ runtime/JSByteArray.cpp \ runtime/JSCell.cpp \ runtime/JSFunction.cpp \ - runtime/JSGlobalData.cpp \ - runtime/JSGlobalObject.cpp \ runtime/JSGlobalObjectFunctions.cpp \ runtime/JSImmediate.cpp \ runtime/JSLock.cpp \ - runtime/JSNotAnObject.cpp \ runtime/JSNumberCell.cpp \ runtime/JSObject.cpp \ - runtime/JSONObject.cpp \ - runtime/JSPropertyNameIterator.cpp \ - runtime/JSStaticScopeObject.cpp \ runtime/JSString.cpp \ runtime/JSValue.cpp \ - runtime/JSVariableObject.cpp \ runtime/JSWrapperObject.cpp \ - runtime/LiteralParser.cpp \ + parser/Lexer.cpp \ runtime/Lookup.cpp \ - runtime/MarkStackPosix.cpp \ - runtime/MarkStackSymbian.cpp \ - runtime/MarkStackWin.cpp \ - runtime/MarkStack.cpp \ runtime/MathObject.cpp \ runtime/NativeErrorConstructor.cpp \ runtime/NativeErrorPrototype.cpp \ + parser/Nodes.cpp \ runtime/NumberConstructor.cpp \ runtime/NumberObject.cpp \ runtime/NumberPrototype.cpp \ runtime/ObjectConstructor.cpp \ runtime/ObjectPrototype.cpp \ runtime/Operations.cpp \ + parser/Parser.cpp \ + parser/ParserArena.cpp \ runtime/PropertyDescriptor.cpp \ runtime/PropertyNameArray.cpp \ runtime/PropertySlot.cpp \ runtime/PrototypeFunction.cpp \ - runtime/RegExpConstructor.cpp \ runtime/RegExp.cpp \ + runtime/RegExpConstructor.cpp \ runtime/RegExpObject.cpp \ runtime/RegExpPrototype.cpp \ runtime/ScopeChain.cpp \ @@ -195,38 +232,50 @@ SOURCES += \ runtime/StringConstructor.cpp \ runtime/StringObject.cpp \ runtime/StringPrototype.cpp \ - runtime/StructureChain.cpp \ runtime/Structure.cpp \ - runtime/TimeoutChecker.cpp \ + runtime/StructureChain.cpp \ runtime/UString.cpp \ - runtime/UStringImpl.cpp \ - wtf/Assertions.cpp \ - wtf/ByteArray.cpp \ - wtf/CurrentTime.cpp \ + profiler/HeavyProfile.cpp \ + profiler/Profile.cpp \ + profiler/ProfileGenerator.cpp \ + profiler/ProfileNode.cpp \ + profiler/Profiler.cpp \ + profiler/TreeProfile.cpp \ wtf/DateMath.cpp \ - wtf/dtoa.cpp \ wtf/FastMalloc.cpp \ - wtf/HashTable.cpp \ - wtf/MainThread.cpp \ - wtf/qt/MainThreadQt.cpp \ - wtf/qt/ThreadingQt.cpp \ - wtf/RandomNumber.cpp \ - wtf/RefCountedLeakCounter.cpp \ - wtf/ThreadingNone.cpp \ wtf/Threading.cpp \ - wtf/TypeTraits.cpp \ - wtf/unicode/CollatorDefault.cpp \ - wtf/unicode/icu/CollatorICU.cpp \ - wtf/unicode/UTF8.cpp \ - yarr/RegexCompiler.cpp \ - yarr/RegexInterpreter.cpp \ - yarr/RegexJIT.cpp - -# Generated files, simply list them for JavaScriptCore -SOURCES += \ - $${JSC_GENERATED_SOURCES_DIR}/Grammar.cpp + wtf/qt/MainThreadQt.cpp -!contains(DEFINES, USE_SYSTEM_MALLOC) { - SOURCES += wtf/TCSystemAlloc.cpp +!contains(DEFINES, ENABLE_SINGLE_THREADED=1) { + SOURCES += wtf/qt/ThreadingQt.cpp +} else { + DEFINES += ENABLE_JSC_MULTIPLE_THREADS=0 + SOURCES += wtf/ThreadingNone.cpp } +# GENERATOR 1-A: LUT creator +lut.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.lut.h +lut.commands = perl $$PWD/create_hash_table ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT} +lut.depend = ${QMAKE_FILE_NAME} +lut.input = LUT_FILES +lut.CONFIG += no_link +addExtraCompiler(lut) + +# GENERATOR 1-B: particular LUT creator (for 1 file only) +keywordlut.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Lexer.lut.h +keywordlut.commands = perl $$PWD/create_hash_table ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT} +keywordlut.depend = ${QMAKE_FILE_NAME} +keywordlut.input = KEYWORDLUT_FILES +keywordlut.CONFIG += no_link +addExtraCompiler(keywordlut) + +# GENERATOR 2: bison grammar +jscbison.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp +jscbison.commands = bison -d -p jscyy ${QMAKE_FILE_NAME} -o $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c && $(MOVE) $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c ${QMAKE_FILE_OUT} && $(MOVE) $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.h $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.h +jscbison.depend = ${QMAKE_FILE_NAME} +jscbison.input = JSCBISON +jscbison.variable_out = GENERATED_SOURCES +jscbison.dependency_type = TYPE_C +jscbison.CONFIG = target_predeps +addExtraCompilerWithHeader(jscbison) + diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index 0d6becb..a1affd4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -52,11 +52,17 @@ win32-g++ { QMAKE_LIBDIR_POST += $$split(TMPPATH,";") } +DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 + DEFINES += WTF_CHANGES=1 include(JavaScriptCore.pri) QMAKE_EXTRA_TARGETS += generated_files +lessThan(QT_MINOR_VERSION, 4) { + DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" +} + *-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 *-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp index 6dd2b87..1324586 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" @@ -34,6 +34,39 @@ namespace JSC { // Patching helpers +ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool) +{ + // Must be an ldr ..., [pc +/- imm] + ASSERT((*insn & 0x0f7f0000) == 0x051f0000); + + if (constPool && (*insn & 0x1)) + return reinterpret_cast(constPool + ((*insn & SDT_OFFSET_MASK) >> 1)); + + ARMWord addr = reinterpret_cast(insn) + 2 * sizeof(ARMWord); + if (*insn & DT_UP) + return reinterpret_cast(addr + (*insn & SDT_OFFSET_MASK)); + else + return reinterpret_cast(addr - (*insn & SDT_OFFSET_MASK)); +} + +void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool) +{ + ARMWord* insn = reinterpret_cast(code) + (from.m_offset / sizeof(ARMWord)); + + if (!useConstantPool) { + int diff = reinterpret_cast(to) - reinterpret_cast(insn + 2); + + if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { + *insn = B | getConditionalField(*insn) | (diff & BRANCH_MASK); + ExecutableAllocator::cacheFlush(insn, sizeof(ARMWord)); + return; + } + } + ARMWord* addr = getLdrImmAddress(insn); + *addr = reinterpret_cast(to); + ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord)); +} + void ARMAssembler::patchConstantPoolLoad(void* loadAddr, void* constPoolAddr) { ARMWord *ldr = reinterpret_cast(loadAddr); @@ -85,7 +118,7 @@ ARMWord ARMAssembler::getOp2(ARMWord imm) if ((imm & 0x00ffffff) == 0) return OP2_IMM | (imm >> 24) | (rol << 8); - return INVALID_IMM; + return 0; } int ARMAssembler::genInt(int reg, ARMWord imm, bool positive) @@ -203,18 +236,25 @@ ARMWord ARMAssembler::getImm(ARMWord imm, int tmpReg, bool invert) // Do it by 1 instruction tmp = getOp2(imm); - if (tmp != INVALID_IMM) + if (tmp) return tmp; tmp = getOp2(~imm); - if (tmp != INVALID_IMM) { + if (tmp) { if (invert) return tmp | OP2_INV_IMM; mvn_r(tmpReg, tmp); return tmpReg; } - return encodeComplexImm(imm, tmpReg); + // Do it by 2 instruction + if (genInt(tmpReg, imm, true)) + return tmpReg; + if (genInt(tmpReg, ~imm, false)) + return tmpReg; + + ldr_imm(tmpReg, imm); + return tmpReg; } void ARMAssembler::moveImm(ARMWord imm, int dest) @@ -223,41 +263,24 @@ void ARMAssembler::moveImm(ARMWord imm, int dest) // Do it by 1 instruction tmp = getOp2(imm); - if (tmp != INVALID_IMM) { + if (tmp) { mov_r(dest, tmp); return; } tmp = getOp2(~imm); - if (tmp != INVALID_IMM) { + if (tmp) { mvn_r(dest, tmp); return; } - encodeComplexImm(imm, dest); -} - -ARMWord ARMAssembler::encodeComplexImm(ARMWord imm, int dest) -{ -#if WTF_ARM_ARCH_AT_LEAST(7) - ARMWord tmp = getImm16Op2(imm); - if (tmp != INVALID_IMM) { - movw_r(dest, tmp); - return dest; - } - movw_r(dest, getImm16Op2(imm & 0xffff)); - movt_r(dest, getImm16Op2(imm >> 16)); - return dest; -#else // Do it by 2 instruction if (genInt(dest, imm, true)) - return dest; + return; if (genInt(dest, ~imm, false)) - return dest; + return; ldr_imm(dest, imm); - return dest; -#endif } // Memory load/store helpers @@ -355,17 +378,10 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) // The last bit is set if the constant must be placed on constant pool. int pos = (*iter) & (~0x1); ARMWord* ldrAddr = reinterpret_cast(data + pos); - ARMWord* addr = getLdrImmAddress(ldrAddr); - if (*addr != 0xffffffff) { - if (!(*iter & 1)) { - int diff = reinterpret_cast(data + *addr) - (ldrAddr + DefaultPrefetching); - - if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { - *ldrAddr = B | getConditionalField(*ldrAddr) | (diff & BRANCH_MASK); - continue; - } - } - *addr = reinterpret_cast(data + *addr); + ARMWord offset = *getLdrImmAddress(ldrAddr); + if (offset != 0xffffffff) { + JmpSrc jmpSrc(pos); + linkBranch(data, jmpSrc, data + offset, ((*iter) & 1)); } } @@ -374,4 +390,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) } // namespace JSC -#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h index 6967b37..9f9a450 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h @@ -29,7 +29,7 @@ #include -#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "AssemblerBufferWithConstantPool.h" #include @@ -121,7 +121,6 @@ namespace JSC { MUL = 0x00000090, MULL = 0x00c00090, FADDD = 0x0e300b00, - FDIVD = 0x0e800b00, FSUBD = 0x0e300b40, FMULD = 0x0e200b00, FCMPD = 0x0eb40b40, @@ -134,18 +133,12 @@ namespace JSC { B = 0x0a000000, BL = 0x0b000000, FMSR = 0x0e000a10, - FMRS = 0x0e100a10, FSITOD = 0x0eb80bc0, - FTOSID = 0x0ebd0b40, FMSTAT = 0x0ef1fa10, -#if WTF_ARM_ARCH_AT_LEAST(5) +#if ARM_ARCH_VERSION >= 5 CLZ = 0x016f0f10, BKPT = 0xe120070, #endif -#if WTF_ARM_ARCH_AT_LEAST(7) - MOVW = 0x03000000, - MOVT = 0x03400000, -#endif }; enum { @@ -182,9 +175,6 @@ namespace JSC { padForAlign32 = 0xee120070, }; - static const ARMWord INVALID_IMM = 0xf0000000; - static const int DefaultPrefetching = 2; - class JmpSrc { friend class ARMAssembler; public: @@ -343,20 +333,6 @@ namespace JSC { emitInst(static_cast(cc) | MOV, rd, ARMRegisters::r0, op2); } -#if WTF_ARM_ARCH_AT_LEAST(7) - void movw_r(int rd, ARMWord op2, Condition cc = AL) - { - ASSERT((op2 | 0xf0fff) == 0xf0fff); - m_buffer.putInt(static_cast(cc) | MOVW | RD(rd) | op2); - } - - void movt_r(int rd, ARMWord op2, Condition cc = AL) - { - ASSERT((op2 | 0xf0fff) == 0xf0fff); - m_buffer.putInt(static_cast(cc) | MOVT | RD(rd) | op2); - } -#endif - void movs_r(int rd, ARMWord op2, Condition cc = AL) { emitInst(static_cast(cc) | MOV | SET_CC, rd, ARMRegisters::r0, op2); @@ -402,11 +378,6 @@ namespace JSC { emitInst(static_cast(cc) | FADDD, dd, dn, dm); } - void fdivd_r(int dd, int dn, int dm, Condition cc = AL) - { - emitInst(static_cast(cc) | FDIVD, dd, dn, dm); - } - void fsubd_r(int dd, int dn, int dm, Condition cc = AL) { emitInst(static_cast(cc) | FSUBD, dd, dn, dm); @@ -511,27 +482,17 @@ namespace JSC { emitInst(static_cast(cc) | FMSR, rn, dd, 0); } - void fmrs_r(int rd, int dn, Condition cc = AL) - { - emitInst(static_cast(cc) | FMRS, rd, dn, 0); - } - void fsitod_r(int dd, int dm, Condition cc = AL) { emitInst(static_cast(cc) | FSITOD, dd, 0, dm); } - void ftosid_r(int fd, int dm, Condition cc = AL) - { - emitInst(static_cast(cc) | FTOSID, fd, 0, dm); - } - void fmstat(Condition cc = AL) { m_buffer.putInt(static_cast(cc) | FMSTAT); } -#if WTF_ARM_ARCH_AT_LEAST(5) +#if ARM_ARCH_VERSION >= 5 void clz_r(int rd, int rm, Condition cc = AL) { m_buffer.putInt(static_cast(cc) | CLZ | RD(rd) | RM(rm)); @@ -540,7 +501,7 @@ namespace JSC { void bkpt(ARMWord value) { -#if WTF_ARM_ARCH_AT_LEAST(5) +#if ARM_ARCH_VERSION >= 5 m_buffer.putInt(BKPT | ((value & 0xff0) << 4) | (value & 0xf)); #else // Cannot access to Zero memory address @@ -633,32 +594,15 @@ namespace JSC { // Patching helpers - static ARMWord* getLdrImmAddress(ARMWord* insn) - { - // Must be an ldr ..., [pc +/- imm] - ASSERT((*insn & 0x0f7f0000) == 0x051f0000); - - ARMWord addr = reinterpret_cast(insn) + DefaultPrefetching * sizeof(ARMWord); - if (*insn & DT_UP) - return reinterpret_cast(addr + (*insn & SDT_OFFSET_MASK)); - return reinterpret_cast(addr - (*insn & SDT_OFFSET_MASK)); - } - - static ARMWord* getLdrImmAddressOnPool(ARMWord* insn, uint32_t* constPool) - { - // Must be an ldr ..., [pc +/- imm] - ASSERT((*insn & 0x0f7f0000) == 0x051f0000); - - if (*insn & 0x1) - return reinterpret_cast(constPool + ((*insn & SDT_OFFSET_MASK) >> 1)); - return getLdrImmAddress(insn); - } + static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0); + static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0); static void patchPointerInternal(intptr_t from, void* to) { ARMWord* insn = reinterpret_cast(from); ARMWord* addr = getLdrImmAddress(insn); *addr = reinterpret_cast(to); + ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord)); } static ARMWord patchConstantPoolLoad(ARMWord load, ARMWord value) @@ -703,13 +647,12 @@ namespace JSC { void linkJump(JmpSrc from, JmpDst to) { ARMWord* insn = reinterpret_cast(m_buffer.data()) + (from.m_offset / sizeof(ARMWord)); - ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress()); - *addr = static_cast(to.m_offset); + *getLdrImmAddress(insn, m_buffer.poolAddress()) = static_cast(to.m_offset); } static void linkJump(void* code, JmpSrc from, void* to) { - patchPointerInternal(reinterpret_cast(code) + from.m_offset, to); + linkBranch(code, from, to); } static void relinkJump(void* from, void* to) @@ -719,12 +662,12 @@ namespace JSC { static void linkCall(void* code, JmpSrc from, void* to) { - patchPointerInternal(reinterpret_cast(code) + from.m_offset, to); + linkBranch(code, from, to, true); } static void relinkCall(void* from, void* to) { - patchPointerInternal(reinterpret_cast(from) - sizeof(ARMWord), to); + relinkJump(from, to); } // Address operations @@ -765,18 +708,8 @@ namespace JSC { } static ARMWord getOp2(ARMWord imm); - -#if WTF_ARM_ARCH_AT_LEAST(7) - static ARMWord getImm16Op2(ARMWord imm) - { - if (imm <= 0xffff) - return (imm & 0xf000) << 4 | (imm & 0xfff); - return INVALID_IMM; - } -#endif ARMWord getImm(ARMWord imm, int tmpReg, bool invert = false); void moveImm(ARMWord imm, int dest); - ARMWord encodeComplexImm(ARMWord imm, int dest); // Memory load/store helpers @@ -831,6 +764,6 @@ namespace JSC { } // namespace JSC -#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index 4e394b2..02ce2e9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #include "AssemblerBuffer.h" #include @@ -201,10 +201,10 @@ class ARMThumbImmediate { ALWAYS_INLINE static void countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N) { - if (value & ~((1 << N) - 1)) /* check for any of the top N bits (of 2N bits) are set */ - value >>= N; /* if any were set, lose the bottom N */ - else /* if none of the top N bits are set, */ - zeros += N; /* then we have identified N leading zeros */ + if (value & ~((1<>= N; /* if any were set, lose the bottom N */ \ + else /* if none of the top N bits are set, */ \ + zeros += N; /* then we have identified N leading zeros */ } static int32_t countLeadingZeros(uint32_t value) @@ -236,11 +236,6 @@ class ARMThumbImmediate { ARMThumbImmediate(ThumbImmediateType type, uint16_t value) : m_type(TypeUInt16) { - // Make sure this constructor is only reached with type TypeUInt16; - // this extra parameter makes the code a little clearer by making it - // explicit at call sites which type is being constructed - ASSERT_UNUSED(type, type == TypeUInt16); - m_value.asInt = value; } @@ -1832,6 +1827,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h index 198e8d1..525fe98 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -173,16 +173,16 @@ public: struct Imm32 { explicit Imm32(int32_t value) : m_value(value) -#if CPU(ARM) +#if PLATFORM(ARM) , m_isPointer(false) #endif { } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) explicit Imm32(ImmPtr ptr) : m_value(ptr.asIntptr()) -#if CPU(ARM) +#if PLATFORM(ARM) , m_isPointer(true) #endif { @@ -190,7 +190,7 @@ public: #endif int32_t m_value; -#if CPU(ARM) +#if PLATFORM(ARM) // We rely on being able to regenerate code to recover exception handling // information. Since ARMv7 supports 16-bit immediates there is a danger // that if pointer values change the layout of the generated code will change. diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h index 76bd205..2743ab4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h @@ -30,19 +30,19 @@ #if ENABLE(ASSEMBLER) -#if CPU(ARM_THUMB2) +#if PLATFORM(ARM_THUMB2) #include "MacroAssemblerARMv7.h" namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; }; -#elif CPU(ARM_TRADITIONAL) +#elif PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; }; -#elif CPU(X86) +#elif PLATFORM(X86) #include "MacroAssemblerX86.h" namespace JSC { typedef MacroAssemblerX86 MacroAssemblerBase; }; -#elif CPU(X86_64) +#elif PLATFORM(X86_64) #include "MacroAssemblerX86_64.h" namespace JSC { typedef MacroAssemblerX86_64 MacroAssemblerBase; }; @@ -60,7 +60,7 @@ public: using MacroAssemblerBase::jump; using MacroAssemblerBase::branch32; using MacroAssemblerBase::branch16; -#if CPU(X86_64) +#if PLATFORM(X86_64) using MacroAssemblerBase::branchPtr; using MacroAssemblerBase::branchTestPtr; #endif @@ -133,8 +133,7 @@ public: // Ptr methods // On 32-bit platforms (i.e. x86), these methods directly map onto their 32-bit equivalents. - // FIXME: should this use a test for 32-bitness instead of this specific exception? -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void addPtr(RegisterID src, RegisterID dest) { add32(src, dest); @@ -180,6 +179,16 @@ public: or32(imm, dest); } + void rshiftPtr(RegisterID shift_amount, RegisterID dest) + { + rshift32(shift_amount, dest); + } + + void rshiftPtr(Imm32 imm, RegisterID dest) + { + rshift32(imm, dest); + } + void subPtr(RegisterID src, RegisterID dest) { sub32(src, dest); diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp index b5b20fa..d726ecd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -26,11 +26,11 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" -#if OS(LINUX) +#if PLATFORM(LINUX) #include #include #include @@ -43,7 +43,7 @@ namespace JSC { static bool isVFPPresent() { -#if OS(LINUX) +#if PLATFORM(LINUX) int fd = open("/proc/self/auxv", O_RDONLY); if (fd > 0) { Elf32_auxv_t aux; @@ -62,8 +62,7 @@ static bool isVFPPresent() const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); -#if CPU(ARMV5_OR_LOWER) -/* On ARMv5 and below, natural alignment is required. */ +#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) { ARMWord op2; @@ -92,4 +91,4 @@ void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, Register } -#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index 21b8de8..7a72b06 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -30,7 +30,7 @@ #include -#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #include "ARMAssembler.h" #include "AbstractMacroAssembler.h" @@ -38,9 +38,6 @@ namespace JSC { class MacroAssemblerARM : public AbstractMacroAssembler { - static const int DoubleConditionMask = 0x0f; - static const int DoubleConditionBitSpecial = 0x10; - COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes); public: enum Condition { Equal = ARMAssembler::EQ, @@ -60,20 +57,11 @@ public: }; enum DoubleCondition { - // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. DoubleEqual = ARMAssembler::EQ, - DoubleNotEqual = ARMAssembler::NE | DoubleConditionBitSpecial, DoubleGreaterThan = ARMAssembler::GT, DoubleGreaterThanOrEqual = ARMAssembler::GE, - DoubleLessThan = ARMAssembler::CC, - DoubleLessThanOrEqual = ARMAssembler::LS, - // If either operand is NaN, these conditions always evaluate to true. - DoubleEqualOrUnordered = ARMAssembler::EQ | DoubleConditionBitSpecial, - DoubleNotEqualOrUnordered = ARMAssembler::NE, - DoubleGreaterThanOrUnordered = ARMAssembler::HI, - DoubleGreaterThanOrEqualOrUnordered = ARMAssembler::CS, - DoubleLessThanOrUnordered = ARMAssembler::LT, - DoubleLessThanOrEqualOrUnordered = ARMAssembler::LE, + DoubleLessThan = ARMAssembler::LT, + DoubleLessThanOrEqual = ARMAssembler::LE, }; static const RegisterID stackPointerRegister = ARMRegisters::sp; @@ -118,18 +106,14 @@ public: m_assembler.ands_r(dest, dest, w); } - void lshift32(RegisterID shift_amount, RegisterID dest) + void lshift32(Imm32 imm, RegisterID dest) { - ARMWord w = ARMAssembler::getOp2(0x1f); - ASSERT(w != ARMAssembler::INVALID_IMM); - m_assembler.and_r(ARMRegisters::S0, shift_amount, w); - - m_assembler.movs_r(dest, m_assembler.lsl_r(dest, ARMRegisters::S0)); + m_assembler.movs_r(dest, m_assembler.lsl(dest, imm.m_value & 0x1f)); } - void lshift32(Imm32 imm, RegisterID dest) + void lshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.movs_r(dest, m_assembler.lsl(dest, imm.m_value & 0x1f)); + m_assembler.movs_r(dest, m_assembler.lsl_r(dest, shift_amount)); } void mul32(RegisterID src, RegisterID dest) @@ -147,11 +131,6 @@ public: m_assembler.muls_r(dest, src, ARMRegisters::S0); } - void neg32(RegisterID srcDest) - { - m_assembler.rsbs_r(srcDest, srcDest, ARMAssembler::getOp2(0)); - } - void not32(RegisterID dest) { m_assembler.mvns_r(dest, dest); @@ -169,11 +148,7 @@ public: void rshift32(RegisterID shift_amount, RegisterID dest) { - ARMWord w = ARMAssembler::getOp2(0x1f); - ASSERT(w != ARMAssembler::INVALID_IMM); - m_assembler.and_r(ARMRegisters::S0, shift_amount, w); - - m_assembler.movs_r(dest, m_assembler.asr_r(dest, ARMRegisters::S0)); + m_assembler.movs_r(dest, m_assembler.asr_r(dest, shift_amount)); } void rshift32(Imm32 imm, RegisterID dest) @@ -224,7 +199,7 @@ public: m_assembler.baseIndexTransfer32(true, dest, address.base, address.index, static_cast(address.scale), address.offset); } -#if CPU(ARMV5_OR_LOWER) +#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest); #else void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) @@ -530,13 +505,6 @@ public: return Jump(m_assembler.jmp(ARMCondition(cond))); } - Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) - { - ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); - or32(src, dest); - return Jump(m_assembler.jmp(ARMCondition(cond))); - } - void breakpoint() { m_assembler.bkpt(0); @@ -580,25 +548,6 @@ public: m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } - void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest) - { - // ARM doesn't have byte registers - set32(cond, left, right, dest); - } - - void set8(Condition cond, Address left, RegisterID right, RegisterID dest) - { - // ARM doesn't have byte registers - load32(left, ARMRegisters::S1); - set32(cond, ARMRegisters::S1, right, dest); - } - - void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest) - { - // ARM doesn't have byte registers - set32(cond, left, right, dest); - } - void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest) { load32(address, ARMRegisters::S1); @@ -610,12 +559,6 @@ public: m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } - void setTest8(Condition cond, Address address, Imm32 mask, RegisterID dest) - { - // ARM doesn't have byte registers - setTest32(cond, address, mask, dest); - } - void add32(Imm32 imm, RegisterID src, RegisterID dest) { m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); @@ -723,12 +666,6 @@ public: m_assembler.doubleTransfer(true, dest, address.base, address.offset); } - void loadDouble(void* address, FPRegisterID dest) - { - m_assembler.ldr_un_imm(ARMRegisters::S0, (ARMWord)address); - m_assembler.fdtr_u(true, dest, ARMRegisters::S0, 0); - } - void storeDouble(FPRegisterID src, ImplicitAddress address) { m_assembler.doubleTransfer(false, src, address.base, address.offset); @@ -745,18 +682,6 @@ public: addDouble(ARMRegisters::SD0, dest); } - void divDouble(FPRegisterID src, FPRegisterID dest) - { - m_assembler.fdivd_r(dest, dest, src); - } - - void divDouble(Address src, FPRegisterID dest) - { - ASSERT_NOT_REACHED(); // Untested - loadDouble(src, ARMRegisters::SD0); - divDouble(ARMRegisters::SD0, dest); - } - void subDouble(FPRegisterID src, FPRegisterID dest) { m_assembler.fsubd_r(dest, dest, src); @@ -785,30 +710,11 @@ public: m_assembler.fsitod_r(dest, dest); } - void convertInt32ToDouble(Address src, FPRegisterID dest) - { - ASSERT_NOT_REACHED(); // Untested - // flds does not worth the effort here - load32(src, ARMRegisters::S1); - convertInt32ToDouble(ARMRegisters::S1, dest); - } - - void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) - { - ASSERT_NOT_REACHED(); // Untested - // flds does not worth the effort here - m_assembler.ldr_un_imm(ARMRegisters::S1, (ARMWord)src.m_ptr); - m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0); - convertInt32ToDouble(ARMRegisters::S1, dest); - } - Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { m_assembler.fcmpd_r(left, right); m_assembler.fmstat(); - if (cond & DoubleConditionBitSpecial) - m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::VS); - return Jump(m_assembler.jmp(static_cast(cond & ~DoubleConditionMask))); + return Jump(m_assembler.jmp(static_cast(cond))); } // Truncates 'src' to an integer, and places the resulting 'dest'. @@ -823,29 +729,6 @@ public: return jump(); } - // Convert 'src' to an integer, and places the resulting 'dest'. - // If the result is not representable as a 32 bit value, branch. - // May also branch for some values that are representable in 32 bits - // (specifically, in this case, 0). - void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) - { - m_assembler.ftosid_r(ARMRegisters::SD0, src); - m_assembler.fmrs_r(dest, ARMRegisters::SD0); - - // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. - m_assembler.fsitod_r(ARMRegisters::SD0, ARMRegisters::SD0); - failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, ARMRegisters::SD0)); - - // If the result is zero, it might have been -0.0, and 0.0 equals to -0.0 - failureCases.append(branchTest32(Zero, dest)); - } - - void zeroDouble(FPRegisterID srcDest) - { - m_assembler.mov_r(ARMRegisters::S0, ARMAssembler::getOp2(0)); - convertInt32ToDouble(ARMRegisters::S0, srcDest); - } - protected: ARMAssembler::Condition ARMCondition(Condition cond) { @@ -928,6 +811,6 @@ private: } -#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) #endif // MacroAssemblerARM_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h index 532a9cf..c479517 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -93,21 +93,13 @@ public: Zero = ARMv7Assembler::ConditionEQ, NonZero = ARMv7Assembler::ConditionNE }; + enum DoubleCondition { - // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. DoubleEqual = ARMv7Assembler::ConditionEQ, - DoubleNotEqual = ARMv7Assembler::ConditionVC, // Not the right flag! check for this & handle differently. DoubleGreaterThan = ARMv7Assembler::ConditionGT, DoubleGreaterThanOrEqual = ARMv7Assembler::ConditionGE, DoubleLessThan = ARMv7Assembler::ConditionLO, DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS, - // If either operand is NaN, these conditions always evaluate to true. - DoubleEqualOrUnordered = ARMv7Assembler::ConditionVS, // Not the right flag! check for this & handle differently. - DoubleNotEqualOrUnordered = ARMv7Assembler::ConditionNE, - DoubleGreaterThanOrUnordered = ARMv7Assembler::ConditionHI, - DoubleGreaterThanOrEqualOrUnordered = ARMv7Assembler::ConditionHS, - DoubleLessThanOrUnordered = ARMv7Assembler::ConditionLT, - DoubleLessThanOrEqualOrUnordered = ARMv7Assembler::ConditionLE, }; static const RegisterID stackPointerRegister = ARMRegisters::sp; @@ -197,19 +189,14 @@ public: } } - void lshift32(RegisterID shift_amount, RegisterID dest) + void lshift32(Imm32 imm, RegisterID dest) { - // Clamp the shift to the range 0..31 - ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f); - ASSERT(armImm.isValid()); - m_assembler.ARM_and(dataTempRegister, shift_amount, armImm); - - m_assembler.lsl(dest, dest, dataTempRegister); + m_assembler.lsl(dest, dest, imm.m_value); } - void lshift32(Imm32 imm, RegisterID dest) + void lshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.lsl(dest, dest, imm.m_value & 0x1f); + m_assembler.lsl(dest, dest, shift_amount); } void mul32(RegisterID src, RegisterID dest) @@ -246,17 +233,12 @@ public: void rshift32(RegisterID shift_amount, RegisterID dest) { - // Clamp the shift to the range 0..31 - ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f); - ASSERT(armImm.isValid()); - m_assembler.ARM_and(dataTempRegister, shift_amount, armImm); - - m_assembler.asr(dest, dest, dataTempRegister); + m_assembler.asr(dest, dest, shift_amount); } void rshift32(Imm32 imm, RegisterID dest) { - m_assembler.asr(dest, dest, imm.m_value & 0x1f); + m_assembler.asr(dest, dest, imm.m_value); } void sub32(RegisterID src, RegisterID dest) @@ -549,23 +531,6 @@ public: { m_assembler.vcmp_F64(left, right); m_assembler.vmrs_APSR_nzcv_FPSCR(); - - if (cond == DoubleNotEqual) { - // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump. - Jump unordered = makeBranch(ARMv7Assembler::ConditionVS); - Jump result = makeBranch(ARMv7Assembler::ConditionNE); - unordered.link(this); - return result; - } - if (cond == DoubleEqualOrUnordered) { - Jump unordered = makeBranch(ARMv7Assembler::ConditionVS); - Jump notEqual = makeBranch(ARMv7Assembler::ConditionNE); - unordered.link(this); - // We get here if either unordered, or equal. - Jump result = makeJump(); - notEqual.link(this); - return result; - } return makeBranch(cond); } diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index cae8bf6..3681af8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -37,7 +37,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if CPU(ARM_THUMB2) +#if PLATFORM(ARM_THUMB2) // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded // into the processor are decorated with the bottom bit set, indicating that this is // thumb code (as oposed to 32-bit traditional ARM). The first test checks for both @@ -130,7 +130,7 @@ public: } explicit MacroAssemblerCodePtr(void* value) -#if CPU(ARM_THUMB2) +#if PLATFORM(ARM_THUMB2) // Decorate the pointer as a thumb code pointer. : m_value(reinterpret_cast(value) + 1) #else @@ -147,7 +147,7 @@ public: } void* executableAddress() const { return m_value; } -#if CPU(ARM_THUMB2) +#if PLATFORM(ARM_THUMB2) // To use this pointer as a data address remove the decoration. void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast(m_value) - 1; } #else diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h index ca7c31a..6e96240 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && CPU(X86) +#if ENABLE(ASSEMBLER) && PLATFORM(X86) #include "MacroAssemblerX86Common.h" diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h index 449df86..5ebefa7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -36,10 +36,6 @@ namespace JSC { class MacroAssemblerX86Common : public AbstractMacroAssembler { - static const int DoubleConditionBitInvert = 0x10; - static const int DoubleConditionBitSpecial = 0x20; - static const int DoubleConditionBits = DoubleConditionBitInvert | DoubleConditionBitSpecial; - public: enum Condition { @@ -60,24 +56,13 @@ public: }; enum DoubleCondition { - // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. - DoubleEqual = X86Assembler::ConditionE | DoubleConditionBitSpecial, + DoubleEqual = X86Assembler::ConditionE, DoubleNotEqual = X86Assembler::ConditionNE, DoubleGreaterThan = X86Assembler::ConditionA, DoubleGreaterThanOrEqual = X86Assembler::ConditionAE, - DoubleLessThan = X86Assembler::ConditionA | DoubleConditionBitInvert, - DoubleLessThanOrEqual = X86Assembler::ConditionAE | DoubleConditionBitInvert, - // If either operand is NaN, these conditions always evaluate to true. - DoubleEqualOrUnordered = X86Assembler::ConditionE, - DoubleNotEqualOrUnordered = X86Assembler::ConditionNE | DoubleConditionBitSpecial, - DoubleGreaterThanOrUnordered = X86Assembler::ConditionB | DoubleConditionBitInvert, - DoubleGreaterThanOrEqualOrUnordered = X86Assembler::ConditionBE | DoubleConditionBitInvert, - DoubleLessThanOrUnordered = X86Assembler::ConditionB, - DoubleLessThanOrEqualOrUnordered = X86Assembler::ConditionBE, + DoubleLessThan = X86Assembler::ConditionB, + DoubleLessThanOrEqual = X86Assembler::ConditionBE, }; - COMPILE_ASSERT( - !((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits), - DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes); static const RegisterID stackPointerRegister = X86Registers::esp; @@ -431,35 +416,20 @@ public: void convertInt32ToDouble(Address src, FPRegisterID dest) { - ASSERT(isSSE2Present()); m_assembler.cvtsi2sd_mr(src.offset, src.base, dest); } Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { ASSERT(isSSE2Present()); + m_assembler.ucomisd_rr(right, left); + return Jump(m_assembler.jCC(x86Condition(cond))); + } - if (cond & DoubleConditionBitInvert) - m_assembler.ucomisd_rr(left, right); - else - m_assembler.ucomisd_rr(right, left); - - if (cond == DoubleEqual) { - Jump isUnordered(m_assembler.jp()); - Jump result = Jump(m_assembler.je()); - isUnordered.link(this); - return result; - } else if (cond == DoubleNotEqualOrUnordered) { - Jump isUnordered(m_assembler.jp()); - Jump isEqual(m_assembler.je()); - isUnordered.link(this); - Jump result = jump(); - isEqual.link(this); - return result; - } - - ASSERT(!(cond & DoubleConditionBitSpecial)); - return Jump(m_assembler.jCC(static_cast(cond & ~DoubleConditionBits))); + Jump branchDouble(DoubleCondition cond, FPRegisterID left, Address right) + { + m_assembler.ucomisd_mr(right.offset, right.base, left); + return Jump(m_assembler.jCC(x86Condition(cond))); } // Truncates 'src' to an integer, and places the resulting 'dest'. @@ -473,25 +443,6 @@ public: return branch32(Equal, dest, Imm32(0x80000000)); } - // Convert 'src' to an integer, and places the resulting 'dest'. - // If the result is not representable as a 32 bit value, branch. - // May also branch for some values that are representable in 32 bits - // (specifically, in this case, 0). - void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) - { - ASSERT(isSSE2Present()); - m_assembler.cvttsd2si_rr(src, dest); - - // If the result is zero, it might have been -0.0, and the double comparison won't catch this! - failureCases.append(branchTest32(Zero, dest)); - - // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. - convertInt32ToDouble(dest, fpTemp); - m_assembler.ucomisd_rr(fpTemp, src); - failureCases.append(m_assembler.jp()); - failureCases.append(m_assembler.jne()); - } - void zeroDouble(FPRegisterID srcDest) { ASSERT(isSSE2Present()); @@ -542,7 +493,7 @@ public: m_assembler.movl_i32r(imm.m_value, dest); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void move(RegisterID src, RegisterID dest) { // Note: on 64-bit this is is a full register move; perhaps it would be @@ -558,8 +509,7 @@ public: void swap(RegisterID reg1, RegisterID reg2) { - if (reg1 != reg2) - m_assembler.xchgq_rr(reg1, reg2); + m_assembler.xchgq_rr(reg1, reg2); } void signExtend32ToPtr(RegisterID src, RegisterID dest) @@ -939,13 +889,18 @@ protected: return static_cast(cond); } + X86Assembler::Condition x86Condition(DoubleCondition cond) + { + return static_cast(cond); + } + private: // Only MacroAssemblerX86 should be using the following method; SSE2 is always available on // x86_64, and clients & subclasses of MacroAssembler should be using 'supportsFloatingPoint()'. friend class MacroAssemblerX86; -#if CPU(X86) -#if OS(MAC_OS_X) +#if PLATFORM(X86) +#if PLATFORM(MAC) // All X86 Macs are guaranteed to support at least SSE2, static bool isSSE2Present() @@ -953,7 +908,7 @@ private: return true; } -#else // OS(MAC_OS_X) +#else // PLATFORM(MAC) enum SSE2CheckState { NotCheckedSSE2, @@ -996,8 +951,8 @@ private: static SSE2CheckState s_sse2CheckState; -#endif // OS(MAC_OS_X) -#elif !defined(NDEBUG) // CPU(X86) +#endif // PLATFORM(MAC) +#elif !defined(NDEBUG) // PLATFORM(X86) // On x86-64 we should never be checking for SSE2 in a non-debug build, // but non debug add this method to keep the asserts above happy. diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h index ec93f8c..0f95fe6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && CPU(X86_64) +#if ENABLE(ASSEMBLER) && PLATFORM(X86_64) #include "MacroAssemblerX86Common.h" @@ -192,6 +192,33 @@ public: m_assembler.orq_ir(imm.m_value, dest); } + void rshiftPtr(RegisterID shift_amount, RegisterID dest) + { + // On x86 we can only shift by ecx; if asked to shift by another register we'll + // need rejig the shift amount into ecx first, and restore the registers afterwards. + if (shift_amount != X86Registers::ecx) { + swap(shift_amount, X86Registers::ecx); + + // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx" + if (dest == shift_amount) + m_assembler.sarq_CLr(X86Registers::ecx); + // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx" + else if (dest == X86Registers::ecx) + m_assembler.sarq_CLr(shift_amount); + // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx" + else + m_assembler.sarq_CLr(dest); + + swap(shift_amount, X86Registers::ecx); + } else + m_assembler.sarq_CLr(dest); + } + + void rshiftPtr(Imm32 imm, RegisterID dest) + { + m_assembler.sarq_i8r(imm.m_value, dest); + } + void subPtr(RegisterID src, RegisterID dest) { m_assembler.subq_rr(src, dest); diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h index ab3d05f..cbbaaa5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64)) +#if ENABLE(ASSEMBLER) && (PLATFORM(X86) || PLATFORM(X86_64)) #include "AssemblerBuffer.h" #include @@ -50,7 +50,7 @@ namespace X86Registers { esi, edi, -#if CPU(X86_64) +#if PLATFORM(X86_64) r8, r9, r10, @@ -118,12 +118,12 @@ private: OP_XOR_GvEv = 0x33, OP_CMP_EvGv = 0x39, OP_CMP_GvEv = 0x3B, -#if CPU(X86_64) +#if PLATFORM(X86_64) PRE_REX = 0x40, #endif OP_PUSH_EAX = 0x50, OP_POP_EAX = 0x58, -#if CPU(X86_64) +#if PLATFORM(X86_64) OP_MOVSXD_GvEv = 0x63, #endif PRE_OPERAND_SIZE = 0x66, @@ -296,7 +296,7 @@ public: // Arithmetic operations: -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void adcl_im(int imm, void* addr) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -346,7 +346,7 @@ public: } } -#if CPU(X86_64) +#if PLATFORM(X86_64) void addq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_ADD_EvGv, src, dst); @@ -423,7 +423,7 @@ public: } } -#if CPU(X86_64) +#if PLATFORM(X86_64) void andq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_AND_EvGv, src, dst); @@ -509,7 +509,7 @@ public: } } -#if CPU(X86_64) +#if PLATFORM(X86_64) void orq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_OR_EvGv, src, dst); @@ -575,7 +575,7 @@ public: } } -#if CPU(X86_64) +#if PLATFORM(X86_64) void subq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_SUB_EvGv, src, dst); @@ -641,7 +641,7 @@ public: } } -#if CPU(X86_64) +#if PLATFORM(X86_64) void xorq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_XOR_EvGv, src, dst); @@ -689,7 +689,7 @@ public: m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SHL, dst); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void sarq_CLr(RegisterID dst) { m_formatter.oneByteOp64(OP_GROUP2_EvCL, GROUP2_OP_SAR, dst); @@ -789,7 +789,7 @@ public: m_formatter.immediate32(imm); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void cmpq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_CMP_EvGv, src, dst); @@ -897,7 +897,7 @@ public: m_formatter.immediate32(imm); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void testq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_TEST_EvGv, src, dst); @@ -971,7 +971,7 @@ public: m_formatter.oneByteOp(OP_XCHG_EvGv, src, dst); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void xchgq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_XCHG_EvGv, src, dst); @@ -1001,7 +1001,7 @@ public: void movl_mEAX(void* addr) { m_formatter.oneByteOp(OP_MOV_EAXOv); -#if CPU(X86_64) +#if PLATFORM(X86_64) m_formatter.immediate64(reinterpret_cast(addr)); #else m_formatter.immediate32(reinterpret_cast(addr)); @@ -1038,14 +1038,14 @@ public: void movl_EAXm(void* addr) { m_formatter.oneByteOp(OP_MOV_OvEAX); -#if CPU(X86_64) +#if PLATFORM(X86_64) m_formatter.immediate64(reinterpret_cast(addr)); #else m_formatter.immediate32(reinterpret_cast(addr)); #endif } -#if CPU(X86_64) +#if PLATFORM(X86_64) void movq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_MOV_EvGv, src, dst); @@ -1157,7 +1157,7 @@ public: { m_formatter.oneByteOp(OP_LEA, dst, base, offset); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void leaq_mr(int offset, RegisterID base, RegisterID dst) { m_formatter.oneByteOp64(OP_LEA, dst, base, offset); @@ -1323,7 +1323,7 @@ public: m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, base, offset); } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void cvtsi2sd_mr(void* address, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1343,7 +1343,7 @@ public: m_formatter.twoByteOp(OP2_MOVD_EdVd, (RegisterID)src, dst); } -#if CPU(X86_64) +#if PLATFORM(X86_64) void movq_rr(XMMRegisterID src, RegisterID dst) { m_formatter.prefix(PRE_SSE_66); @@ -1369,7 +1369,7 @@ public: m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, base, offset); } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void movsd_mr(void* address, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1535,7 +1535,7 @@ public: static void repatchLoadPtrToLEA(void* where) { -#if CPU(X86_64) +#if PLATFORM(X86_64) // On x86-64 pointer memory accesses require a 64-bit operand, and as such a REX prefix. // Skip over the prefix byte. where = reinterpret_cast(where) + 1; @@ -1679,7 +1679,7 @@ private: memoryModRM(reg, base, index, scale, offset); } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void oneByteOp(OneByteOpcodeID opcode, int reg, void* address) { m_buffer.ensureSpace(maxInstructionSize); @@ -1722,7 +1722,7 @@ private: memoryModRM(reg, base, index, scale, offset); } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void twoByteOp(TwoByteOpcodeID opcode, int reg, void* address) { m_buffer.ensureSpace(maxInstructionSize); @@ -1732,7 +1732,7 @@ private: } #endif -#if CPU(X86_64) +#if PLATFORM(X86_64) // Quad-word-sized operands: // // Used to format 64-bit operantions, planting a REX.w prefix. @@ -1891,7 +1891,7 @@ private: static const RegisterID noBase = X86Registers::ebp; static const RegisterID hasSib = X86Registers::esp; static const RegisterID noIndex = X86Registers::esp; -#if CPU(X86_64) +#if PLATFORM(X86_64) static const RegisterID noBase2 = X86Registers::r13; static const RegisterID hasSib2 = X86Registers::r12; @@ -1967,7 +1967,7 @@ private: void memoryModRM(int reg, RegisterID base, int offset) { // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there. -#if CPU(X86_64) +#if PLATFORM(X86_64) if ((base == hasSib) || (base == hasSib2)) { #else if (base == hasSib) { @@ -1982,7 +1982,7 @@ private: m_buffer.putIntUnchecked(offset); } } else { -#if CPU(X86_64) +#if PLATFORM(X86_64) if (!offset && (base != noBase) && (base != noBase2)) #else if (!offset && (base != noBase)) @@ -2001,7 +2001,7 @@ private: void memoryModRM_disp32(int reg, RegisterID base, int offset) { // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there. -#if CPU(X86_64) +#if PLATFORM(X86_64) if ((base == hasSib) || (base == hasSib2)) { #else if (base == hasSib) { @@ -2018,7 +2018,7 @@ private: { ASSERT(index != noIndex); -#if CPU(X86_64) +#if PLATFORM(X86_64) if (!offset && (base != noBase) && (base != noBase2)) #else if (!offset && (base != noBase)) @@ -2033,7 +2033,7 @@ private: } } -#if !CPU(X86_64) +#if !PLATFORM(X86_64) void memoryModRM(int reg, void* address) { // noBase + ModRmMemoryNoDisp means noBase + ModRmMemoryDisp32! @@ -2048,6 +2048,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && CPU(X86) +#endif // ENABLE(ASSEMBLER) && PLATFORM(X86) #endif // X86Assembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 68debb2..c915934 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -49,9 +49,9 @@ namespace JSC { static UString escapeQuotes(const UString& str) { UString result = str; - unsigned pos = 0; - while ((pos = result.find('\"', pos)) != UString::NotFound) { - result = makeString(result.substr(0, pos), "\"\\\"\"", result.substr(pos + 1)); + int pos = 0; + while ((pos = result.find('\"', pos)) >= 0) { + result = result.substr(0, pos) + "\"\\\"\"" + result.substr(pos + 1); pos += 4; } return result; @@ -62,50 +62,49 @@ static UString valueToSourceString(ExecState* exec, JSValue val) if (!val) return "0"; - if (val.isString()) - return makeString("\"", escapeQuotes(val.toString(exec)), "\""); + if (val.isString()) { + UString result("\""); + result += escapeQuotes(val.toString(exec)) + "\""; + return result; + } return val.toString(exec); } -static CString constantName(ExecState* exec, int k, JSValue value) +static CString registerName(int r) { - return makeString(valueToSourceString(exec, value), "(@k", UString::from(k - FirstConstantRegisterIndex), ")").UTF8String(); + if (r == missingThisObjectMarker()) + return ""; + + return (UString("r") + UString::from(r)).UTF8String(); } -static CString idName(int id0, const Identifier& ident) +static CString constantName(ExecState* exec, int k, JSValue value) { - return makeString(ident.ustring(), "(@id", UString::from(id0), ")").UTF8String(); + return (valueToSourceString(exec, value) + "(@k" + UString::from(k) + ")").UTF8String(); } -CString CodeBlock::registerName(ExecState* exec, int r) const +static CString idName(int id0, const Identifier& ident) { - if (r == missingThisObjectMarker()) - return ""; - - if (isConstantRegisterIndex(r)) - return constantName(exec, r, getConstant(r)); - - return makeString("r", UString::from(r)).UTF8String(); + return (ident.ustring() + "(@id" + UString::from(id0) +")").UTF8String(); } static UString regexpToSourceString(RegExp* regExp) { - char postfix[5] = { '/', 0, 0, 0, 0 }; - int index = 1; + UString pattern = UString("/") + regExp->pattern() + "/"; if (regExp->global()) - postfix[index++] = 'g'; + pattern += "g"; if (regExp->ignoreCase()) - postfix[index++] = 'i'; + pattern += "i"; if (regExp->multiline()) - postfix[index] = 'm'; + pattern += "m"; - return makeString("/", regExp->pattern(), postfix); + return pattern; } static CString regexpName(int re, RegExp* regexp) { - return makeString(regexpToSourceString(regexp), "(@re", UString::from(re), ")").UTF8String(); + return (regexpToSourceString(regexp) + "(@re" + UString::from(re) + ")").UTF8String(); } static UString pointerToSourceString(void* p) @@ -136,44 +135,44 @@ NEVER_INLINE static const char* debugHookName(int debugHookID) return ""; } -void CodeBlock::printUnaryOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const +static void printUnaryOp(int location, Vector::const_iterator& it, const char* op) { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str()); } -void CodeBlock::printBinaryOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const +static void printBinaryOp(int location, Vector::const_iterator& it, const char* op) { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); + printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); } -void CodeBlock::printConditionalJump(ExecState* exec, const Vector::const_iterator&, Vector::const_iterator& it, int location, const char* op) const +static void printConditionalJump(const Vector::const_iterator&, Vector::const_iterator& it, int location, const char* op) { int r0 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(exec, r0).c_str(), offset, location + offset); + printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, location + offset); } -void CodeBlock::printGetByIdOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const +static void printGetByIdOp(int location, Vector::const_iterator& it, const Vector& m_identifiers, const char* op) { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); it += 4; } -void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const +static void printPutByIdOp(int location, Vector::const_iterator& it, const Vector& m_identifiers, const char* op) { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); it += 4; } @@ -358,7 +357,7 @@ void CodeBlock::dump(ExecState* exec) const unsigned registerIndex = m_numVars; size_t i = 0; do { - printf(" k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii()); + printf(" r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii()); ++i; ++registerIndex; } while (i < m_constantRegisters.size()); @@ -482,7 +481,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_enter_with_activation: { int r0 = (++it)->u.operand; - printf("[%4d] enter_with_activation %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] enter_with_activation %s\n", location, registerName(r0).c_str()); break; } case op_create_arguments: { @@ -495,148 +494,148 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_convert_this: { int r0 = (++it)->u.operand; - printf("[%4d] convert_this %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] convert_this %s\n", location, registerName(r0).c_str()); break; } case op_new_object: { int r0 = (++it)->u.operand; - printf("[%4d] new_object\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] new_object\t %s\n", location, registerName(r0).c_str()); break; } case op_new_array: { int dst = (++it)->u.operand; int argv = (++it)->u.operand; int argc = (++it)->u.operand; - printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, argv).c_str(), argc); + printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(dst).c_str(), registerName(argv).c_str(), argc); break; } case op_new_regexp: { int r0 = (++it)->u.operand; int re0 = (++it)->u.operand; - printf("[%4d] new_regexp\t %s, %s\n", location, registerName(exec, r0).c_str(), regexpName(re0, regexp(re0)).c_str()); + printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexp(re0)).c_str()); break; } case op_mov: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] mov\t\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] mov\t\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); break; } case op_not: { - printUnaryOp(exec, location, it, "not"); + printUnaryOp(location, it, "not"); break; } case op_eq: { - printBinaryOp(exec, location, it, "eq"); + printBinaryOp(location, it, "eq"); break; } case op_eq_null: { - printUnaryOp(exec, location, it, "eq_null"); + printUnaryOp(location, it, "eq_null"); break; } case op_neq: { - printBinaryOp(exec, location, it, "neq"); + printBinaryOp(location, it, "neq"); break; } case op_neq_null: { - printUnaryOp(exec, location, it, "neq_null"); + printUnaryOp(location, it, "neq_null"); break; } case op_stricteq: { - printBinaryOp(exec, location, it, "stricteq"); + printBinaryOp(location, it, "stricteq"); break; } case op_nstricteq: { - printBinaryOp(exec, location, it, "nstricteq"); + printBinaryOp(location, it, "nstricteq"); break; } case op_less: { - printBinaryOp(exec, location, it, "less"); + printBinaryOp(location, it, "less"); break; } case op_lesseq: { - printBinaryOp(exec, location, it, "lesseq"); + printBinaryOp(location, it, "lesseq"); break; } case op_pre_inc: { int r0 = (++it)->u.operand; - printf("[%4d] pre_inc\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] pre_inc\t\t %s\n", location, registerName(r0).c_str()); break; } case op_pre_dec: { int r0 = (++it)->u.operand; - printf("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] pre_dec\t\t %s\n", location, registerName(r0).c_str()); break; } case op_post_inc: { - printUnaryOp(exec, location, it, "post_inc"); + printUnaryOp(location, it, "post_inc"); break; } case op_post_dec: { - printUnaryOp(exec, location, it, "post_dec"); + printUnaryOp(location, it, "post_dec"); break; } case op_to_jsnumber: { - printUnaryOp(exec, location, it, "to_jsnumber"); + printUnaryOp(location, it, "to_jsnumber"); break; } case op_negate: { - printUnaryOp(exec, location, it, "negate"); + printUnaryOp(location, it, "negate"); break; } case op_add: { - printBinaryOp(exec, location, it, "add"); + printBinaryOp(location, it, "add"); ++it; break; } case op_mul: { - printBinaryOp(exec, location, it, "mul"); + printBinaryOp(location, it, "mul"); ++it; break; } case op_div: { - printBinaryOp(exec, location, it, "div"); + printBinaryOp(location, it, "div"); ++it; break; } case op_mod: { - printBinaryOp(exec, location, it, "mod"); + printBinaryOp(location, it, "mod"); break; } case op_sub: { - printBinaryOp(exec, location, it, "sub"); + printBinaryOp(location, it, "sub"); ++it; break; } case op_lshift: { - printBinaryOp(exec, location, it, "lshift"); + printBinaryOp(location, it, "lshift"); break; } case op_rshift: { - printBinaryOp(exec, location, it, "rshift"); + printBinaryOp(location, it, "rshift"); break; } case op_urshift: { - printBinaryOp(exec, location, it, "urshift"); + printBinaryOp(location, it, "urshift"); break; } case op_bitand: { - printBinaryOp(exec, location, it, "bitand"); + printBinaryOp(location, it, "bitand"); ++it; break; } case op_bitxor: { - printBinaryOp(exec, location, it, "bitxor"); + printBinaryOp(location, it, "bitxor"); ++it; break; } case op_bitor: { - printBinaryOp(exec, location, it, "bitor"); + printBinaryOp(location, it, "bitor"); ++it; break; } case op_bitnot: { - printUnaryOp(exec, location, it, "bitnot"); + printUnaryOp(location, it, "bitnot"); break; } case op_instanceof: { @@ -644,59 +643,59 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; int r3 = (++it)->u.operand; - printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str()); + printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str()); break; } case op_typeof: { - printUnaryOp(exec, location, it, "typeof"); + printUnaryOp(location, it, "typeof"); break; } case op_is_undefined: { - printUnaryOp(exec, location, it, "is_undefined"); + printUnaryOp(location, it, "is_undefined"); break; } case op_is_boolean: { - printUnaryOp(exec, location, it, "is_boolean"); + printUnaryOp(location, it, "is_boolean"); break; } case op_is_number: { - printUnaryOp(exec, location, it, "is_number"); + printUnaryOp(location, it, "is_number"); break; } case op_is_string: { - printUnaryOp(exec, location, it, "is_string"); + printUnaryOp(location, it, "is_string"); break; } case op_is_object: { - printUnaryOp(exec, location, it, "is_object"); + printUnaryOp(location, it, "is_object"); break; } case op_is_function: { - printUnaryOp(exec, location, it, "is_function"); + printUnaryOp(location, it, "is_function"); break; } case op_in: { - printBinaryOp(exec, location, it, "in"); + printBinaryOp(location, it, "in"); break; } case op_resolve: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_resolve_skip: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int skipLevels = (++it)->u.operand; - printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); + printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); break; } case op_resolve_global: { int r0 = (++it)->u.operand; JSValue scope = JSValue((++it)->u.jsCell); int id0 = (++it)->u.operand; - printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); it += 2; break; } @@ -704,145 +703,125 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int index = (++it)->u.operand; int skipLevels = (++it)->u.operand; - printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).c_str(), index, skipLevels); + printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(r0).c_str(), index, skipLevels); break; } case op_put_scoped_var: { int index = (++it)->u.operand; int skipLevels = (++it)->u.operand; int r0 = (++it)->u.operand; - printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(exec, r0).c_str()); + printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(r0).c_str()); break; } case op_get_global_var: { int r0 = (++it)->u.operand; JSValue scope = JSValue((++it)->u.jsCell); int index = (++it)->u.operand; - printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), index); + printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), index); break; } case op_put_global_var: { JSValue scope = JSValue((++it)->u.jsCell); int index = (++it)->u.operand; int r0 = (++it)->u.operand; - printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(exec, r0).c_str()); + printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(r0).c_str()); break; } case op_resolve_base: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve_base\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_resolve_with_base: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_get_by_id: { - printGetByIdOp(exec, location, it, "get_by_id"); + printGetByIdOp(location, it, m_identifiers, "get_by_id"); break; } case op_get_by_id_self: { - printGetByIdOp(exec, location, it, "get_by_id_self"); + printGetByIdOp(location, it, m_identifiers, "get_by_id_self"); break; } case op_get_by_id_self_list: { - printGetByIdOp(exec, location, it, "get_by_id_self_list"); + printGetByIdOp(location, it, m_identifiers, "get_by_id_self_list"); break; } case op_get_by_id_proto: { - printGetByIdOp(exec, location, it, "get_by_id_proto"); + printGetByIdOp(location, it, m_identifiers, "get_by_id_proto"); break; } case op_get_by_id_proto_list: { - printGetByIdOp(exec, location, it, "op_get_by_id_proto_list"); + printGetByIdOp(location, it, m_identifiers, "op_get_by_id_proto_list"); break; } case op_get_by_id_chain: { - printGetByIdOp(exec, location, it, "get_by_id_chain"); - break; - } - case op_get_by_id_getter_self: { - printGetByIdOp(exec, location, it, "get_by_id_getter_self"); - break; - } - case op_get_by_id_getter_self_list: { - printGetByIdOp(exec, location, it, "get_by_id_getter_self_list"); - break; - } - case op_get_by_id_getter_proto: { - printGetByIdOp(exec, location, it, "get_by_id_getter_proto"); - break; - } - case op_get_by_id_getter_proto_list: { - printGetByIdOp(exec, location, it, "get_by_id_getter_proto_list"); - break; - } - case op_get_by_id_getter_chain: { - printGetByIdOp(exec, location, it, "get_by_id_getter_chain"); + printGetByIdOp(location, it, m_identifiers, "get_by_id_chain"); break; } case op_get_by_id_generic: { - printGetByIdOp(exec, location, it, "get_by_id_generic"); + printGetByIdOp(location, it, m_identifiers, "get_by_id_generic"); break; } case op_get_array_length: { - printGetByIdOp(exec, location, it, "get_array_length"); + printGetByIdOp(location, it, m_identifiers, "get_array_length"); break; } case op_get_string_length: { - printGetByIdOp(exec, location, it, "get_string_length"); + printGetByIdOp(location, it, m_identifiers, "get_string_length"); break; } case op_put_by_id: { - printPutByIdOp(exec, location, it, "put_by_id"); + printPutByIdOp(location, it, m_identifiers, "put_by_id"); break; } case op_put_by_id_replace: { - printPutByIdOp(exec, location, it, "put_by_id_replace"); + printPutByIdOp(location, it, m_identifiers, "put_by_id_replace"); break; } case op_put_by_id_transition: { - printPutByIdOp(exec, location, it, "put_by_id_transition"); + printPutByIdOp(location, it, m_identifiers, "put_by_id_transition"); break; } case op_put_by_id_generic: { - printPutByIdOp(exec, location, it, "put_by_id_generic"); + printPutByIdOp(location, it, m_identifiers, "put_by_id_generic"); break; } case op_put_getter: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); break; } case op_put_setter: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); break; } case op_method_check: { - printf("[%4d] method_check\n", location); + printf("[%4d] op_method_check\n", location); break; } case op_del_by_id: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_get_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); + printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); break; } case op_get_by_pname: { @@ -852,28 +831,28 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r3 = (++it)->u.operand; int r4 = (++it)->u.operand; int r5 = (++it)->u.operand; - printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), registerName(exec, r4).c_str(), registerName(exec, r5).c_str()); + printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), registerName(r4).c_str(), registerName(r5).c_str()); break; } case op_put_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); + printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); break; } case op_del_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); + printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); break; } case op_put_by_index: { int r0 = (++it)->u.operand; unsigned n0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(exec, r0).c_str(), n0, registerName(exec, r1).c_str()); + printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(r0).c_str(), n0, registerName(r1).c_str()); break; } case op_jmp: { @@ -887,102 +866,91 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& break; } case op_jtrue: { - printConditionalJump(exec, begin, it, location, "jtrue"); + printConditionalJump(begin, it, location, "jtrue"); break; } case op_loop_if_true: { - printConditionalJump(exec, begin, it, location, "loop_if_true"); - break; - } - case op_loop_if_false: { - printConditionalJump(exec, begin, it, location, "loop_if_false"); + printConditionalJump(begin, it, location, "loop_if_true"); break; } case op_jfalse: { - printConditionalJump(exec, begin, it, location, "jfalse"); + printConditionalJump(begin, it, location, "jfalse"); break; } case op_jeq_null: { - printConditionalJump(exec, begin, it, location, "jeq_null"); + printConditionalJump(begin, it, location, "jeq_null"); break; } case op_jneq_null: { - printConditionalJump(exec, begin, it, location, "jneq_null"); + printConditionalJump(begin, it, location, "jneq_null"); break; } case op_jneq_ptr: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_jnless: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_jnlesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_loop_if_less: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); - break; - } - case op_jless: { - int r0 = (++it)->u.operand; - int r1 = (++it)->u.operand; - int offset = (++it)->u.operand; - printf("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_loop_if_lesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_switch_imm: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); + printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_switch_char: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); + printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_switch_string: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); + printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_new_func: { int r0 = (++it)->u.operand; int f0 = (++it)->u.operand; - printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); + printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(r0).c_str(), f0); break; } case op_new_func_exp: { int r0 = (++it)->u.operand; int f0 = (++it)->u.operand; - printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); + printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(r0).c_str(), f0); break; } case op_call: { @@ -990,7 +958,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); + printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset); break; } case op_call_eval: { @@ -998,7 +966,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); + printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset); break; } case op_call_varargs: { @@ -1006,16 +974,16 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), registerName(exec, argCount).c_str(), registerOffset); + printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), registerName(argCount).c_str(), registerOffset); break; } case op_load_varargs: { - printUnaryOp(exec, location, it, "load_varargs"); + printUnaryOp(location, it, "load_varargs"); break; } case op_tear_off_activation: { int r0 = (++it)->u.operand; - printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] tear_off_activation\t %s\n", location, registerName(r0).c_str()); break; } case op_tear_off_arguments: { @@ -1024,7 +992,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_ret: { int r0 = (++it)->u.operand; - printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] ret\t\t %s\n", location, registerName(r0).c_str()); break; } case op_construct: { @@ -1034,26 +1002,26 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int registerOffset = (++it)->u.operand; int proto = (++it)->u.operand; int thisRegister = (++it)->u.operand; - printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset, registerName(exec, proto).c_str(), registerName(exec, thisRegister).c_str()); + printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset, registerName(proto).c_str(), registerName(thisRegister).c_str()); break; } case op_construct_verify: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] construct_verify\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); break; } case op_strcat: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int count = (++it)->u.operand; - printf("[%4d] strcat\t\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), count); + printf("[%4d] op_strcat\t %s, %s, %d\n", location, registerName(r0).c_str(), registerName(r1).c_str(), count); break; } case op_to_primitive: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] to_primitive\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] op_to_primitive\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); break; } case op_get_pnames: { @@ -1062,7 +1030,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r2 = it[3].u.operand; int r3 = it[4].u.operand; int offset = it[5].u.operand; - printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), offset, location + offset); + printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_get_pnames) - 1; break; } @@ -1070,13 +1038,13 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int dest = it[1].u.operand; int iter = it[4].u.operand; int offset = it[5].u.operand; - printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(exec, dest).c_str(), registerName(exec, iter).c_str(), offset, location + offset); + printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_next_pname) - 1; break; } case op_push_scope: { int r0 = (++it)->u.operand; - printf("[%4d] push_scope\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] push_scope\t %s\n", location, registerName(r0).c_str()); break; } case op_pop_scope: { @@ -1087,7 +1055,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); + printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); break; } case op_jmp_scopes: { @@ -1098,30 +1066,30 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_catch: { int r0 = (++it)->u.operand; - printf("[%4d] catch\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] catch\t\t %s\n", location, registerName(r0).c_str()); break; } case op_throw: { int r0 = (++it)->u.operand; - printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] throw\t\t %s\n", location, registerName(r0).c_str()); break; } case op_new_error: { int r0 = (++it)->u.operand; int errorType = (++it)->u.operand; int k0 = (++it)->u.operand; - printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(exec, r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str()); + printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str()); break; } case op_jsr: { int retAddrDst = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(exec, retAddrDst).c_str(), offset, location + offset); + printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, location + offset); break; } case op_sret: { int retAddrSrc = (++it)->u.operand; - printf("[%4d] sret\t\t %s\n", location, registerName(exec, retAddrSrc).c_str()); + printf("[%4d] sret\t\t %s\n", location, registerName(retAddrSrc).c_str()); break; } case op_debug: { @@ -1133,17 +1101,17 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_profile_will_call: { int function = (++it)->u.operand; - printf("[%4d] profile_will_call %s\n", location, registerName(exec, function).c_str()); + printf("[%4d] profile_will_call %s\n", location, registerName(function).c_str()); break; } case op_profile_did_call: { int function = (++it)->u.operand; - printf("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).c_str()); + printf("[%4d] profile_did_call\t %s\n", location, registerName(function).c_str()); break; } case op_end: { int r0 = (++it)->u.operand; - printf("[%4d] end\t\t %s\n", location, registerName(exec, r0).c_str()); + printf("[%4d] end\t\t %s\n", location, registerName(r0).c_str()); break; } } @@ -1375,16 +1343,16 @@ void CodeBlock::derefStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { vPC[4].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { vPC[4].u.structure->deref(); vPC[5].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { vPC[4].u.structure->deref(); vPC[5].u.structureChain->deref(); return; @@ -1405,9 +1373,7 @@ void CodeBlock::derefStructures(Instruction* vPC) const return; } if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) - || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list)) - || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto_list)) - || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self_list))) { + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list))) { PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures; polymorphicStructures->derefStructures(vPC[5].u.operand); delete polymorphicStructures; @@ -1422,16 +1388,16 @@ void CodeBlock::refStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { vPC[4].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { vPC[4].u.structure->ref(); vPC[5].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { vPC[4].u.structure->ref(); vPC[5].u.structureChain->ref(); return; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h index d92dc9d..4ba58d7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h @@ -36,6 +36,7 @@ #include "JSGlobalObject.h" #include "JumpTable.h" #include "Nodes.h" +#include "PtrAndFlags.h" #include "RegExp.h" #include "UString.h" #include @@ -109,54 +110,44 @@ namespace JSC { CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; - CodeBlock* ownerCodeBlock; + PtrAndFlags ownerCodeBlock; CodeBlock* callee; - unsigned position : 31; - unsigned hasSeenShouldRepatch : 1; + unsigned position; void setUnlinked() { callee = 0; } bool isLinked() { return callee; } bool seenOnce() { - return hasSeenShouldRepatch; + return ownerCodeBlock.isFlagSet(hasSeenShouldRepatch); } void setSeen() { - hasSeenShouldRepatch = true; + ownerCodeBlock.setFlag(hasSeenShouldRepatch); } }; struct MethodCallLinkInfo { MethodCallLinkInfo() : cachedStructure(0) - , cachedPrototypeStructure(0) { } bool seenOnce() { - ASSERT(!cachedStructure); - return cachedPrototypeStructure; + return cachedPrototypeStructure.isFlagSet(hasSeenShouldRepatch); } void setSeen() { - ASSERT(!cachedStructure && !cachedPrototypeStructure); - // We use the values of cachedStructure & cachedPrototypeStructure to indicate the - // current state. - // - In the initial state, both are null. - // - Once this transition has been taken once, cachedStructure is - // null and cachedPrototypeStructure is set to a nun-null value. - // - Once the call is linked both structures are set to non-null values. - cachedPrototypeStructure = (Structure*)1; + cachedPrototypeStructure.setFlag(hasSeenShouldRepatch); } CodeLocationCall callReturnLocation; CodeLocationDataLabelPtr structureLabel; Structure* cachedStructure; - Structure* cachedPrototypeStructure; + PtrAndFlags cachedPrototypeStructure; }; struct FunctionRegisterInfo { @@ -447,7 +438,7 @@ namespace JSC { size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); } void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); } Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } - ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } + ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; } ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } unsigned addFunctionDecl(NonNullPassRefPtr n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; } @@ -491,13 +482,6 @@ namespace JSC { private: #if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) void dump(ExecState*, const Vector::const_iterator& begin, Vector::const_iterator&) const; - - CString registerName(ExecState*, int r) const; - void printUnaryOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; - void printBinaryOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; - void printConditionalJump(ExecState*, const Vector::const_iterator&, Vector::const_iterator&, int location, const char* op) const; - void printGetByIdOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; - void printPutByIdOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; #endif void reparseForExceptionInfoIfNecessary(CallFrame*); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h index a036dd4..05834fc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h @@ -65,7 +65,7 @@ namespace JSC { bool isEmpty() const { return m_cacheMap.isEmpty(); } private: - static const unsigned maxCacheableSourceLength = 256; + static const int maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; typedef HashMap, RefPtr > EvalCacheMap; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 56555f3..4facbef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -104,11 +104,6 @@ namespace JSC { macro(op_get_by_id_proto, 8) \ macro(op_get_by_id_proto_list, 8) \ macro(op_get_by_id_chain, 8) \ - macro(op_get_by_id_getter_self, 8) \ - macro(op_get_by_id_getter_self_list, 8) \ - macro(op_get_by_id_getter_proto, 8) \ - macro(op_get_by_id_getter_proto_list, 8) \ - macro(op_get_by_id_getter_chain, 8) \ macro(op_get_by_id_generic, 8) \ macro(op_get_array_length, 8) \ macro(op_get_string_length, 8) \ @@ -133,11 +128,9 @@ namespace JSC { macro(op_jneq_ptr, 4) \ macro(op_jnless, 4) \ macro(op_jnlesseq, 4) \ - macro(op_jless, 4) \ macro(op_jmp_scopes, 3) \ macro(op_loop, 2) \ macro(op_loop_if_true, 3) \ - macro(op_loop_if_false, 3) \ macro(op_loop_if_less, 4) \ macro(op_loop_if_lesseq, 4) \ macro(op_switch_imm, 4) \ @@ -201,12 +194,8 @@ namespace JSC { #undef VERIFY_OPCODE_ID #if HAVE(COMPUTED_GOTO) -#if COMPILER(RVCT) typedef void* Opcode; #else - typedef const void* Opcode; -#endif -#else typedef OpcodeID Opcode; #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp index 3f0babc..865c919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp @@ -33,7 +33,7 @@ #include "Interpreter.h" #include "Opcode.h" -#if !OS(WINDOWS) +#if !PLATFORM(WIN_OS) #include #endif @@ -91,7 +91,7 @@ void SamplingFlags::stop() {} uint32_t SamplingFlags::s_flags = 1 << 15; -#if OS(WINDOWS) +#if PLATFORM(WIN_OS) static void sleepForMicroseconds(unsigned us) { diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index f2193b0..04dae15 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -616,7 +616,7 @@ PassRefPtr