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

Unified Diff: tools/deep_memory_profiler/visualizer/app.py

Issue 24534002: Add share button to generate public url for dmprof visualizer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/deep_memory_profiler/visualizer/app.py
diff --git a/tools/deep_memory_profiler/visualizer/app.py b/tools/deep_memory_profiler/visualizer/app.py
index f08cfce842d7c99896db0cc1e12a8c5b28c2ad47..f341cd40b0579bd4deb039984b7938474c9c2209 100644
--- a/tools/deep_memory_profiler/visualizer/app.py
+++ b/tools/deep_memory_profiler/visualizer/app.py
@@ -3,7 +3,9 @@
# found in the LICENSE file.
import jinja2
+import json
import os
+import re
import urllib
import webapp2
@@ -68,7 +70,25 @@ class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
self.redirect('/?' + urllib.urlencode(req_params))
+class ShareHandler(webapp2.RequestHandler):
+ """Handle breakdown template sharing. Generate public url for transferred
+ template and return it back."""
+ def post(self):
+ run_id = self.request.POST['run_id']
+ content = json.loads(self.request.POST['content'])
+ tmpl_key = services.CreateTemplate(content)
+
+ req_params = {
+ 'run_id': run_id,
+ 'tmpl_id': tmpl_key.urlsafe()
+ }
+
+ url = re.sub('share', '', self.request.url)
+ self.response.write(url + '?' + urllib.urlencode(req_params))
+
+
application = webapp2.WSGIApplication([
('/', MainPage),
- ('/upload', UploadHandler)
+ ('/upload', UploadHandler),
+ ('/share', ShareHandler)
], debug=True)
« no previous file with comments | « no previous file | tools/deep_memory_profiler/visualizer/index.html » ('j') | tools/deep_memory_profiler/visualizer/index.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698