From 6a98b8c0b5ffe1a23902cdf7e692f702b703eaeb Mon Sep 17 00:00:00 2001 From: "borenet@google.com" Date: Mon, 6 May 2013 12:50:00 +0000 Subject: [PATCH] Copy NaCl directory into trunk/platform_tools, adjust paths (SkipBuildbotRuns) R=djsollen@google.com Review URL: https://codereview.chromium.org/14771017 git-svn-id: http://skia.googlecode.com/svn/trunk@9008 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/debugger.gyp | 2 +- gyp/nacl.gyp | 2 +- platform_tools/nacl/SampleApp/SampleApp.nmf | 6 + platform_tools/nacl/SampleApp/index.html | 71 ++++ platform_tools/nacl/debugger/debugger.css | 172 ++++++++ platform_tools/nacl/debugger/debugger.nmf | 6 + platform_tools/nacl/debugger/icons/blank.png | Bin 0 -> 146 bytes platform_tools/nacl/debugger/icons/breakpoint.png | Bin 0 -> 2247 bytes .../nacl/debugger/icons/breakpoint_16x16.png | Bin 0 -> 1108 bytes platform_tools/nacl/debugger/icons/delete.png | Bin 0 -> 1415 bytes platform_tools/nacl/debugger/icons/inspector.png | Bin 0 -> 1960 bytes platform_tools/nacl/debugger/icons/next.png | Bin 0 -> 938 bytes platform_tools/nacl/debugger/icons/pause.png | Bin 0 -> 1181 bytes platform_tools/nacl/debugger/icons/play.png | Bin 0 -> 1073 bytes platform_tools/nacl/debugger/icons/previous.png | Bin 0 -> 943 bytes platform_tools/nacl/debugger/icons/profile.png | Bin 0 -> 243 bytes platform_tools/nacl/debugger/icons/reload.png | Bin 0 -> 1932 bytes platform_tools/nacl/debugger/icons/rewind.png | Bin 0 -> 1105 bytes platform_tools/nacl/debugger/icons/skia.png | Bin 0 -> 1054 bytes platform_tools/nacl/debugger/index.html | 468 +++++++++++++++++++++ platform_tools/nacl/favicon.ico | Bin 0 -> 318 bytes platform_tools/nacl/gclient.config | 13 + platform_tools/nacl/httpd.py | 212 ++++++++++ platform_tools/nacl/index.html | 22 + platform_tools/nacl/nacl_make | 104 +++++ platform_tools/nacl/src/nacl_debugger.cpp | 221 ++++++++++ platform_tools/nacl/src/nacl_interface.cpp | 111 +++++ platform_tools/nacl/src/nacl_sample.cpp | 212 ++++++++++ platform_tools/nacl/tests/index.html | 78 ++++ platform_tools/nacl/tests/tests.nmf | 6 + 30 files changed, 1704 insertions(+), 2 deletions(-) create mode 100644 platform_tools/nacl/SampleApp/SampleApp.nmf create mode 100644 platform_tools/nacl/SampleApp/index.html create mode 100644 platform_tools/nacl/debugger/debugger.css create mode 100644 platform_tools/nacl/debugger/debugger.nmf create mode 100644 platform_tools/nacl/debugger/icons/blank.png create mode 100644 platform_tools/nacl/debugger/icons/breakpoint.png create mode 100644 platform_tools/nacl/debugger/icons/breakpoint_16x16.png create mode 100644 platform_tools/nacl/debugger/icons/delete.png create mode 100644 platform_tools/nacl/debugger/icons/inspector.png create mode 100644 platform_tools/nacl/debugger/icons/next.png create mode 100644 platform_tools/nacl/debugger/icons/pause.png create mode 100644 platform_tools/nacl/debugger/icons/play.png create mode 100644 platform_tools/nacl/debugger/icons/previous.png create mode 100644 platform_tools/nacl/debugger/icons/profile.png create mode 100644 platform_tools/nacl/debugger/icons/reload.png create mode 100644 platform_tools/nacl/debugger/icons/rewind.png create mode 100644 platform_tools/nacl/debugger/icons/skia.png create mode 100644 platform_tools/nacl/debugger/index.html create mode 100644 platform_tools/nacl/favicon.ico create mode 100644 platform_tools/nacl/gclient.config create mode 100755 platform_tools/nacl/httpd.py create mode 100644 platform_tools/nacl/index.html create mode 100755 platform_tools/nacl/nacl_make create mode 100644 platform_tools/nacl/src/nacl_debugger.cpp create mode 100644 platform_tools/nacl/src/nacl_interface.cpp create mode 100644 platform_tools/nacl/src/nacl_sample.cpp create mode 100644 platform_tools/nacl/tests/index.html create mode 100644 platform_tools/nacl/tests/tests.nmf diff --git a/gyp/debugger.gyp b/gyp/debugger.gyp index 40c0f35..b935fb0 100644 --- a/gyp/debugger.gyp +++ b/gyp/debugger.gyp @@ -109,7 +109,7 @@ '../src/utils', ], 'sources': [ - '../../nacl/src/nacl_debugger.cpp', + '../platform_tools/nacl/src/nacl_debugger.cpp', ], }, { # skia_os != "nacl" 'include_dirs': [ diff --git a/gyp/nacl.gyp b/gyp/nacl.gyp index 5edb445..484570b 100644 --- a/gyp/nacl.gyp +++ b/gyp/nacl.gyp @@ -12,7 +12,7 @@ '../src/utils', ], 'sources': [ - '../../nacl/src/nacl_interface.cpp', + '../platform_tools/nacl/src/nacl_interface.cpp', ], }, ], diff --git a/platform_tools/nacl/SampleApp/SampleApp.nmf b/platform_tools/nacl/SampleApp/SampleApp.nmf new file mode 100644 index 0000000..7296c07 --- /dev/null +++ b/platform_tools/nacl/SampleApp/SampleApp.nmf @@ -0,0 +1,6 @@ +{ + "program": { + "x86-64": {"url": "../../out/nacl64/Debug/SampleApp"}, + "x86-32": {"url": "../../out/nacl32/Debug/SampleApp"} + } +} diff --git a/platform_tools/nacl/SampleApp/index.html b/platform_tools/nacl/SampleApp/index.html new file mode 100644 index 0000000..cbdeefe --- /dev/null +++ b/platform_tools/nacl/SampleApp/index.html @@ -0,0 +1,71 @@ + + + + + + Skia Sample App + + + + + +

Skia Sample App

+

+

+ + + +
+

