New issue
Advanced search Search tips

Issue 791760 link

Starred by 0 users

Issue metadata

Status: WontFix
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

AwContentsUserData has a vestigial AwContents pointer

Project Member Reported by paulmiller@chromium.org, Dec 4 2017

Issue description

In android_webview/browser/aw_contents.cc:

class AwContentsUserData : public base::SupportsUserData::Data {
 public:
  explicit AwContentsUserData(AwContents* ptr) : contents_(ptr) {}

  static AwContents* GetContents(WebContents* web_contents) {
    if (!web_contents)
      return NULL;
    AwContentsUserData* data = static_cast<AwContentsUserData*>(
        web_contents->GetUserData(kAwContentsUserDataKey));
    return data ? data->contents_ : NULL;
  }

 private:
  AwContents* contents_;
};

contents_ (actually, the whole AwContentsUserData class) seems unnecessary since https://codereview.chromium.org/10941015. Or am I reading this wrong?
 

Comment 1 by boliu@chromium.org, Dec 5 2017

AwContentsUserData still looks useful to me, since it's used to implement AwContents::FromWebContents.

It's a raw pointer on purpose. By default, WebContents owns its user data, but we don't want WebContents to own AwContents since the ownership is the other way around. So AwContentsUserData explicitly only has a raw pointer back to AwContents.
Status: WontFix (was: Assigned)
Yep, I read it wrong :P

Sign in to add a comment