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

Unified Diff: ui/android/context_provider_factory.h

Issue 2250473005: content: Fix Context creation logic in ContextProviderFactoryImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run the callback once, fix comments. Created 4 years, 4 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: ui/android/context_provider_factory.h
diff --git a/ui/android/context_provider_factory.h b/ui/android/context_provider_factory.h
index 8ad9d6f4a0c3eacef8a1e0982a974b337ceb4684..ba91f5eb0244e9bdd32a2ad4352b04e16ff82208 100644
--- a/ui/android/context_provider_factory.h
+++ b/ui/android/context_provider_factory.h
@@ -31,8 +31,18 @@ namespace ui {
// This class is not thread-safe and should only be accessed from the UI thread.
class UI_ANDROID_EXPORT ContextProviderFactory {
public:
+ enum class ContextCreationFailureReason {
+ GPU_PROCESS_INITIALIZATION_FAILURE,
+ BROWSER_SHUTDOWN,
+ GPU_SURFACE_HANDLE_LOST,
+
+ // Set if the Context creation was successful.
+ FAILURE_NONE,
no sievers 2016/08/17 18:30:10 nit: how about |ContextCreationResult| and _SUCCES
Khushal 2016/08/17 21:24:56 That's much better. Done.
+ };
+
using ContextProviderCallback =
- base::Callback<void(const scoped_refptr<cc::ContextProvider>&)>;
+ base::Callback<void(const scoped_refptr<cc::ContextProvider>&,
+ ContextCreationFailureReason reason)>;
enum class ContextType {
BLIMP_RENDER_COMPOSITOR_CONTEXT,
@@ -52,8 +62,8 @@ class UI_ANDROID_EXPORT ContextProviderFactory {
// Creates an offscreen ContextProvider for the compositor. Any shared
// contexts passed here *must* have been created using this factory.
- // The callback may be triggered synchronously if possible, and will always
- // have the context provider.
+ // The callback may be triggered synchronously if possible. If the context
+ // creation fails, a null context is passed with the specified reason.
virtual void CreateOffscreenContextProvider(
ContextType context_type,
gpu::SharedMemoryLimits shared_memory_limits,

Powered by Google App Engine
This is Rietveld 408576698