+ + diff --git a/platform_tools/nacl/debugger/debugger.css b/platform_tools/nacl/debugger/debugger.css new file mode 100644 index 0000000..a63b7e0 --- /dev/null +++ b/platform_tools/nacl/debugger/debugger.css @@ -0,0 +1,172 @@ +body { + width:100%; + height:100%; + margin:0px; + padding:0px; + background-color:#EEE; +} + +div.single-line { + clear:both; +} + +div.column-set { + width:100%; + height:100%; + display:table; + vertical-align:top; + border-collapse:collapse; + margin:0px; +} + +div.column { + display:table-cell; + vertical-align:top; + margin:0px; +} + +div.row-set { + width:100%; + height:100%; + display:table; + vertical-align:top; + border-collapse:collapse; + margin:0px; +} + +div.row { + display:table-row; + vertical-align:top; + margin:0px; +} + +#buttons { + height:5px; + overflow:auto; +} + +#left_column { + width:230px; +} + +#command_list_div { +} + +#command_list_form { + width:100%; + height:100%; +} + +#command_list { + width:100%; + height:100%; +} + +#bottom_row { + height:275px; +} + +#display_pane { +} + +#right_panel { + width:230px; +} + +#tabview { +} + +#matrixclip { +} + +#small_window { + width:218px; + height:218px; + background-color:#FFF; +} + +div.thin_outline { + border:1px solid; + margin:6px; + padding:8px; +} + +div.settings_block { +} + +input.matrix { + width:50px; +} + +#overviewdetails { + width:100%; + height:100%; + resize:none; + padding:10px; +} + +#menu { + height:5px; + overflow:auto; + background-color:#999; +} + +#menu-bar { + margin:0px; +} + +ul.dropdown-menu a { + display:block; + text-decoration:none; + color:#000; +} + +ul.dropdown-menu, ul.dropdown-menu li, ul.dropdown-menu ul { + list-style:none; + margin:0px; + padding:0px; +} + +ul.dropdown-menu { + position:relative; + z-index:597; + float:left; +} + +ul.dropdown-menu li { + float:left; + padding:5px; + cursor:pointer; +} + +ul.dropdown-menu li.hover, ul.dropdown-menu li:hover { + position:relative; + z-index:599; + cursor:default; + background-color:#FFF; +} + +ul.dropdown-menu ul { + visibility:hidden; + position:absolute; + top:100%; + left:0; + z-index:598; + width:195px; + border:1px solid; + border-collapse:collapse; + background-color:#DDD; +} + +ul.dropdown-menu ul li { + float:none; +} + +ul.dropdown-menu ul ul { + top:-2px; + left:100%; +} + +ul.dropdown-menu li:hover > ul { + visibility:visible; +} \ No newline at end of file diff --git a/platform_tools/nacl/debugger/debugger.nmf b/platform_tools/nacl/debugger/debugger.nmf new file mode 100644 index 0000000..7a53e52 --- /dev/null +++ b/platform_tools/nacl/debugger/debugger.nmf @@ -0,0 +1,6 @@ +{ + "program": { + "x86-64": {"url": "../../out/nacl64/Debug/debugger"}, + "x86-32": {"url": "../../out/nacl32/Debug/debugger"} + } +} diff --git a/platform_tools/nacl/debugger/icons/blank.png b/platform_tools/nacl/debugger/icons/blank.png new file mode 100644 index 0000000000000000000000000000000000000000..97246fb9a0850d24edef04e58dd159ad6a3af0f3 GIT binary patch literal 146 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@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8pC z1snidzE=aF0#E=X0BiwB8-}6%WxZTOnvB9Y{y*E^-QI1wO(!`O)7HfjELN1%hswTm zff9;9Fvy@1B+5RdLD5B|NU10bQ;edbBfr{UF+qjk&XqNME`%E&8Rav!rUxgp!MW-SD(Ewa+qfR$K|= zclaIo(+RxJjxqRI#%9dUG4OreFc+T$n_-Pe+BjImryiqx->t5VU4L z^|p^$zymA0A~q%ImOeQJ9Ph`}imPxQDuB@6H=!2j7A%8mNgjIk=0lTc#z4yxa2|f; z;ufyqw*v0YQSUNNv6O3LH4s$sNZoZDu6^qva(q-n#->d}%;v-B+L;SooE}4+Hh7$_ zlAN~hPCzK7Xvk!160X$GiBgyHu$u9 zboCB2?dbO{`ll0?$1AH+&GB2c?k`~HFMzN#7p^_U7%w-ZIvq@hsvtQ~1Rw9iXCgzd z%YCZEj#!cD5W%F9FMY}348GU@=vCe`Xb5qZ2%4# VxhktWaxDM=002ovPDHLkV1kvbE|&lR literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/breakpoint_16x16.png b/platform_tools/nacl/debugger/icons/breakpoint_16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..a25ece8f84701bc3caa84d8a73e451f5437cbf39 GIT binary patch literal 1108 zcmbtSOH30{6g@Lc3k3Oi zj5{SEsXG(n!bB>GaY6h9Z3|KtEfxv|ilk{R{Z6MdzSmeX+M)|ja^Ab|+;iW3GwO7|5Yk2?~Q=9PwnJXzv)MRW}l`jHZoymCkiXh|7*lI+I6H5FvR!Ama0Z zD=&4>I*KAX^tSGDOBy|rBTtY{rXWdDK_-0DFx-Cu+5Hh6=|IXF5Xab;P5e-?ii7@K zAL5}^h(hMC4BWYd&<_!sTEku1oO$2XBv-YYA=s?QD;hvfvgrKZT48@SaK1Ookw_7ItwVTqp24Y_QxyDowsO4rb^(d$1oYh3&&Ah5@tD1S7OBR|3!om)s nCkexZk=zD_yjq1wzn2!}!B=s-+xXVrPZOr2oyO-!F5LbJB}Q8@ literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/delete.png b/platform_tools/nacl/debugger/icons/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..50b604fb9e2177b99a74971ff7d5afa94fa77ffc GIT binary patch literal 1415 zcmV;21$g?2P)X52^tSIxZUw%T3#p>dtR{>^N{$lv57AKr& zEV$v!g_F6&dz)(8jiXxPgJG~X5CuLI1}b3`?_T#!R|-T5z}cGWvce_)uM%Ui`gnK@ z!jb?0)&{c3hr+7zL?Rjs-qGz2K_HxOtZCPdYO#kRfDj-8*f2;66a|)oK|9x+S`B?#7z7gri!n4TYg4xyC90ibxyFdZMoDoJqo`7h&h-4bm5#IL3yzxotBDU}fMb z^1;8XVhq5~jvc>md@u}>(lulzPLmL!rrv?iQ(n7W!{eJ9q$e_Tj5z}YrVG z+ue22J2H|LB8O>`GSr+wJSPAEeB4kYy^-+0fzTvH=)sEv8O4D-n$bf)cI#;KBSB5n zp0T>;d(24rKrZpT003b3p;w>?aScYEZW6>(`Q*-d1OV{Ct$}thw=Cq#fq*!K4DRe3 z$lAbi0vuT#Xk+Hq1!&K;I7u0NGz&ylfOl3eeC6{5rXjXJ-Z$Xhz%l{6{ohueDnir8 z@ubU6xB|SfD$s^}#0ir`bdC+z=P@@Hj17BeVC19%V0E)~ty-bHzK%i{iGOY+ES+ zR8V->2-)K>pwir7K!J=AGW6UW@mYJ}yDn{4R5lw>r(3+5jt6_Z&+ofDsFRxMMfld8 zbrq43kyEVo?Q=&6P#(+LvA=(yGhIC04y?SngPDUV@kH==eNXN0z4T_vqL~>M(ToO! zV%9I!ZK|{*;ZwwB0~i329yk2(!GXa~ETXcRx#``X0YC$ZP0Opyc8}<=h?>9*5W!fU zXAksUK1f7T0tNsp<|IG?fC>Pm0DKyVul1J(w)%_rS-_&-?8Jv(grg@Uuw>4$xdH%S z4O}m61u9)MyAH~=O9L=>|<3t#~#0^kGS0pQWo-;!|v5`afe z!_5lQoaYqrxjQi6Q+VG?i!GyaE0%yW#(i{{{`S V@&HjAEHnTB002ovPDHLkV1jWXiX#93 literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/inspector.png b/platform_tools/nacl/debugger/icons/inspector.png new file mode 100644 index 0000000000000000000000000000000000000000..360f23ef472730d0d17c0c072055f188053c8b32 GIT binary patch literal 1960 zcmV;Z2UqxsP)2)41YZGSjD}B|V2qEb@q-@}OGt>pM--C!_@F^lBmog)09(eU6{LksJAKUK&fLej z=ed_3&YhV%%uI{Al9iLa&)RGK*MG0Q&e_6wL{lKG@ zCb$7gs#*nx;xw4K^r9j%p~*|%%kbC+!&o(7sgd@e@T&Gu)l zs+H4?&cy!TO?{-@xKGQh(_Q{bi-}Aw}f2-HZt&Kpe8L29&D#uSX2EO#8XKrsN?%Ox+y?Dn!xyn+Q z;&kmIW#h3Cs8@aBG~(&0*Ji4o-2crx-*w>99iwey%(|*xll|dir%Lz!;7_+(KX~BQ zYj=(1Y9+}w&e*ep0BOGQ`;un}Jg0wr;pK%aiNEmud)|9s?^`G0eiqgN*!!sm-w~<( z&28_w@S8rCtf5O8pNXy5XuDw{P7-x=HZCvf;klb~8Fy2B6W7`QEP&(~R7P_P#YNwiY?? z=NF$FNZYr}JpQ$C`JGv@T5K|x+B+^7t=}*t?f6uq%fVxFI8_vQ>DVkY z3n9rS_HmZ86sGLkbEzQab4*MQFNgJt$6XM3*Nu-3?XC^fh|_#SD*NT(Ctl{+!)HL? z$n+Aa8gS=cR}BJoj@RFI;zV~J-1Rs-f=BHGaDfP-@7r;~)=D?dHg%xDVA%sz6vL5| zt=_zlya~`rnsf1v@$!iiXKv+^{0WZXJgO5=@=L%qm1%Xja(mhs^V z6yZp6C2;~O#e`}BrVmKTGpK-|6@)5)hn7JRRh2l+F?P8IdV!58R0PCwwhKv~v!+2Q zBss(mL=E6DDi|?%#v!UKb|PjL+MJkeLX^t#271hQpk9xi)2P*r!B~tDL<|@U2+{{e z5t82VTmEt?fH8;_jDV=46~-*JyEK|1%~nX7r9H3;XoS8caI>$TYV7j- z5YJltQi)O!V0|C!`FOsM?+eCQj5?wyB8mi6rQHrWHXm`KEksF59HnTUg3BPwifuty zsZi%;iL<2w06?NK>ZbBMdv}f}aSr4;Bvg|LMKENsffM(|mS^5aAGm2LN=~ch!W5eZ)crn8PtIY^7Mi>s15gQfzzLG$n zdI7XfL7M!OMl{n0y(g7B;j+Ok)GALgam60W!vzR0C}{Ocki;DR$`zD6!*JEZ_8L*{ zl*Qg3)9$ZNk^5E1l2ug)-9_cpKabMx+{7!*Gekdo0|VWkz>%dn;^aQgzA}r;w4hW9 zAY#B4M^q6SVa{ATW3H3Y2y+xcM0!-4zBQiWQf2n#1>)#FURw>mmVss2bGJ{q{8?(F z-(ts=LzIUEG2oX#g{^}Y>D7exYC-ZGT#Duyv+ca-8EG%`sHvPh*rGLmKi%jd4nLIi zhqLPdgzt1zbqY-ygmc$Z8Lm=Y-VUEo%5|*a74z z#2skQ!u;`!=ILok<6mf;K1lP`lN|s3rXkLMgS_x#P^)`V@h9=^O&EK#T7NfQFoyMl z0zj6K#dDIUM{({+viwQyX0Ou literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/next.png b/platform_tools/nacl/debugger/icons/next.png new file mode 100644 index 0000000000000000000000000000000000000000..aae893442460c6e7488a2439deb1243458ba8d84 GIT binary patch literal 938 zcmV;b16BNqP)cUJ?+j&3lb#dPtUZ$OlDPvuj z1Bd%Ay!XDJ^F8NY*omF!Lwq^M%onqzvD^7p^+Dg=QUMNod7XbOe9Qn$_ zk3TmvegERg<9iR@X#hmPEetYxX!^*JgZESywgJ%}00o#3w@_em>XB!TK3HBn^~&9o zcN_o{;kW~o$1Br^$M(*D_UgW#5c%xps~4FW*~KtoZAI+QC0TFU0~-MYLxbFl4!}eR zA#TB8qB8lkTUaT7{+c>Aw{Z2xuJD;>w?511siRLkk5Zrn5wRYLSaC5R1~7m|FbJBw z(zth(K}TRB&>=>Lgx)n)ep>nZhu?w|$4{=_5+dtBJ`efb`$j-1$R(w!R2(bZ28h9E zkQj7K>Ocx1Cct%ajF0Yr%60xYd;0a^V=sMt<#H#$<{1#|k8}WWW{o@cIshHozQ;k* z|0D_9^8gW!n`3zYo`)VdU_LzaM!B*z06^p?>Di1uB=#_AY9C?`w3n;_Xg|pW&ID}` zF(Hnl7&}mU^6-7}*)wmBY=YP{gd$+#0E{3gFaky}$v`3|Sv8QPXfQDl*_LPvO4Neb zhuFvHkX#%x)#4DU7!L7nRO|0cHDdbO1UL2%4Dq21M7bE7}8N z+NTJyBh$Pge*I$co4He07P~soo&l4bxwLcxXde@7fd3~Z+<>@+r2S4_Cv#NEeCkC| zzf?R|T?#({R@3UcIN;k;pbh8%?XO|{HSpIEA}i9F-NeOK-dHZy=05%FZQy6X@9MyM z2&=zb0F|71?IUpuMB57}lO(Ik!9W2Dxs157mHQDiE|zN5dhp(@#8cDLaDfUidXp<# zhx6SD-hFhG$5Ka(zL%XlKmc3@R<;SSYj=TWwXOUuP?tLMY_ zw-WCJNFjo40+3h4sd%#`{?c-(XXV`hZZ9&GHiOz9hP*-!pi z<$VQM_u%{Ai|6JWy?fpn()*R3;R55>%jMVYi1#xb`ZZ5G@xP0|0g0cLv>_HzT>t<8 M07*qoM6N<$f;EW1sQ>@~ literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/pause.png b/platform_tools/nacl/debugger/icons/pause.png new file mode 100644 index 0000000000000000000000000000000000000000..a026a545bebfb59c55995131f982dc9d4bbd529a GIT binary patch literal 1181 zcmV;O1Y-M%P)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX2M`bo6s{Rly#N3NFG)l}R9M69 zm%EN!MG%I+s_O1DV|!OCAi(A-1VTpg6Zi?Rh)7IGgbeFuj-tL1RZsd2aeRZL3+D&(NS;{JasA4kN+rIhP;Ys_1RRG$yyZXY5 zo8OGaX$uGU9)%CzkB*KW>^y2d1b!5iFE73F(sdPCigVl{7x;JQ;TOQCLm_@D08Q6j zxqSKctvB9&lWASZ1xj(+4$J~~e!lbCUw3z}h@@>%yZ-*QtNio0!GTmW1_ow{`pf4PiU=Y)#4Z>pW#*y&1E8`705k2~TxPTmObqitP3MC_RM|f& z98EJKi#~IQ&9NhdK^`z&n2=Qz3&gOd z1c(xXAZ4lT6dWN0Jtl#ul49?E73pz_Anv3j>q&qZX8p9&;V!0qRY@_H7!W0feseWJ zR8UijJ1N;}hMo>U2tlw;Fa|K8-?XX%p35-?V(bB0RLm4L#eu3)L~LCNln|9H5MrNP zRH?>+cG@ilkqA|#SWrSVLeybUDXFqGC7@>@6eX(=Q=eRdlE#6Om)cN-6a|Y)OxA-) zii=W>Z9Nk@f?034tWHRQSoO(A=K}52mKtA4NeICR$%vH^Q$S3qMgi85z){Qu^Zp9S zNTWcg0;6$c5|1+wf}%mNXoM<|MgfgRHCoezB0U3@DdIvk?ki8D$oY-P-XlX69*`7; zQDuxrMm6q1hEbpzM?_54@IX13Oj|C#e2!EZF&VKEQsu;wIh?e3o(r+oChupzd2#FSBIsm v_nthKKMQ~W`jqFsRFys>UwLx#=L_IJgb~pMCrB6J00000NkvXXu0mjf%Q6$D literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/play.png b/platform_tools/nacl/debugger/icons/play.png new file mode 100644 index 0000000000000000000000000000000000000000..5528bafc0676f343ac022bc621b36aaf234f32d8 GIT binary patch literal 1073 zcmV-11kU@3P)1wk+?hL*#KuaSK%2zo4~wa7qJ#>9xN)Hs5d)UA zS`@p{RTpku2?+>Nrf#KBe`$qUYIR|$+JHZZKiOy!B_PJ2HbPBFn#|mv^SLz3;i-g^k*%|9E+44oKnnP`>kDoRtet^TNdQociK0rvMMY+$2DA zUq{=Ky#xL4y*AX;z0TR(W}gST_T0a}t#!+Opt&9ZnOx&0I(O~8`<|UU3df(=^iL4R z3I;493XrJ>03w!Lu7NuS?tAp!-Myzz4By&w?Xv(eH~{Jb0E*g>Y_5SFy}JhbyIYUF ze(<)M5MmsF1E~{$5eqgzG{Dd0=)H5#BZE7)oqp@7t-Wgi1cVqdw!D`~R`26s-r16M zNCF^F_Vyt;^5mO;POo;LI)W6SxwE}% zf7`%=U_3AeF$PRRlX@l!C}2V3%4&l$fM`fAo1wd>dtcU{={Wg}H#B_WkLeUZB}y-$ zbFd7e7L5b1~zJQ1(PFN6&plDnKTXL(05G_Gm1Y1OHn8X<~e?>NDnu5G8E`Y7& zfVD1LHQ*)Prw&+gw?z~*Mx(1xx`IZFXldRFYk+9vqDbF!1A&F9OaAQ37tGO@_C<$* zp6WTUA_9qu;CW8ih!ZA8;}Tk$cVeY^h?m_>PF_h2D}N{Kp@nZ|a^r%!lens>Bfp6@HxaXA5Iy-iLtE~A^!*=}K25}dRnDyfC<5PKr#L{1Le0#p zIxZ}0L8s(U;mo>t}rH}A51QCbU! zVe*nc>%@x}uO(igpso(sv7f!O?~a={KAb9^Uq@Uge`j)Tk=8gSz|Hb%mK&-(unm|8 r{#xg32519Xfn{JCclkH!e_nqBZnDGh9IAIe00000NkvXXu0mjf|GM)c literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/previous.png b/platform_tools/nacl/debugger/icons/previous.png new file mode 100644 index 0000000000000000000000000000000000000000..3396a3f8bd248f9c3bcdce1dfb6bc30f0567c083 GIT binary patch literal 943 zcmV;g15o^lP)V=6m;l{)m zvP5s-ALtb~c&8aJxbQ1kC6Z`j45&2mA3%wTaseg+O%#b@VS%7sTe|Mf%sH5JnsywYE}P7o!GCQKKT-3fLd-XXR!yyU(1%Bd2at_8`Bhl zH7g2G9#zG{&b?lCaKu##XR+t!Q}TX)IR5G*rNYj=UjOzdT_py!Z1WcZP##sq!tjXK zxAh4Z6Cf)IaQfiGrNZzo&mG$1DkY#BAcjO@1pvyUs#wSuyuQtOR~a9WXc@9=+5O{T zK1n19QCLUfJIp&HH)c8a>~W4og}RT?=~AXt*q-;?q1~>dnibmspg|0X2GNLwAR(Bb zz3ag4CIsz+4w$%f;j3Nm@iI{F>Ogr^6^DnmdD+JXU8Q}b13)Qbn`1yiL<|ss(WnSS znjrB-h+*#Z{0rdA1HGl;!9mZ>ZF3z2!n*Y}0#J^C2-1SkK&-KZV6+7yZ0(}#?sQ~l z4#4{_P|ObuczqjluF}43EVKcXAQHa@14^SJ2Sf}=5M56g0W_Bd?R;~@0TNfH*zlAe z^hnqMN38XZvWFBXC6N;bl(8VDj+h3b>$Z7V16{Yv1Ymrd6BB|MoCN^n*mr!JOkMr( zAm;FvEn72A(*bEa02&Er!T$?_yNF-4jm1Y1-E}kx^F>@O0APSyZ=J2bJ2~}J<;aWr z^;~~{CYe-r_8V19qY8c%^xrlM%{VzxVMWWWZV(FrU_IsLrx(o^xrcst4~)zn+Wdgd zIN^-7RK+sf*`(P#_DppG$h`r;Cg%E^-_+l^K7G3~wnrb$^-3m{j1_jEQe*0uKe^J% zhZAMBl^5DCq?qo^FcJOHt^h43KK>#6eABvw`^pY;Xy8Fv@5C&goaW;5A8`cmyVU5W z+t}G$5TND68)x;~mDyBfY+rbEQ?IN~M-O|~Fb!M)YKsJzqkDbN1-Nb!1@J*w6hZkrl}2EbxddW?X?_wfUrhf)$=Fjv*25$$$7+c$hh6 zuwBU8aCI@C1aBiFKcm~GO^MBH-_BevXnx{j`asd(Rl`LAi4Ot`vdrd)mP%xs`2-6e zooUN%!{R1u@IbM_Tu>|j)6rQK@8<394XrT|oD?J4w~f=?Il+X*&6z=h>B(016Pkqu fFC;&l;$R57D6b*1_t1Nw8yGxY{an^LB{Ts5(K$(G literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/reload.png b/platform_tools/nacl/debugger/icons/reload.png new file mode 100644 index 0000000000000000000000000000000000000000..316f36c70490bef611e8eb6e89995207378991e8 GIT binary patch literal 1932 zcmV;72Xpv|P)YTWnO<6^8${_c=3XE@y0y9UEg~5@QGAfpCe-B_T~{o2nP7 zimIwFQKdAhR7Gkt56MfUKD273ls;6Ys-j*ZwGWlrs#T2M%uIY`oFc-)?N#EKyy>+^=>M?>weF(2L%AoP+6V) zshdi--Op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sy87ZRy5WOuypB%;ObyDJ#czl zpB>Ig-iZfBAR$m~SRZdfO+v}o8V#)a8xb%8Qdvm;r-AbMZ-RFhSGyKpp7Q4gvyx9I zR$2|9?+s1?HMVCf@t78Y&`0Y2TDAf#UA$SpGMMcgcxFPM9m<(poQTkN(@o&7Z4xkm z-$p=;+3a4Uf%5Cu8}BTxxQj16=Fb(gCYNrBtp-%LNuX(WKmA)Kz|#BQ*DhcCsq=${ z6{ljLO<21okUYsYF%6XGzO27};oGkBf822@;qFi4Rtau5EO;fj>;D2Qy?3K}xtMnc zo_NTAez$jmc)i`g(a8S>{K6)8!o;|KpclBsF7AZMZDJ3$Bzg<**c@yI19ovOzi00000NkvXXu0mjf1it>o literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/icons/skia.png b/platform_tools/nacl/debugger/icons/skia.png new file mode 100644 index 0000000000000000000000000000000000000000..017ee4f8aa7d01fc6dfd2475cb38aa09c74bbcd6 GIT binary patch literal 1054 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabRA=0U~CBR332`Z|35?M8m5#Zy}iv0 ziMxR$1hKdMWi5Ni7`=tH>N#`vd7v7$mLF`j?|@vkhL6m7S3!aiYk_Q*l6ydLpvbmu zn}KNR)E=M-K-7T&E{W&*vQag%QVXh=rEwM>(;Hz-F827&3TDQZG5F?tv7vazVM%^`YO;m zr``XVi?0IR1N2D#ssEO%o<;7NZMgP=^M>%q85fk6I5YHEPrLr#e&^rz{r7t=|2JOc z!B=>!^vr+WW}}&_`;2FvDOh_x@W6kDDOL>C_6$keIOo_juRor)B|@MQ0?T;m1wtmZOT#wlsZ$No2M zK3{$Aztkc}rS2CD)#?8ZiZk}6F*K!To%rv$@4wx)@51x#7j0Cp0Y-^ZNswPKg9{L( z?Y;{nJ35p=93bcbf|(!A{% z?4g|oRFphp=1QLWz3=DFS~1zv`tsG|cPss7SqlC?8DnAdUEg-MtXKZ|eZN=7`A-(( z=IneLC(Ac6!a+#s{klE1l6<}PJ38fi+MS-PuHHIv$>k^6clT|-?SA#uyt{ex=WUBx z%h#Tqb}Vi4TSl|nB9413ojua+JReo|61%>TC$P4a1z$b9O^Z4$&lPBlNvG*ScUmvwLOhqU%_UyYs(=QIYoE(jAYR4>EzFE4gfs#e<)LpN{39NiPtPUGZ9{yZN}y zd3VR}UQ4~6?U#w0j+pwu`X)W zoOxw2H`tlPpSHY9bmX6-w-|X^ zZ(LN0n<2vTa6_1L74Nsw_uqeuGuocua+241u{(}`9_OqJ@yy*@AND$2-crY~F#E8y zmO}?>N>NCzbe&(6s8RrMBFZmyA|H1mt{o*mhj+xJaiHyP1 L)z4*}Q$iB};z{Z$ literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/debugger/index.html b/platform_tools/nacl/debugger/index.html new file mode 100644 index 0000000..9d4644d --- /dev/null +++ b/platform_tools/nacl/debugger/index.html @@ -0,0 +1,468 @@ + + + + + Skia Debugger + + + + +
+ +
+
+
+ + + + + +
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+ Visibility Filter
+
+
+ On
+ Off +
+
+
+
+ Command Scrolling Preferences
+
+
+
+
+
+ Current Command: +
+
+ +
+
+
+
+
+
+ Command HitBox: +
+
+ +
+
+
+
+
+
+
+ Render Targets
+
+
+
+
+
+
Raster:
+
+ +
+
+
+
+
+
Overdraw Viz:
+
+ +
+
+
+
+
+
OpenGL
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ Zoom Level: +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview + Details +
+
+
+
+
+
+
+
+ Current Matrix + + + + + + + + + + + + + + + + +
+ Current Clip + + + + + + + + + +
+
+
+
+
+
+
+ + + diff --git a/platform_tools/nacl/favicon.ico b/platform_tools/nacl/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e7440c751272b9b25e21ac159ef799bbdb89f31b GIT binary patch literal 318 zcmZQzU<5(|0RbS%!l1#(z#zuJz@P!d0zj+)#2|5e;6GRrNJ1F+l#(yUq-1O;2-Hp~ bjpl-XKsW!XXJGhY&%p3Oo`K;3KWP{M!mb)5 literal 0 HcmV?d00001 diff --git a/platform_tools/nacl/gclient.config b/platform_tools/nacl/gclient.config new file mode 100644 index 0000000..922ae43 --- /dev/null +++ b/platform_tools/nacl/gclient.config @@ -0,0 +1,13 @@ +# To develop Skia targeting NaCl, +# copy this file to your root development directory as ".gclient" +# and then run "gclient sync". +solutions = [ + { + "name" : "nacl", + "url" : "https://skia.googlecode.com/svn/nacl", + }, + { + "name" : "trunk", + "url" : "https://skia.googlecode.com/svn/trunk", + }, +] diff --git a/platform_tools/nacl/httpd.py b/platform_tools/nacl/httpd.py new file mode 100755 index 0000000..2ad1d49 --- /dev/null +++ b/platform_tools/nacl/httpd.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A tiny web server. + +This is intended to be used for testing, and only run from within the examples +directory. +""" + +import BaseHTTPServer +import logging +import optparse +import os +import SimpleHTTPServer +import SocketServer +import sys +import urlparse + + +EXAMPLE_PATH=os.path.dirname(os.path.abspath(__file__)) +NACL_SDK_ROOT = os.getenv('NACL_SDK_ROOT', os.path.dirname(EXAMPLE_PATH)) + + +if os.path.exists(NACL_SDK_ROOT): + sys.path.append(os.path.join(NACL_SDK_ROOT, 'tools')) + import decode_dump + import getos +else: + NACL_SDK_ROOT=None + +last_nexe = None +last_nmf = None + +logging.getLogger().setLevel(logging.INFO) + +# Using 'localhost' means that we only accept connections +# via the loop back interface. +SERVER_PORT = 5103 +SERVER_HOST = '' + +# We only run from the examples directory so that not too much is exposed +# via this HTTP server. Everything in the directory is served, so there should +# never be anything potentially sensitive in the serving directory, especially +# if the machine might be a multi-user machine and not all users are trusted. +# We only serve via the loopback interface. +def SanityCheckDirectory(): + httpd_path = os.path.abspath(os.path.dirname(__file__)) + serve_path = os.path.abspath(os.getcwd()) + + # Verify we are serving from the directory this script came from, or bellow + if serve_path[:len(httpd_path)] == httpd_path: + return + logging.error('For security, httpd.py should only be run from within the') + logging.error('example directory tree.') + logging.error('We are currently in %s.' % serve_path) + sys.exit(1) + + +# An HTTP server that will quit when |is_running| is set to False. We also use +# SocketServer.ThreadingMixIn in order to handle requests asynchronously for +# faster responses. +class QuittableHTTPServer(SocketServer.ThreadingMixIn, + BaseHTTPServer.HTTPServer): + def serve_forever(self, timeout=0.5): + self.is_running = True + self.timeout = timeout + while self.is_running: + self.handle_request() + + def shutdown(self): + self.is_running = False + return 1 + + +# "Safely" split a string at |sep| into a [key, value] pair. If |sep| does not +# exist in |str|, then the entire |str| is the key and the value is set to an +# empty string. +def KeyValuePair(str, sep='='): + if sep in str: + return str.split(sep) + else: + return [str, ''] + + +# A small handler that looks for '?quit=1' query in the path and shuts itself +# down if it finds that parameter. +class QuittableHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + def send_head(self): + """Common code for GET and HEAD commands. + + This sends the response code and MIME headers. + + Return value is either a file object (which has to be copied + to the outputfile by the caller unless the command was HEAD, + and must be closed by the caller under all circumstances), or + None, in which case the caller has nothing further to do. + + """ + path = self.translate_path(self.path) + f = None + if os.path.isdir(path): + if not self.path.endswith('/'): + # redirect browser - doing basically what apache does + self.send_response(301) + self.send_header("Location", self.path + "/") + self.end_headers() + return None + for index in "index.html", "index.htm": + index = os.path.join(path, index) + if os.path.exists(index): + path = index + break + else: + return self.list_directory(path) + ctype = self.guess_type(path) + try: + # Always read in binary mode. Opening files in text mode may cause + # newline translations, making the actual size of the content + # transmitted *less* than the content-length! + f = open(path, 'rb') + except IOError: + self.send_error(404, "File not found") + return None + self.send_response(200) + self.send_header("Content-type", ctype) + fs = os.fstat(f.fileno()) + self.send_header("Content-Length", str(fs[6])) + self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) + self.send_header('Cache-Control','no-cache, must-revalidate') + self.send_header('Expires','-1') + self.end_headers() + return f + + def do_GET(self): + global last_nexe, last_nmf + (_, _, path, query, _) = urlparse.urlsplit(self.path) + url_params = dict([KeyValuePair(key_value) + for key_value in query.split('&')]) + if 'quit' in url_params and '1' in url_params['quit']: + self.send_response(200, 'OK') + self.send_header('Content-type', 'text/html') + self.send_header('Content-length', '0') + self.end_headers() + self.server.shutdown() + return + + if path.endswith('.nexe'): + last_nexe = path + if path.endswith('.nmf'): + last_nmf = path + + SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) + + def do_POST(self): + (_, _,path, query, _) = urlparse.urlsplit(self.path) + if 'Content-Length' in self.headers: + if not NACL_SDK_ROOT: + self.wfile('Could not find NACL_SDK_ROOT to decode trace.') + return + data = self.rfile.read(int(self.headers['Content-Length'])) + nexe = '.' + last_nexe + nmf = '.' + last_nmf + addr = os.path.join(NACL_SDK_ROOT, 'toolchain', + getos.GetPlatform() + '_x86_newlib', + 'bin', 'x86_64-nacl-addr2line') + decoder = decode_dump.CoreDecoder(nexe, nmf, addr, None, None) + info = decoder.Decode(data) + trace = decoder.StackTrace(info) + decoder.PrintTrace(trace, sys.stdout) + decoder.PrintTrace(trace, self.wfile) + + +def Run(server_address, + server_class=QuittableHTTPServer, + handler_class=QuittableHTTPHandler): + httpd = server_class(server_address, handler_class) + logging.info("Starting local server on port %d", server_address[1]) + logging.info("To shut down send http://localhost:%d?quit=1", + server_address[1]) + try: + httpd.serve_forever() + except KeyboardInterrupt: + logging.info("Received keyboard interrupt.") + httpd.server_close() + + logging.info("Shutting down local server on port %d", server_address[1]) + + +def main(): + usage_str = "usage: %prog [options] [optional_portnum]" + parser = optparse.OptionParser(usage=usage_str) + parser.add_option( + '--no_dir_check', dest='do_safe_check', + action='store_false', default=True, + help='Do not ensure that httpd.py is being run from a safe directory.') + (options, args) = parser.parse_args(sys.argv) + if options.do_safe_check: + SanityCheckDirectory() + if len(args) > 2: + print 'Too many arguments specified.' + parser.print_help() + elif len(args) == 2: + Run((SERVER_HOST, int(args[1]))) + else: + Run((SERVER_HOST, SERVER_PORT)) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/platform_tools/nacl/index.html b/platform_tools/nacl/index.html new file mode 100644 index 0000000..abe5d1e --- /dev/null +++ b/platform_tools/nacl/index.html @@ -0,0 +1,22 @@ + + + + + Skia Native Client Apps + + +

Skia Native Client Apps

+

+

+

+ + diff --git a/platform_tools/nacl/nacl_make b/platform_tools/nacl/nacl_make new file mode 100755 index 0000000..81f6eb2 --- /dev/null +++ b/platform_tools/nacl/nacl_make @@ -0,0 +1,104 @@ +#!/bin/bash + +function setenv { + if [ -z "$1" ]; then + echo "ERROR: setenv() requires one argument." + exit 1 + fi + if [ -z "${NACL_SDK_ROOT}" ]; then + echo "ERROR: This script requires NACL_SDK_ROOT to be set." + exit 1 + fi + + ARCH_WIDTH=$1 + if [ ${ARCH_WIDTH} = "32" ]; then + CROSS_ID=i686 + elif [ ${ARCH_WIDTH} = "64" ]; then + CROSS_ID=x86_64 + else + echo "ERROR: Unknown arch width: ${ARCH_WIDTH}" + exit 1 + fi + + OS_NAME=$(uname -s) + if [ $OS_NAME = "Darwin" ]; then + OS_SUBDIR="mac" + OS_SUBDIR_SHORT="mac" + OS_JOBS=4 + elif [ $OS_NAME = "Linux" ]; then + OS_SUBDIR="linux" + OS_SUBDIR_SHORT="linux" + OS_JOBS=4 + else + OS_SUBDIR="windows" + OS_SUBDIR_SHORT="win" + OS_JOBS=1 + fi + + NACL_TOOLCHAIN_ROOT=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_newlib + NACL_BIN_PATH=${NACL_TOOLCHAIN_ROOT}/bin + export NACL_CROSS_PREFIX=${CROSS_ID}-nacl + + if [[ -z "$NACL_MAKE_CCACHE" ]]; then + export NACLCC=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-gcc + export NACLCXX=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-g++ + else + export NACLCC="${NACL_MAKE_CCACHE} ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-gcc" + export NACLCXX="${NACL_MAKE_CCACHE} ${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-g++" + fi + export NACLAR=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ar + export NACLRANLIB=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ranlib + export NACLLD=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ld + export NACLSTRINGS=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strings + export NACLSTRIP=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strip + + export CC=${NACLCC} + export CXX=${NACLCXX} + export AR=${NACLAR} + export RANLIB=${NACLRANLIB} + export PATH=${NACL_BIN_PATH}:${PATH}; + + export GYP_DEFINES="skia_os=nacl skia_arch_width=${ARCH_WIDTH}" +} + +function build { + if [ -z "$1" ]; then + echo "ERROR: build() requires one argument." + exit 1 + fi + setenv $1 + + export SKIA_OUT=out/nacl$1 + make ${MAKE_ARGS} +} + +MAKE_ARGS="" + +while (( "$#" )); do + if [[ "$1" == "--use-ccache" ]]; + then + if [[ -z "$NACL_MAKE_CCACHE" ]]; + then + NACL_MAKE_CCACHE=$(which ccache) + fi + elif [ -z "${MAKE_ARGS}" ]; then + MAKE_ARGS="$1" + else + MAKE_ARGS="${MAKE_ARGS} $1" + fi + shift +done + +if [[ -n "$NACL_MAKE_CCACHE" ]]; then + $NACL_MAKE_CCACHE --version &> /dev/null + if [[ "$?" != "0" ]]; then + echo "Unable to find ccache!" + exit 1 + fi +fi + +build 32 && \ +build 64 && \ +if ! [ -L platform_tools/nacl/out ]; then + ln -s ../../out platform_tools/nacl +fi \ No newline at end of file diff --git a/platform_tools/nacl/src/nacl_debugger.cpp b/platform_tools/nacl/src/nacl_debugger.cpp new file mode 100644 index 0000000..26e3ed6 --- /dev/null +++ b/platform_tools/nacl/src/nacl_debugger.cpp @@ -0,0 +1,221 @@ + +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/graphics_2d.h" +#include "ppapi/cpp/image_data.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/point.h" +#include "ppapi/cpp/rect.h" +#include "ppapi/cpp/var.h" + +#include "SkBase64.h" +#include "SkBitmap.h" +#include "SkCanvas.h" +#include "SkColor.h" +#include "SkDebugger.h" +#include "SkGraphics.h" +#include "SkStream.h" +#include "SkString.h" + +class SkiaInstance; + +// Used by SkDebugf +SkiaInstance* gPluginInstance; + +void FlushCallback(void* data, int32_t result); + +// Skia's subclass of pp::Instance, our interface with the browser. +class SkiaInstance : public pp::Instance { +public: + explicit SkiaInstance(PP_Instance instance) + : pp::Instance(instance) + , fCanvas(NULL) + , fPicture(NULL) + , fFlushLoopRunning(false) + , fFlushPending(false) + + { + gPluginInstance = this; + SkGraphics::Init(); + } + + virtual ~SkiaInstance() { + SkGraphics::Term(); + gPluginInstance = NULL; + } + + virtual void HandleMessage(const pp::Var& var_message) { + // Receive a message from javascript. + if (var_message.is_string()) { + SkString msg(var_message.AsString().c_str()); + if (msg.startsWith("init")) { + } else if (msg.startsWith("LoadSKP")) { + size_t startIndex = strlen("LoadSKP"); + size_t dataSize = msg.size()/sizeof(char) - startIndex; + SkBase64 decodedData; + decodedData.decode(msg.c_str() + startIndex, dataSize); + size_t decodedSize = 3 * (dataSize / 4); + SkDebugf("Got size: %d\n", decodedSize); + if (!decodedData.getData()) { + SkDebugf("Failed to decode SKP\n"); + return; + } + SkMemoryStream pictureStream(decodedData.getData(), decodedSize); + fPicture = new SkPicture(&pictureStream); + if (fPicture->width() == 0 || fPicture->height() == 0) { + SkDebugf("Failed to create SKP.\n"); + return; + } + fDebugger.loadPicture(fPicture); + + // Set up the command list. + SkTArray* commands = fDebugger.getDrawCommandsAsStrings(); + PostMessage("ClearCommands"); + for (int i = 0; i < commands->count(); ++i) { + SkString addCommand("AddCommand:"); + addCommand.append((*commands)[i]); + PostMessage(addCommand.c_str()); + } + PostMessage("UpdateCommands"); + + // Set the overview text. + SkString overviewText; + fDebugger.getOverviewText(NULL, 0.0, &overviewText, 1); + overviewText.prepend("SetOverview:"); + PostMessage(overviewText.c_str()); + + // Draw the SKP. + if (!fFlushLoopRunning) { + Paint(); + } + } else if (msg.startsWith("CommandSelected:")) { + size_t startIndex = strlen("CommandSelected:"); + int index = atoi(msg.c_str() + startIndex); + fDebugger.setIndex(index); + if (!fFlushLoopRunning) { + Paint(); + } + } else if (msg.startsWith("Rewind")) { + fCanvas->clear(SK_ColorWHITE); + fDebugger.setIndex(0); + if (!fFlushLoopRunning) { + Paint(); + } + } else if (msg.startsWith("StepBack")) { + fCanvas->clear(SK_ColorWHITE); + int currentIndex = fDebugger.index(); + if (currentIndex > 1) { + fDebugger.setIndex(currentIndex - 1); + if (!fFlushLoopRunning) { + Paint(); + } + } + } else if (msg.startsWith("Pause")) { + // TODO(borenet) + } else if (msg.startsWith("StepForward")) { + int currentIndex = fDebugger.index(); + if (currentIndex < fDebugger.getSize() -1) { + fDebugger.setIndex(currentIndex + 1); + if (!fFlushLoopRunning) { + Paint(); + } + } + } else if (msg.startsWith("Play")) { + fDebugger.setIndex(fDebugger.getSize() - 1); + if (!fFlushLoopRunning) { + Paint(); + } + } + } + } + + void Paint() { + if (!fImage.is_null()) { + fDebugger.draw(fCanvas); + fDeviceContext.PaintImageData(fImage, pp::Point(0, 0)); + if (!fFlushPending) { + fFlushPending = true; + fDeviceContext.Flush(pp::CompletionCallback(&FlushCallback, this)); + } else { + SkDebugf("A flush is pending... Skipping flush.\n"); + } + } else { + SkDebugf("No pixels to write to!\n"); + } + } + + virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { + if (position.size().width() == fWidth && + position.size().height() == fHeight) { + return; // We don't care about the position, only the size. + } + fWidth = position.size().width(); + fHeight = position.size().height(); + + fDeviceContext = pp::Graphics2D(this, pp::Size(fWidth, fHeight), false); + if (!BindGraphics(fDeviceContext)) { + SkDebugf("Couldn't bind the device context\n"); + return; + } + fImage = pp::ImageData(this, + PP_IMAGEDATAFORMAT_BGRA_PREMUL, + pp::Size(fWidth, fHeight), false); + fBitmap.setConfig(SkBitmap::kARGB_8888_Config, fWidth, fHeight); + fBitmap.setPixels(fImage.data()); + if (fCanvas) { + delete fCanvas; + } + fCanvas = new SkCanvas(fBitmap); + fCanvas->clear(SK_ColorWHITE); + if (!fFlushLoopRunning) { + Paint(); + } + } + + void OnFlush() { + fFlushLoopRunning = true; + fFlushPending = false; + Paint(); + } + +private: + pp::Graphics2D fDeviceContext; + pp::ImageData fImage; + int fWidth; + int fHeight; + + SkBitmap fBitmap; + SkCanvas* fCanvas; + SkDebugger fDebugger; + SkPicture* fPicture; + + bool fFlushLoopRunning; + bool fFlushPending; +}; + +void FlushCallback(void* data, int32_t result) { + static_cast(data)->OnFlush(); +} + +class SkiaModule : public pp::Module { +public: + SkiaModule() : pp::Module() {} + virtual ~SkiaModule() {} + + virtual pp::Instance* CreateInstance(PP_Instance instance) { + return new SkiaInstance(instance); + } +}; + +namespace pp { +Module* CreateModule() { + return new SkiaModule(); +} +} // namespace pp diff --git a/platform_tools/nacl/src/nacl_interface.cpp b/platform_tools/nacl/src/nacl_interface.cpp new file mode 100644 index 0000000..09d55c3 --- /dev/null +++ b/platform_tools/nacl/src/nacl_interface.cpp @@ -0,0 +1,111 @@ + +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/graphics_2d.h" +#include "ppapi/cpp/image_data.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/var.h" + +#include "SkCanvas.h" +#include "SkBitmap.h" +#include "SkString.h" +#include "SkThreadUtils.h" + +class SkiaInstance; + +// Used by SkDebugf +SkiaInstance* gPluginInstance; + +// Main entry point for the app we're linked into +extern int tool_main(int, char**); + +// Tokenize a command line and store it in argc and argv. +void SkStringToProgramArgs(const SkString commandLine, int* argc, char*** argv) { + int numBreaks = 0; + const char* commandChars = commandLine.c_str(); + for (size_t i = 0; i < strlen(commandChars); i++) { + if (isspace(commandChars[i])) { + numBreaks++; + } + } + int numArgs; + if (strlen(commandChars) > 0) { + numArgs = numBreaks + 1; + } else { + numArgs = 0; + } + *argc = numArgs; + *argv = new char*[numArgs + 1]; + (*argv)[numArgs] = NULL; + char* start = (char*) commandChars; + int length = 0; + int argIndex = 0; + for (size_t i = 0; i < strlen(commandChars) + 1; i++) { + if (isspace(commandChars[i]) || '\0' == commandChars[i]) { + if (length > 0) { + char* argument = new char[length + 1]; + memcpy(argument, start, length); + argument[length] = '\0'; + (*argv)[argIndex++] = argument; + } + start = (char*) commandChars + i + 1; + length = 0; + } else { + length++; + } + } +} + +// Run the program with the given command line. +void RunProgram(const SkString& commandLine) { + int argc; + char** argv; + SkStringToProgramArgs(commandLine, &argc, &argv); + tool_main(argc, argv); +} + + +// Skia's subclass of pp::Instance, our interface with the browser. +class SkiaInstance : public pp::Instance { +public: + explicit SkiaInstance(PP_Instance instance) : pp::Instance(instance) { + gPluginInstance = this; + } + + virtual ~SkiaInstance() { + gPluginInstance = NULL; + } + + virtual void HandleMessage(const pp::Var& var_message) { + // Receive a message from javascript. + if (var_message.is_string()) { + SkString msg(var_message.AsString().c_str()); + if (msg.startsWith("init")) { + RunProgram(msg); + } + } + } +}; + +class SkiaModule : public pp::Module { +public: + SkiaModule() : pp::Module() {} + virtual ~SkiaModule() {} + + virtual pp::Instance* CreateInstance(PP_Instance instance) { + return new SkiaInstance(instance); + } +}; + +namespace pp { +Module* CreateModule() { + return new SkiaModule(); +} +} // namespace pp diff --git a/platform_tools/nacl/src/nacl_sample.cpp b/platform_tools/nacl/src/nacl_sample.cpp new file mode 100644 index 0000000..aca74f4 --- /dev/null +++ b/platform_tools/nacl/src/nacl_sample.cpp @@ -0,0 +1,212 @@ +#include +#include + +#include "ppapi/cpp/completion_callback.h" +#include "ppapi/cpp/graphics_2d.h" +#include "ppapi/cpp/image_data.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/var.h" + +#include "SampleApp.h" +#include "SkApplication.h" +#include "SkCanvas.h" +#include "SkBitmap.h" +#include "SkEvent.h" +#include "SkWindow.h" + +class SkiaInstance; + +namespace { +void FlushCallback(void* data, int32_t result); +} + +SkiaInstance* gPluginInstance; +extern int main(int, char**); + +class SkiaInstance : public pp::Instance { + public: + explicit SkiaInstance(PP_Instance instance) : pp::Instance(instance), + fFlushPending(false), + fGraphics2dContext(NULL), + fPixelBuffer(NULL) + { + gPluginInstance = this; + application_init(); + char* commandName = "SampleApp"; + fWindow = new SampleWindow(NULL, 0, &commandName, NULL); + } + + virtual ~SkiaInstance() { + gPluginInstance = NULL; + delete fWindow; + application_term(); + } + + virtual void HandleMessage(const pp::Var& var_message) { + // Receive a message from javascript. Right now this just signals us to + // get started. + uint32_t width = 500; + uint32_t height = 500; + char buffer[2048]; + sprintf(buffer, "SetSize:%d,%d", width, height); + PostMessage(buffer); + } + + virtual void DidChangeView(const pp::Rect& position, + const pp::Rect& clip) { + if (position.size().width() == width() && + position.size().height() == height()) { + return; // Size didn't change, no need to update anything. + } + // Create a new device context with the new size. + DestroyContext(); + CreateContext(position.size()); + // Delete the old pixel buffer and create a new one. + delete fPixelBuffer; + fPixelBuffer = NULL; + if (fGraphics2dContext != NULL) { + fPixelBuffer = new pp::ImageData(this, + PP_IMAGEDATAFORMAT_BGRA_PREMUL, + fGraphics2dContext->size(), + false); + fWindow->resize(position.size().width(), position.size().height()); + fWindow->update(NULL); + paint(); + } + } + + // Indicate whether a flush is pending. This can only be called from the + // main thread; it is not thread safe. + bool flush_pending() const { + return fFlushPending; + } + void set_flush_pending(bool flag) { + fFlushPending = flag; + } + + void paint() { + if (fPixelBuffer) { + // Draw some stuff. TODO(borenet): Actually have SampleApp draw into + // the plugin area. + uint32_t w = fPixelBuffer->size().width(); + uint32_t h = fPixelBuffer->size().height(); + uint32_t* data = (uint32_t*) fPixelBuffer->data(); + // Create a bitmap using the fPixelBuffer pixels + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); + bitmap.setPixels(data); + // Create a canvas with the bitmap as the backend + SkCanvas canvas(bitmap); + + canvas.drawColor(SK_ColorBLUE); + SkRect rect = SkRect::MakeXYWH(10, 10, 80, 80); + SkPaint rect_paint; + rect_paint.setStyle(SkPaint::kFill_Style); + rect_paint.setColor(SK_ColorRED); + canvas.drawRect(rect, rect_paint); + + FlushPixelBuffer(); + } + } + +private: + int width() const { + return fPixelBuffer ? fPixelBuffer->size().width() : 0; + } + + int height() const { + return fPixelBuffer ? fPixelBuffer->size().height() : 0; + } + + bool IsContextValid() const { + return fGraphics2dContext != NULL; + } + + void CreateContext(const pp::Size& size) { + if (IsContextValid()) + return; + fGraphics2dContext = new pp::Graphics2D(this, size, false); + if (!BindGraphics(*fGraphics2dContext)) { + SkDebugf("Couldn't bind the device context"); + } + } + + void DestroyContext() { + if (!IsContextValid()) + return; + delete fGraphics2dContext; + fGraphics2dContext = NULL; + } + + void FlushPixelBuffer() { + if (!IsContextValid()) + return; + // Note that the pixel lock is held while the buffer is copied into the + // device context and then flushed. + fGraphics2dContext->PaintImageData(*fPixelBuffer, pp::Point()); + if (flush_pending()) + return; + set_flush_pending(true); + fGraphics2dContext->Flush(pp::CompletionCallback(&FlushCallback, this)); + } + + bool fFlushPending; + pp::Graphics2D* fGraphics2dContext; + pp::ImageData* fPixelBuffer; + SampleWindow* fWindow; +}; + +class SkiaModule : public pp::Module { +public: + SkiaModule() : pp::Module() {} + virtual ~SkiaModule() {} + + virtual pp::Instance* CreateInstance(PP_Instance instance) { + gPluginInstance = new SkiaInstance(instance); + return gPluginInstance; + } +}; + +namespace { +void FlushCallback(void* data, int32_t result) { + static_cast(data)->set_flush_pending(false); +} +} + +namespace pp { +Module* CreateModule() { + return new SkiaModule(); +} +} // namespace pp + + +/////////////////////////////////////////// +///////////// SkOSWindow impl ///////////// +/////////////////////////////////////////// + +void SkOSWindow::onSetTitle(const char title[]) +{ + char buffer[2048]; + sprintf(buffer, "SetTitle:%s", title); + gPluginInstance->PostMessage(buffer); +} + +void SkOSWindow::onHandleInval(const SkIRect& rect) +{ + gPluginInstance->paint(); +} + +void SkOSWindow::onPDFSaved(const char title[], const char desc[], + const char path[]) { +} + +/////////////////////////////////////////// +/////////////// SkEvent impl ////////////// +/////////////////////////////////////////// + +void SkEvent::SignalQueueTimer(SkMSec ms) { +} + +void SkEvent::SignalNonEmptyQueue() { +} diff --git a/platform_tools/nacl/tests/index.html b/platform_tools/nacl/tests/index.html new file mode 100644 index 0000000..3a0bdb9 --- /dev/null +++ b/platform_tools/nacl/tests/index.html @@ -0,0 +1,78 @@ + + + + + + Skia Unit Tests + + + + + +

Skia Unit Tests

+

+ +

+

+

+ + + +
+

+ + diff --git a/platform_tools/nacl/tests/tests.nmf b/platform_tools/nacl/tests/tests.nmf new file mode 100644 index 0000000..95db050 --- /dev/null +++ b/platform_tools/nacl/tests/tests.nmf @@ -0,0 +1,6 @@ +{ + "program": { + "x86-64": {"url": "../../out/nacl64/Debug/tests"}, + "x86-32": {"url": "../../out/nacl32/Debug/tests"} + } +} -- 2.7.4