Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14043775
D9281.id22041.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9281.id22041.diff
View Options
diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
--- a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
+++ b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
@@ -7,6 +7,29 @@
abstract public function getPanelTypeDescription();
abstract public function getFieldSpecifications();
+ abstract public function renderPanelContent(
+ PhabricatorUser $viewer,
+ PhabricatorDashboardPanel $panel,
+ PhabricatorDashboardPanelRenderingEngine $engine);
+
+ /**
+ * Should this panel pull content in over AJAX?
+ *
+ * Normally, panels use AJAX to render their content. This makes the page
+ * interactable sooner, allows panels to render in parallel, and prevents one
+ * slow panel from slowing everything down.
+ *
+ * However, some panels are very cheap to build (i.e., no expensive service
+ * calls or complicated rendering). In these cases overall performance can be
+ * improved by disabling async rendering so the panel rendering happens in the
+ * same process.
+ *
+ * @return bool True to enable asynchronous rendering when appropriate.
+ */
+ public function shouldRenderAsync() {
+ return true;
+ }
+
public static function getAllPanelTypes() {
static $types;
@@ -40,19 +63,4 @@
return $types;
}
-
-
- public function renderPanelContent(
- PhabricatorUser $viewer,
- PhabricatorDashboardPanel $panel,
- PhabricatorDashboardPanelRenderingEngine $engine) {
- return pht('TODO: Panel content goes here.');
- }
-
- public function shouldRenderAsync() {
- // TODO: For now, just make these things random so we can catch anything
- // that breaks.
- return (mt_rand(0, 1) == 1);
- }
-
}
diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
--- a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
+++ b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeTabs.php
@@ -25,6 +25,11 @@
);
}
+ public function shouldRenderAsync() {
+ // The actual tab panel itself is cheap to render.
+ return false;
+ }
+
public function renderPanelContent(
PhabricatorUser $viewer,
PhabricatorDashboardPanel $panel,
diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php
--- a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php
+++ b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeText.php
@@ -26,6 +26,11 @@
);
}
+ public function shouldRenderAsync() {
+ // Rendering text panels is normally a cheap cache hit.
+ return false;
+ }
+
public function renderPanelContent(
PhabricatorUser $viewer,
PhabricatorDashboardPanel $panel,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 13, 12:49 PM (5 d, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717626
Default Alt Text
D9281.id22041.diff (2 KB)
Attached To
Mode
D9281: Make panels decide async rendering nonrandomly
Attached
Detach File
Event Timeline
Log In to Comment