Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/common/extensions/docs/examples/api/messaging/timer/popup.js

Issue 9289057: Changing manifest to v2 extension samples (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding zip files after rebasing with master Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <head> 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 <style> 2 // Use of this source code is governed by a BSD-style license that can be
3 tr { 3 // found in the LICENSE file.
4 white-space: nowrap; 4
5 }
6 .results {
7 text-align: right;
8 min-width: 6em;
9 color: black;
10 }
11 </style>
12 <script>
13 if (!chrome.benchmarking) { 5 if (!chrome.benchmarking) {
14 alert("Warning: Looks like you forgot to run chrome with " + 6 alert("Warning: Looks like you forgot to run chrome with " +
15 " --enable-benchmarking set."); 7 " --enable-benchmarking set.");
16 return; 8 return;
17 } 9 }
18 10
19 function setChildTextNode(elementId, text) { 11 function setChildTextNode(elementId, text) {
20 document.getElementById(elementId).innerText = text; 12 document.getElementById(elementId).innerText = text;
21 } 13 }
22 14
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (response.counter < 1000) { 46 if (response.counter < 1000) {
55 port.postMessage({counter: response.counter}); 47 port.postMessage({counter: response.counter});
56 } else { 48 } else {
57 timer.stop(); 49 timer.stop();
58 var usec = Math.round(timer.microseconds() / response.counter); 50 var usec = Math.round(timer.microseconds() / response.counter);
59 setChildTextNode("resultsConnect", usec + "usec"); 51 setChildTextNode("resultsConnect", usec + "usec");
60 } 52 }
61 }); 53 });
62 }); 54 });
63 } 55 }
64 </script> 56
65 </head> 57 document.addEventListener('DOMContentLoaded', function() {
66 <body> 58 document.querySelector('#testRequest').addEventListener(
67 <table> 59 'click', testRequest);
68 <tr> 60 document.querySelector('#testConnect').addEventListener(
69 <td><button onclick="testRequest()">Measure sendRequest</button></td> 61 'click', testConnect);
70 <td id="resultsRequest" class="results">(results)</td> 62 });
71 </tr>
72 <tr>
73 <td><button onclick="testConnect()">Measure postMessage</button></td>
74 <td id="resultsConnect" class="results">(results)</td>
75 </tr>
76 </table>
77 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698