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

Side by Side Diff: extensions/browser/extension_function.h

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: send increment/decrement request from renderer/ process Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 void set_dispatcher(const base::WeakPtr< 523 void set_dispatcher(const base::WeakPtr<
524 extensions::ExtensionFunctionDispatcher>& dispatcher) { 524 extensions::ExtensionFunctionDispatcher>& dispatcher) {
525 dispatcher_ = dispatcher; 525 dispatcher_ = dispatcher;
526 } 526 }
527 extensions::ExtensionFunctionDispatcher* dispatcher() const { 527 extensions::ExtensionFunctionDispatcher* dispatcher() const {
528 return dispatcher_.get(); 528 return dispatcher_.get();
529 } 529 }
530 530
531 void set_is_from_service_worker(bool value) { 531 void set_service_worker_version_id(int64_t version_id) {
532 is_from_service_worker_ = value; 532 service_worker_version_id_ = version_id;
533 } 533 }
534 534
535 // Gets the "current" web contents if any. If there is no associated web 535 // Gets the "current" web contents if any. If there is no associated web
536 // contents then defaults to the foremost one. 536 // contents then defaults to the foremost one.
537 // NOTE: "current" can mean different things in different contexts. You 537 // NOTE: "current" can mean different things in different contexts. You
538 // probably want to use GetSenderWebContents(). 538 // probably want to use GetSenderWebContents().
539 virtual content::WebContents* GetAssociatedWebContents(); 539 virtual content::WebContents* GetAssociatedWebContents();
540 540
541 // Returns the web contents associated with the sending |render_frame_host_|. 541 // Returns the web contents associated with the sending |render_frame_host_|.
542 // This can be null. 542 // This can be null.
(...skipping 17 matching lines...) Expand all
560 560
561 // The BrowserContext of this function's extension. 561 // The BrowserContext of this function's extension.
562 // TODO(devlin): Grr... protected members. Move this to be private. 562 // TODO(devlin): Grr... protected members. Move this to be private.
563 content::BrowserContext* context_; 563 content::BrowserContext* context_;
564 564
565 private: 565 private:
566 class RenderFrameHostTracker; 566 class RenderFrameHostTracker;
567 567
568 void Destruct() const override; 568 void Destruct() const override;
569 569
570 bool IsFromServiceWorker() const;
571
570 // The dispatcher that will service this extension function call. 572 // The dispatcher that will service this extension function call.
571 base::WeakPtr<extensions::ExtensionFunctionDispatcher> dispatcher_; 573 base::WeakPtr<extensions::ExtensionFunctionDispatcher> dispatcher_;
572 574
573 // The RenderFrameHost we will send responses to. 575 // The RenderFrameHost we will send responses to.
574 content::RenderFrameHost* render_frame_host_; 576 content::RenderFrameHost* render_frame_host_;
575 577
576 // Whether or not this ExtensionFunction was called by an extension Service 578 // If this ExtensionFunction was called by an extension Service Worker, then
577 // Worker. 579 // this contains the worker's version id.
578 bool is_from_service_worker_; 580 int64_t service_worker_version_id_;
579 581
580 std::unique_ptr<RenderFrameHostTracker> tracker_; 582 std::unique_ptr<RenderFrameHostTracker> tracker_;
581 583
582 DelegateForTests* delegate_; 584 DelegateForTests* delegate_;
583 585
584 // The blobs transferred to the renderer process. 586 // The blobs transferred to the renderer process.
585 std::vector<std::string> transferred_blob_uuids_; 587 std::vector<std::string> transferred_blob_uuids_;
586 588
587 DISALLOW_COPY_AND_ASSIGN(UIThreadExtensionFunction); 589 DISALLOW_COPY_AND_ASSIGN(UIThreadExtensionFunction);
588 }; 590 };
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 private: 664 private:
663 // If you're hitting a compile error here due to "final" - great! You're 665 // If you're hitting a compile error here due to "final" - great! You're
664 // doing the right thing, you just need to extend UIThreadExtensionFunction 666 // doing the right thing, you just need to extend UIThreadExtensionFunction
665 // instead of AsyncExtensionFunction. 667 // instead of AsyncExtensionFunction.
666 ResponseAction Run() final; 668 ResponseAction Run() final;
667 669
668 DISALLOW_COPY_AND_ASSIGN(AsyncExtensionFunction); 670 DISALLOW_COPY_AND_ASSIGN(AsyncExtensionFunction);
669 }; 671 };
670 672
671 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 673 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698