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

Side by Side Diff: chrome/browser/extensions/lazy_background_task_queue.h

Issue 10114015: Fix bug where transient pages would miss events dispatched while it was (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_
6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set>
10 #include <string> 11 #include <string>
11 12
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
14 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 18
18 class Extension; 19 class Extension;
19 class ExtensionHost; 20 class ExtensionHost;
(...skipping 29 matching lines...) Expand all
49 const PendingTask& task); 50 const PendingTask& task);
50 51
51 private: 52 private:
52 // A map between an extension_id,Profile pair and the queue of tasks pending 53 // A map between an extension_id,Profile pair and the queue of tasks pending
53 // the load of its background page. 54 // the load of its background page.
54 typedef std::string ExtensionID; 55 typedef std::string ExtensionID;
55 typedef std::pair<Profile*, ExtensionID> PendingTasksKey; 56 typedef std::pair<Profile*, ExtensionID> PendingTasksKey;
56 typedef std::vector<PendingTask> PendingTasksList; 57 typedef std::vector<PendingTask> PendingTasksList;
57 typedef std::map<PendingTasksKey, 58 typedef std::map<PendingTasksKey,
58 linked_ptr<PendingTasksList> > PendingTasksMap; 59 linked_ptr<PendingTasksList> > PendingTasksMap;
60 typedef std::set<PendingTasksKey> PendingPageLoadList;
61
62 void StartLazyBackgroundPage(Profile* profile,
63 const std::string& extension_id);
59 64
60 // content::NotificationObserver interface. 65 // content::NotificationObserver interface.
61 virtual void Observe(int type, 66 virtual void Observe(int type,
62 const content::NotificationSource& source, 67 const content::NotificationSource& source,
63 const content::NotificationDetails& details) OVERRIDE; 68 const content::NotificationDetails& details) OVERRIDE;
64 69
65 // Called when a lazy background page has finished loading, or has failed to 70 // Called when a lazy background page has finished loading, or has failed to
66 // load (host is NULL in that case). All enqueued tasks are run in order. 71 // load (host is NULL in that case). All enqueued tasks are run in order.
67 void ProcessPendingTasks( 72 void ProcessPendingTasks(
68 ExtensionHost* host, 73 ExtensionHost* host,
69 Profile* profile, 74 Profile* profile,
70 const Extension* extension); 75 const Extension* extension);
71 76
72 Profile* profile_; 77 Profile* profile_;
73 content::NotificationRegistrar registrar_; 78 content::NotificationRegistrar registrar_;
74 PendingTasksMap pending_tasks_; 79 PendingTasksMap pending_tasks_;
80 PendingPageLoadList pending_page_loads_;
75 }; 81 };
76 82
77 } // namespace extensions 83 } // namespace extensions
78 84
79 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ 85 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698